1
0
Fork 0
mirror of https://github.com/marcrobledo/RomPatcher.js.git synced 2025-06-27 16:25:54 +00:00

PWA fix attempt 5

This commit is contained in:
Marc Robledo 2019-04-18 12:08:55 +02:00
parent a23fdbec00
commit 7e966df0ec
3 changed files with 7 additions and 7 deletions

View file

@ -11,6 +11,11 @@ const HEADERS_INFO=[
const FORCE_HTTPS=true; const FORCE_HTTPS=true;
/* service worker */
if(FORCE_HTTPS && location.protocol==='http:')
location.href=window.location.href.replace('http:','https:');
else if(location.protocol==='https:' && 'serviceWorker' in navigator)
navigator.serviceWorker.register('/RomPatcher.js/_cache_service_worker.js', {scope: '/RomPatcher.js/'});
@ -155,11 +160,6 @@ function fetchPredefinedPatch(i, doNotDisable){
/* initialize app */ /* initialize app */
addEvent(window,'load',function(){ addEvent(window,'load',function(){
/* service worker */
if(FORCE_HTTPS && location.protocol==='http:')
location.href=window.location.href.replace('http:','https:');
else if(location.protocol==='https:' && 'serviceWorker' in navigator)
navigator.serviceWorker.register('_cache_service_worker.js');
/* language */ /* language */
var langCode=(navigator.language || navigator.userLanguage).substr(0,2); var langCode=(navigator.language || navigator.userLanguage).substr(0,2);

View file

@ -30,7 +30,7 @@ caches.keys().then(function(cacheNames){
}); });
var PRECACHE_ID='rom-patcher-js'; var PRECACHE_ID='rom-patcher-js';
var PRECACHE_VERSION='v2'; var PRECACHE_VERSION='v3';
var PRECACHE_URLS=[ var PRECACHE_URLS=[
'/RomPatcher.js/','/RomPatcher.js/index.html', '/RomPatcher.js/','/RomPatcher.js/index.html',
'/RomPatcher.js/manifest.json', '/RomPatcher.js/manifest.json',

View file

@ -122,7 +122,7 @@
<!-- FOOTER --> <!-- FOOTER -->
<footer> <footer>
Rom Patcher JS <small>v2.0 RC1d</small> by <a href="/">Marc Robledo</a> Rom Patcher JS <small>v2.0 RC1e</small> by <a href="/">Marc Robledo</a>
<br /> <br />
<i class="icon github"></i> <a href="https://github.com/marcrobledo/RomPatcher.js/" target="_blank">See on GitHub</a> <i class="icon github"></i> <a href="https://github.com/marcrobledo/RomPatcher.js/" target="_blank">See on GitHub</a>
<i class="icon heart"></i> <a href="https://www.paypal.me/marcrobledo/5" target="_blank" rel="nofollow">Donate</a> <i class="icon heart"></i> <a href="https://www.paypal.me/marcrobledo/5" target="_blank" rel="nofollow">Donate</a>