Add option to force use of libzim W/ASM decoder

#343
This commit is contained in:
Jaifroid 2023-01-06 16:10:19 +00:00
parent 064fbba998
commit 16ef2ee94d
3 changed files with 18 additions and 1 deletions

View File

@ -1086,6 +1086,13 @@
<span class="checkmark"></span>
<b>Permanently hide active content warning</b> (for experienced users)
</label>
<b>Force use of libzim W/ASM for reading full-text index:</b>
<select name="debugLibzimASM" id="debugLibzimASMDrop">
<option value="">Default</option>
<option value="wasm">WASM</option>
<option value="asm">ASM</option>
</select>
<p><i>Warning! Disables OS checks and may stop app from working!</i></p>
<label id="bypassAppCacheDiv" class="checkbox" title="WARNING: Leaving this checked will prevent offline usage of the PWA. Setting will clear all existing Cache API caches, but assetsCache will be used unless also disabled above. For testing new code with the PWA.">
<input type="checkbox" name="bypassAppCache" id="bypassAppCacheCheck">
<span class="checkmark"></span>

View File

@ -1329,6 +1329,10 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'cache', 'images
params.hideActiveContentWarning = this.checked ? true : false;
settingsStore.setItem('hideActiveContentWarning', params.hideActiveContentWarning, Infinity);
});
document.getElementById('debugLibzimASMDrop').addEventListener('change', function (event) {
params.debugLibzimASM = event.target.value || false;
settingsStore.setItem('debugLibzimASM', params.debugLibzimASM, Infinity);
})
$('input:checkbox[name=openExternalLinksInNewTabs]').on('change', function () {
params.openExternalLinksInNewTabs = this.checked ? true : false;
settingsStore.setItem('openExternalLinksInNewTabs', params.openExternalLinksInNewTabs, Infinity);
@ -3382,6 +3386,11 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'cache', 'images
});
}
}
if (!selectedFileSet.length) {
reject('The requested archive is not in the archive folder ' + folder + '!');
}
} else {
reject('The requested archive does not appear to be a ZIM file!');
}
} else {
// Folder was empty...

View File

@ -129,7 +129,7 @@ params.pagesLoaded = 0; // Page counter used to show PWA Install Prompt only aft
params.localUWPSettings = /UWP/.test(params.appType) ? Windows.Storage.ApplicationData.current.localSettings.values : null;
appstate['target'] = 'iframe'; // The target for article loads (this should always be 'iframe' initially, and will only be changed as a result of user action)
params['mapsURI'] = getSetting('mapsURI') || (/UWP|Windows/.test(params.appType) ? 'bingmaps:' : 'https://www.openstreetmap.org/'); // Protocol with colon ('bingmaps:') or URL with final slash ('https://www.openstreetmap.org/')
params['debugLibzimASM'] = null; // 'wasm|asm' Forces use of wasm or asm for libzim decoder. You can also set this as an override URL querystring e.g. ?debugLibzimASM=wasm;
params['debugLibzimASM'] = getSetting('degugLibzimASM'); // 'wasm|asm' Forces use of wasm or asm for libzim decoder. You can also set this as an override URL querystring e.g. ?debugLibzimASM=wasm;
// Apply any override parameters in querystring (done as a self-calling function to avoid creating global variables)
(function overrideParams() {
@ -246,6 +246,7 @@ document.getElementById('hideToolbarsCheck').indeterminate = params.hideToolbars
document.getElementById('hideToolbarsCheck').readOnly = params.hideToolbars === "top";
document.getElementById('hideToolbarsState').innerHTML = (params.hideToolbars === "top" ? "top" : params.hideToolbars ? "both" : "never");
document.getElementById('openExternalLinksInNewTabsCheck').checked = params.openExternalLinksInNewTabs;
document.getElementById('debugLibzimASMDrop').value = params.debugLibzimASM || '';
if (params.windowOpener === null) { // Setting has never been activated, so determine a sensible default
params.windowOpener = /UWP/.test(params.appType) && params.contentInjectionMode === 'jquery' ? false :
'MSBlobBuilder' in window ? 'window' : // IE11/Edge/UWP work best in window mode, not in tab mode!