mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-22 20:13:35 -04:00
parent
7f9ddc5a07
commit
1cd958752c
@ -900,36 +900,31 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles
|
||||
var encodedUrl = dirEntry.url.replace(/[^/]+/g, function(matchedSubstring) {
|
||||
return encodeURIComponent(matchedSubstring);
|
||||
});
|
||||
|
||||
var iframeArticleContent = document.getElementById('articleContent');
|
||||
iframeArticleContent.onload = function() {
|
||||
// The iframe is empty, show spinner on load of landing page
|
||||
$("#searchingArticles").show();
|
||||
$("#articleList").empty();
|
||||
$('#articleListHeaderMessage').empty();
|
||||
$('#articleListWithHeader').hide();
|
||||
$("#prefix").val("");
|
||||
iframeArticleContent.onload = function() {
|
||||
// The content is fully loaded by the browser : we can hide the spinner
|
||||
$("#searchingArticles").hide();
|
||||
// Deflect drag-and-drop of ZIM file on the iframe to Config
|
||||
var doc = iframeArticleContent.contentDocument ? iframeArticleContent.contentDocument.documentElement : null;
|
||||
var docBody = doc ? doc.getElementsByTagName('body') : null;
|
||||
docBody = docBody ? docBody[0] : null;
|
||||
if (docBody) {
|
||||
docBody.addEventListener('dragover', handleIframeDragover);
|
||||
docBody.addEventListener('drop', handleIframeDrop);
|
||||
}
|
||||
if (iframeArticleContent.contentWindow) iframeArticleContent.contentWindow.onunload = function() {
|
||||
$("#searchingArticles").show();
|
||||
};
|
||||
};
|
||||
// We put the ZIM filename as a prefix in the URL, so that browser caches are separate for each ZIM file
|
||||
iframeArticleContent.src = "../" + selectedArchive._file._files[0].name + "/" + dirEntry.namespace + "/" + encodedUrl;
|
||||
// The content is fully loaded by the browser : we can hide the spinner
|
||||
$("#searchingArticles").hide();
|
||||
// Display the iframe content
|
||||
$("#articleContent").show();
|
||||
// Deflect drag-and-drop of ZIM file on the iframe to Config
|
||||
var doc = iframeArticleContent.contentDocument ? iframeArticleContent.contentDocument.documentElement : null;
|
||||
var docBody = doc ? doc.getElementsByTagName('body') : null;
|
||||
docBody = docBody ? docBody[0] : null;
|
||||
if (docBody) {
|
||||
docBody.addEventListener('dragover', handleIframeDragover);
|
||||
docBody.addEventListener('drop', handleIframeDrop);
|
||||
}
|
||||
// Reset UI when the article is unloaded
|
||||
if (iframeArticleContent.contentWindow) iframeArticleContent.contentWindow.onunload = function() {
|
||||
$("#articleList").empty();
|
||||
$('#articleListHeaderMessage').empty();
|
||||
$('#articleListWithHeader').hide();
|
||||
$("#prefix").val("");
|
||||
$("#searchingArticles").show();
|
||||
};
|
||||
};
|
||||
iframeArticleContent.src = "article.html";
|
||||
// We put the ZIM filename as a prefix in the URL, so that browser caches are separate for each ZIM file
|
||||
iframeArticleContent.src = "../" + selectedArchive._file._files[0].name + "/" + dirEntry.namespace + "/" + encodedUrl;
|
||||
} else {
|
||||
// In jQuery mode, we read the article content in the backend and manually insert it in the iframe
|
||||
if (dirEntry.isRedirect()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user