Skip to content

Commit

Permalink
Update README, CHANGELOG, and reword warnings on ServiceWorker mode.
Browse files Browse the repository at this point in the history
Fixes #421
  • Loading branch information
mossroy committed Sep 22, 2018
1 parent 7873b75 commit c715a1f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 44 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
Home page : http://www.kiwix.org
Main authors of this application :
Mossroy - [email protected]
Mossroy - https://github.com/mossroy - [email protected]
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.
Expand Down Expand Up @@ -145,7 +146,7 @@ <h3>Feedback / helping / contributing</h3>
<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>
Expand Down Expand Up @@ -217,17 +218,16 @@ <h3>Expert settings</h3>
<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>
Expand Down
39 changes: 3 additions & 36 deletions www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

/**
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit c715a1f

Please sign in to comment.