diff --git a/www/js/app.js b/www/js/app.js
index ca0b1251d..81bb15079 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -1045,8 +1045,8 @@ function launchBrowserExtensionServiceWorker () {
(translateUI.t('dialog-allow-internetaccess-message3') || 'It supports more types of ZIM archives and is much more robust.
We') + ' ');
message += (translateUI.t('dialog-allow-internetaccess-message4') ||
'need one-time access to our secure server so that the app can re-launch as a Progressive Web App (PWA). ' +
- 'If available, the PWA will work offline, but will auto-update periodically when online as per the ' +
- 'Service Worker spec.
You can switch back any time by returning to JQuery mode.
' +
+ 'If available, the PWA will work offline, but will auto-update periodically when online as per the ' +
+ 'Service Worker spec.You can switch back any time by returning to JQuery mode.
' +
'WARNING: This will attempt to access the following server:
') + params.PWAServer + '
';
var launchPWA = function () {
uiUtil.spinnerDisplay(false);
@@ -1395,7 +1395,7 @@ function displayFileSelect () {
if (e.key === 'Enter' || e.key === ' ' || e.keyCode === 32) {
e.preventDefault();
folderSelect.click();
-}
+ }
});
}
@@ -1509,18 +1509,7 @@ function setLocalArchiveFromFileList (files) {
}
}
resetCssCache();
- selectedArchive = null;
- selectedArchive = zimArchiveLoader.loadArchiveFromFiles(files, function () {
- document.getElementById('downloadInstruction').style.display = 'none';
- // var tmpMessageChannel = new MessageChannel();
- // tmpMessageChannel.port1.onmessage = function () {
- // // The archive is set : go back to home page to start searching
- // $("#btnHome").click();
- // }
- // selectedArchive.callLibzimWorker({ action: "init", files: selectedArchive._file._files }).then(function (worker) {
- // $("#btnHome").click();
- // });
- }, function (message, label) {
+ zimArchiveLoader.loadArchiveFromFiles(files, archiveReadyCallback, function (message, label) {
// callbackError which is called in case of an error
uiUtil.systemAlert(message, label);
});
@@ -1673,7 +1662,7 @@ function populateListOfArticles (dirEntryArray, reportingSearch) {
// Info: encodeURIComponent encodes all characters except A-Z a-z 0-9 - _ . ! ~ * ' ( )
var dirEntryStringId = encodeURIComponent(dirEntry.toStringId());
articleListDivHtml += '' + dirEntry.getTitleOrUrl() + '';
+ '" class="list-group-item">' + dirEntry.getTitleOrUrl() + '';
}
// innerHTML required for this line
@@ -1682,11 +1671,11 @@ function populateListOfArticles (dirEntryArray, reportingSearch) {
// and prevents this event from firing; note that touch also triggers mousedown
document.querySelectorAll('#articleList a').forEach(function (link) {
link.addEventListener('mousedown', function (e) {
- // Cancel search immediately
- appstate.search.status = 'cancelled';
- handleTitleClick(e);
- return false;
- });
+ // Cancel search immediately
+ appstate.search.status = 'cancelled';
+ handleTitleClick(e);
+ return false;
+ });
});
if (!stillSearching) document.getElementById('searchingArticles').style.display = 'none';
document.getElementById('articleListWithHeader').style.display = '';
@@ -1735,7 +1724,7 @@ function isDirEntryExpectedToBeDisplayed (dirEntry) {
if (expectedArticleURLToBeDisplayed !== curArticleURL) {
console.debug('url of current article :' + curArticleURL + ', does not match the expected url :' +
- expectedArticleURLToBeDisplayed);
+ expectedArticleURLToBeDisplayed);
return false;
}
return true;
@@ -2256,30 +2245,30 @@ function displayArticleContentInIframe (dirEntry, htmlArticle) {
function insertMediaBlobsJQuery () {
var iframe = iframeArticleContent.contentDocument;
Array.prototype.slice.call(iframe.querySelectorAll('video, audio, source, track'))
- .forEach(function (mediaSource) {
- var source = mediaSource.getAttribute('src');
- source = source ? uiUtil.deriveZimUrlFromRelativeUrl(source, baseUrl) : null;
- // We have to exempt text tracks from using deriveZimUrlFromRelativeurl due to a bug in Firefox [kiwix-js #496]
- source = source || decodeURIComponent(mediaSource.dataset.kiwixurl);
- if (!source || !regexpZIMUrlWithNamespace.test(source)) {
- if (source) console.error('No usable media source was found for: ' + source);
- return;
- }
- var mediaElement = /audio|video/i.test(mediaSource.tagName) ? mediaSource : mediaSource.parentElement;
- // If the "controls" property is missing, we need to add it to ensure jQuery-only users can operate the video. See kiwix-js #760.
- if (/audio|video/i.test(mediaElement.tagName) && !mediaElement.hasAttribute('controls')) mediaElement.setAttribute('controls', '');
- selectedArchive.getDirEntryByPath(source).then(function (dirEntry) {
- return selectedArchive.readBinaryFile(dirEntry, function (fileDirEntry, mediaArray) {
- var mimeType = mediaSource.type ? mediaSource.type : dirEntry.getMimetype();
- var blob = new Blob([mediaArray], { type: mimeType });
- mediaSource.src = URL.createObjectURL(blob);
- // In Firefox and Chromium it is necessary to re-register the inserted media source
- // but do not reload for text tracks (closed captions / subtitles)
- if (/track/i.test(mediaSource.tagName)) return;
- mediaElement.load();
- });
+ .forEach(function (mediaSource) {
+ var source = mediaSource.getAttribute('src');
+ source = source ? uiUtil.deriveZimUrlFromRelativeUrl(source, baseUrl) : null;
+ // We have to exempt text tracks from using deriveZimUrlFromRelativeurl due to a bug in Firefox [kiwix-js #496]
+ source = source || decodeURIComponent(mediaSource.dataset.kiwixurl);
+ if (!source || !regexpZIMUrlWithNamespace.test(source)) {
+ if (source) console.error('No usable media source was found for: ' + source);
+ return;
+ }
+ var mediaElement = /audio|video/i.test(mediaSource.tagName) ? mediaSource : mediaSource.parentElement;
+ // If the "controls" property is missing, we need to add it to ensure jQuery-only users can operate the video. See kiwix-js #760.
+ if (/audio|video/i.test(mediaElement.tagName) && !mediaElement.hasAttribute('controls')) mediaElement.setAttribute('controls', '');
+ selectedArchive.getDirEntryByPath(source).then(function (dirEntry) {
+ return selectedArchive.readBinaryFile(dirEntry, function (fileDirEntry, mediaArray) {
+ var mimeType = mediaSource.type ? mediaSource.type : dirEntry.getMimetype();
+ var blob = new Blob([mediaArray], { type: mimeType });
+ mediaSource.src = URL.createObjectURL(blob);
+ // In Firefox and Chromium it is necessary to re-register the inserted media source
+ // but do not reload for text tracks (closed captions / subtitles)
+ if (/track/i.test(mediaSource.tagName)) return;
+ mediaElement.load();
});
});
+ });
}
}