Add further tests for existence of content on SW article load #520 (#524)

Closes #520.
This commit is contained in:
Jaifroid 2019-06-26 18:21:31 +01:00 committed by GitHub
parent c6b809585d
commit 0f4b102703
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -906,14 +906,14 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles
// 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.documentElement;
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);
}
iframeArticleContent.contentWindow.onunload = function() {
if (iframeArticleContent.contentWindow) iframeArticleContent.contentWindow.onunload = function() {
$("#searchingArticles").show();
};
};