++ Open Web Analytics

https://test.freeplanet.app/owa
This commit is contained in:
Paolo Arena
2019-03-17 02:09:10 +01:00
parent f23f60e540
commit 43a568bce7
7 changed files with 40 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
APP_VERSION="0.0.55"
APP_VERSION="0.0.57"
APP_NAME="FreePlanet"
SERVICE_WORKER_FILE="service-worker.js"
APP_ID="1"

View File

@@ -18,7 +18,7 @@
"test:cover": "jest --coverage",
"build": "quasar build -m pwa",
"build:clean": "quasar clean",
"serve": "quasar serve ./dist/pwa-mat",
"serve": "quasar serve ./dist/pwa",
"serve:coverage": "quasar serve test/coverage/lcov-report/ --cache 0 --port 8788",
"deploy": "deploy.sh",
"deploy_server_test": "NODE_ENV=test quasar build -m pwa",
@@ -129,4 +129,4 @@
"last 2 versions",
"not ie <= 10"
]
}
}

View File

@@ -207,6 +207,8 @@ module.exports = function (ctx) {
// workboxPluginMode: 'GenerateSW',
workboxPluginMode: 'InjectManifest',
workboxOptions: {
skipWaiting: true,
clientsClaim: true
// swSrc: 'src/sw.js',
},
manifest: {

View File

@@ -81,7 +81,7 @@ if (workbox) {
workbox.routing.registerRoute(
new RegExp(/\.(?:png|gif|jpg|jpeg|svg)$/),
workbox.strategies.staleWhileRevalidate({
workbox.strategies.CacheFirst({
cacheName: 'images',
plugins: [
new workbox.expiration.Plugin({
@@ -92,6 +92,22 @@ if (workbox) {
}),
);
// Per Articoli....
const articleHandler = workbox.strategies.networkFirst({
cacheName: 'articles-cache',
plugins: [
new workbox.expiration.Plugin({
maxEntries: 50,
})
]
});
workbox.routing.registerRoute(/(.*)article(.*)\.html/, args => {
return articleHandler.handle(args);
});
workbox.routing.registerRoute(
new RegExp(/.*(?:googleapis|gstatic)\.com.*$/),
workbox.strategies.staleWhileRevalidate({
@@ -218,18 +234,13 @@ if (workbox) {
);
workbox.routing.registerRoute(
new RegExp(/.*\/(?:css|font).*/),
workbox.strategies.cacheFirst({
cacheName: 'css-fonts',
plugins: [
new workbox.expiration.Plugin({
maxAgeSeconds: 30 * 24 * 60 * 60,
}),
]
})
new RegExp(/\.(?:js|css|font)$/),
new workbox.strategies.StaleWhileRevalidate( {
cacheName: 'js-css-fonts',
}),
);
/*
workbox.routing.registerRoute(
new RegExp('https://cdnjs.coudflare.com/ajax/libs/material-design-lite/1.3.0/material.indigo-pink.min.css'),
workbox.strategies.staleWhileRevalidate({
@@ -241,6 +252,7 @@ if (workbox) {
]
})
);
*/
// Storage
workbox.routing.registerRoute(
@@ -270,6 +282,7 @@ if (workbox) {
})
);
/*
workbox.routing.registerRoute(
new RegExp(/^http/),
workbox.strategies.networkFirst({
@@ -282,6 +295,7 @@ if (workbox) {
]
})
);
*/
workbox.routing.registerRoute(

View File

@@ -1,15 +1,15 @@
import { UserStore } from "../store/Modules";
import messages from "../statics/i18n";
import { UserStore } from '../store/Modules'
import messages from '../statics/i18n'
function translate(params) {
let msg = params.split('.')
let lang = UserStore.state.lang
const msg = params.split('.')
const lang = UserStore.state.lang
let stringa = messages[lang]
const stringa = messages[lang]
let ris = stringa
if (ris !== undefined) {
msg.forEach(param => {
msg.forEach((param) => {
ris = ris[param]
})
} else {

View File

@@ -30,7 +30,7 @@ else
var owa_cmds = owa_cmds || [];
owa_cmds.push(['setSiteId', getidtrack()]);
owa_cmds.push(['trackPageView']);
owa_cmds.push(['trackClicks']);
// owa_cmds.push(['trackClicks']);
(function () {
var _owa = document.createElement('script');

View File

@@ -1,11 +1,11 @@
module.exports = {
"globDirectory": "dist/pwa-mat/",
"globDirectory": "dist/pwa/",
"globPatterns": [
"**/*.{css,woff2,woff,svg,html,js,json,ico}"
// "src/images/*.{jpg,png}"
],
// "swSrc": "dist/pwa-mat/src-sw.js",
"swDest": "dist/pwa-mat/service-worker.js",
// "swSrc": "dist/pwa/src-sw.js",
"swDest": "dist/pwa/service-worker.js",
"globIgnores": [
"../workbox-config.js",
"help/**"