Update README, CHANGELOG, and reword warnings on ServiceWorker mode.

Fixes #421
This commit is contained in:
Mossroy 2018-09-22 10:43:44 +02:00
parent 7873b751ee
commit c715a1febb
4 changed files with 18 additions and 44 deletions

View File

@ -4,11 +4,18 @@ Please note that this application has changed its name over time.
It was first called Evopedia (and was using the file format of Evopedia)
Then it was renamed Kiwix-html5 (and uses ZIM files), then was renamed Kiwix-JS.
## Kiwix-JS v2.4.0
## Kiwix-JS v2.5.0
Released on TODO
TODO
## Kiwix-JS v2.4.0
Released on 2018-09-22
Performance improvement on decompression of content (now twice faster)
Stability improvement for the ServiceWorker mode
## Kiwix-JS v2.3.1
Released on 2018-09-08

View File

@ -19,7 +19,7 @@ It is unfortunately not technically possible to "remember" the selected ZIM file
## Some technical details
Technically, after reading an article from a ZIM file, there is a need to "inject" the dependencies (images, css etc). For compatibility reasons, there are several ways to do it :
- the "jQuery" mode parses the DOM to find the HTML tags of these dependencies, and modifies them to put the Base64 content in it. It is compatible with any browser, but is slow and can use a lot of memory. It works well on Mediawiki-based content, but can miss some dependencies on some contents
- the "jQuery" mode parses the DOM to find the HTML tags of these dependencies, and modifies them to put the Base64 content in it. It is compatible with any browser. It works well on Mediawiki-based content, but can miss some dependencies on some contents
- the "ServiceWorker" mode uses a Service Worker to catch any HTTP request the page would send, and reply with content read from the ZIM file. It is a generic and much cleaner way than jQuery mode, but it does not work on all browsers. And ServiceWorkers are currently disabled by Mozilla in Firefox extensions
## Compatibility

View File

@ -11,10 +11,11 @@
Home page : http://www.kiwix.org
Main authors of this application :
Mossroy - mossroy@mossroy.fr
Mossroy - https://github.com/mossroy - mossroy@mossroy.fr
Peter-x - https://github.com/peter-x
Jaifroid - https://github.com/Jaifroid
Copyright 2013-2017 Mossroy, Peter-x and contributors
Copyright 2013-2018 Mossroy, Peter-x, Jaifroid, sharun-s and contributors
License GPL v3:
This file is part of Kiwix.
@ -145,7 +146,7 @@
<h3>Credits</h3>
We have to distribute some thanks to :
<ul>
<li>Kelson and all the Kiwix community for welcoming peter-x and me in this project</li>
<li>Kelson and all the Kiwix community for welcoming us in this project</li>
<li>Wikipedia teams and contributors to help spreading knowledge to everybody</li>
<li>All the developers of libraries and tools I used for releasing them as Free software (see License paragraph)</li>
</ul>
@ -217,17 +218,16 @@
<div class="panel panel-danger" id="contentInjectionModeDiv">
<div class="panel-heading">Content injection mode</div>
<div class="panel-body">
Don't touch unless you know what you're doing!
<div class="radio">
<label>
<input type="radio" name="contentInjectionMode" value="jquery" id="jQueryModeRadio" checked>
<strong>JQuery</strong> (slow and memory hungry, but safer)
<strong>JQuery</strong> (stable and safer)
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="contentInjectionMode" value="serviceworker" id="serviceworkerModeRadio">
<strong>ServiceWorker</strong> (faster but unstable, and not supported by all platforms)
<strong>ServiceWorker</strong> (still a bit experimental, and not supported by all platforms)
</label>
</div>
</div>

View File

@ -193,13 +193,8 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles
return false;
});
$('input:radio[name=contentInjectionMode]').on('change', function(e) {
if (checkWarnServiceWorkerMode(this.value)) {
// Do the necessary to enable or disable the Service Worker
setContentInjectionMode(this.value);
}
else {
setContentInjectionMode('jquery');
}
// Do the necessary to enable or disable the Service Worker
setContentInjectionMode(this.value);
});
/**
@ -325,35 +320,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles
// Save the value in a cookie, so that to be able to keep it after a reload/restart
cookies.setItem('lastContentInjectionMode', value, Infinity);
}
/**
* If the ServiceWorker mode is selected, warn the user before activating it
* @param chosenContentInjectionMode The mode that the user has chosen
*/
function checkWarnServiceWorkerMode(chosenContentInjectionMode) {
if (chosenContentInjectionMode === 'serviceworker' && !cookies.hasItem("warnedServiceWorkerMode")) {
// The user selected the "serviceworker" mode, which is still unstable
// So let's display a warning to the user
// If the focus is on the search field, we have to move it,
// else the keyboard hides the message
if ($("#prefix").is(":focus")) {
$("searchArticles").focus();
}
if (confirm("The 'Service Worker' mode is still UNSTABLE for now."
+ " It happens that the application needs to be reinstalled (or the ServiceWorker manually removed)."
+ " Please confirm with OK that you're ready to face this kind of bugs, or click Cancel to stay in 'jQuery' mode.")) {
// We will not display this warning again for one day
cookies.setItem("warnedServiceWorkerMode", true, 86400);
return true;
}
else {
return false;
}
}
return true;
}
// At launch, we try to set the last content injection mode (stored in a cookie)
var lastContentInjectionMode = cookies.getItem('lastContentInjectionMode');
if (lastContentInjectionMode) {