Skip to content

Commit

Permalink
Merge pull request #417 from kiwix/display-article-immediately-after-…
Browse files Browse the repository at this point in the history
…search-in-serviceworker-mode

Display the content immediately after a search in ServiceWorker mode.
  • Loading branch information
mossroy authored Sep 19, 2018
2 parents 02e6d15 + 91347aa commit f835bfd
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,16 +773,23 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles
*/
function readArticle(dirEntry) {
if (contentInjectionMode === 'serviceworker') {
// In ServiceWorker mode, we simply set the iframe src and show it when it's ready.
// In ServiceWorker mode, we simply set the iframe src.
// (reading the backend is handled by the ServiceWorker itself)
// But we still need to empty the article content first.
$('#articleContent').contents().remove();
var iframeArticleContent = document.getElementById('articleContent');
iframeArticleContent.onload = function () {
iframeArticleContent.onload = function () {};
// Actually display the iframe content
$("#readingArticle").hide();
iframeArticleContent.onload = function() {
// The iframe is empty
iframeArticleContent.onload = function () {
// The content is fully loaded by the browser : we can hide the spinner
iframeArticleContent.onload = function () {};
$("#readingArticle").hide();
};
iframeArticleContent.src = dirEntry.namespace + "/" + dirEntry.url;
// Display the iframe content
$("#articleContent").show();
};
iframeArticleContent.src = dirEntry.namespace + "/" + dirEntry.url;
iframeArticleContent.src = "article.html";
}
else {
// In jQuery mode, we read the article content in the backend and manually insert it in the iframe
Expand Down

0 comments on commit f835bfd

Please sign in to comment.