Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display the content immediately after a search in ServiceWorker mode. #417

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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