mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-23 04:28:30 -04:00
Merge pull request #417 from kiwix/display-article-immediately-after-search-in-serviceworker-mode
Display the content immediately after a search in ServiceWorker mode.
This commit is contained in:
commit
f835bfded4
@ -773,16 +773,23 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles
|
|||||||
*/
|
*/
|
||||||
function readArticle(dirEntry) {
|
function readArticle(dirEntry) {
|
||||||
if (contentInjectionMode === 'serviceworker') {
|
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)
|
// (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');
|
var iframeArticleContent = document.getElementById('articleContent');
|
||||||
iframeArticleContent.onload = function () {
|
iframeArticleContent.onload = function() {
|
||||||
iframeArticleContent.onload = function () {};
|
// The iframe is empty
|
||||||
// Actually display the iframe content
|
iframeArticleContent.onload = function () {
|
||||||
$("#readingArticle").hide();
|
// 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();
|
$("#articleContent").show();
|
||||||
};
|
};
|
||||||
iframeArticleContent.src = dirEntry.namespace + "/" + dirEntry.url;
|
iframeArticleContent.src = "article.html";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// In jQuery mode, we read the article content in the backend and manually insert it in the iframe
|
// In jQuery mode, we read the article content in the backend and manually insert it in the iframe
|
||||||
|
Loading…
x
Reference in New Issue
Block a user