diff --git a/www/js/app.js b/www/js/app.js index 21894ebf..64d828ee 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -760,7 +760,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett // Populate version info var versionSpans = document.getElementsByClassName('version'); for (var i = 0; i < versionSpans.length; i++) { - versionSpans[i].innerHTML = i ? params.version : params.version.replace(/\s+.*$/, ""); + versionSpans[i].innerHTML = i ? params.appVersion : params.appVersion.replace(/\s+.*$/, ""); } if (params.fileVersion && /UWP|Electron/.test(params.appType)) { var packagedInfoParas = document.getElementsByClassName('packagedInfo'); @@ -815,7 +815,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett caches.keys().then(function (keyList) { if (keyList.length < 2) document.getElementById('alertBoxPersistent').innerHTML = ''; keyList.forEach(function(key) { - if (key === 'kiwix-precache-' + params.version) return; + if (key === 'kiwix-precache-' + params.appVersion) return; // If we get here, then there is a cache key that does not match our version, i.e. a PWA-in-waiting params.upgradeNeeded = true; document.getElementById('alertBoxPersistent').innerHTML = @@ -1563,7 +1563,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett } if (this.checked && /UWP/.test(params.appType) && params.windowOpener && params.cssSource !== 'desktop') { if (message) message += '\n\n'; - message += 'Please note that hidden elements will not be displayed in any NEW windows or tabs that you open in this UWP app. If you want to see hidden elements in new windows in Wikimedia ZIMs, please switch to Desktop style (above), where they are shown by default.'; + message += 'Please note that hidden elements will not be displayed in any NEW windows or tabs that you open in this UWP app. If you want to see hidden elements in new windows in *Wikimedia* ZIMs, please switch to Desktop style (above), where they are shown by default.'; } if (!this.checked && params.manipulateImages) { message += 'We are turning off the image manipulation option because it is no longer needed to display hidden elements. You may turn it back on if you need it for another reason.'; @@ -1691,7 +1691,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett } } //Code below triggers display of modal info box if app is run for the first time, or it has been upgraded to new version - if (settingsStore.getItem('version') !== params.version) { + if (settingsStore.getItem('appVersion') !== params.appVersion) { firstRun = true; // If we have an update and the last selected archive is the packaged file, it is best not to preserve last read article @@ -1703,7 +1703,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett // Update the installed version if (settingsStore.getItem('PWAInstalled')) { - params.PWAInstalled = params.version; + params.PWAInstalled = params.appVersion; settingsStore.setItem('PWAInstalled', params.PWAInstalled); } // One-time cleanup of idxDB files to delete deprecated databases if possible @@ -1716,7 +1716,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett $('#myModal').modal({ backdrop: "static" }); - settingsStore.setItem('version', params.version, Infinity); + settingsStore.setItem('appVersion', params.appVersion, Infinity); }, 1000); } }); diff --git a/www/js/init.js b/www/js/init.js index 875641ec..c6e4f74e 100644 --- a/www/js/init.js +++ b/www/js/init.js @@ -49,7 +49,7 @@ var params = {}; */ var appstate = {}; /******** UPDATE VERSION IN pwabuilder-sw.js TO MATCH VERSION AND CHECK PWASERVER BELOW!!!!!!! *******/ -params['version'] = "1.7.7"; //DEV: Manually update this version when there is a new release: it is compared to the Settings Store "version" in order to show first-time info, and the cookie is updated in app.js +params['appVersion'] = "1.7.7"; //DEV: Manually update this version when there is a new release: it is compared to the Settings Store "appVersion" in order to show first-time info, and the cookie is updated in app.js /******* UPDATE THIS ^^^^^^ IN service worker AND PWA-SERVER BELOW !! ********************/ params['packagedFile'] = getSetting('packagedFile') || "wikipedia_en_100_nopic_2021-10.zim"; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename (for split files, give the first chunk *.zimaa) and place file(s) in default storage params['archivePath'] = "archives"; //The directory containing the packaged archive(s) (relative to app's root directory) @@ -267,7 +267,7 @@ function getAppType() { // Set up storage types // First check that we have not simply upgraded the app and the packaged file params.packagedFileStub = params.packagedFile ? params.packagedFile.replace(/(?:-app_maxi)?_[\d-]+\.zim\w?\w?$/, ''): null; -if (params.packagedFileStub && params.version !== getSetting('version') && ~params.storedFile.indexOf(params.packagedFileStub)) { +if (params.packagedFileStub && params.appVersion !== getSetting('appVersion') && ~params.storedFile.indexOf(params.packagedFileStub)) { console.log('The packaged archive has been upgraded: resetting file pointers to point to ' + params.packagedFile); params.lastPageVisit = ''; params.storedFile = params.packagedFile; @@ -366,7 +366,7 @@ function installApp(e) { } window.addEventListener('appinstalled', function(e) { - params.PWAInstalled = params.version; + params.PWAInstalled = params.appVersion; if (params.storeType === 'cookie') { document.cookie = 'PWAInstalled=' + encodeURIComponent(params.PWAInstalled) + '; expires=Fri, 31 Dec 9999 23:59:59 GMT'; } else if (params.storeType === 'local_storage') { diff --git a/www/js/lib/cache.js b/www/js/lib/cache.js index c136de8d..e8718ab1 100644 --- a/www/js/lib/cache.js +++ b/www/js/lib/cache.js @@ -23,7 +23,7 @@ 'use strict'; define(['settingsStore', 'uiUtil'], function(settingsStore, uiUtil) { - const CACHEAPI = 'kiwix-precache-' + params.version; // Set the database or cache name here + const CACHEAPI = 'kiwix-precache-' + params.appVersion; // Set the database or cache name here const CACHEIDB = 'kiwix-assetsCache'; // For idxDB we don't want the name to change var objStore = 'kiwix-assets'; // Name of the object store