mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-08-04 03:48:41 -04:00
parent
2312180952
commit
009a88b0b4
@ -1129,13 +1129,14 @@
|
||||
<span class="checkmark"></span>
|
||||
<b>Permanently hide active content warning</b> (for experienced users)
|
||||
</label>
|
||||
<b title="You can force the app to use libzim full-text searching if the ZIM has a full-text index. Useful for earlier versions of Android, for example.">Force use of libzim W/ASM for reading full-text index:</b>
|
||||
<b title="You can force the app to use libzim full-text searching if the ZIM has a full-text index. Useful for earlier versions of Android, for example.">Force / disable libzim W/ASM for reading full-text index:</b>
|
||||
<select title="You can force the app to use libzim full-text searching if the ZIM has a full-text index. Useful for earlier versions of Android, for example." name="debugLibzimASM" id="debugLibzimASMDrop" class="dropdown">
|
||||
<option value="">Default</option>
|
||||
<option value="wasm">WASM</option>
|
||||
<option value="asm">ASM</option>
|
||||
<option value="wasm.dev">WASM debug</option>
|
||||
<option value="asm.dev">ASM debug</option>
|
||||
<option id="libzimDisable" value="disable">Disable</option>
|
||||
</select>
|
||||
<p><i>Warning! Disables OS/ZIM checks and may make title search unresponsive!</i></p>
|
||||
<label class="checkbox" title="In some browsers on some platforms, drag-and-drop may malfunction and make it difficult to select text, and other operations. Disable it here if it is causing issues." >
|
||||
|
@ -1606,7 +1606,7 @@ document.getElementById('debugLibzimASMDrop').addEventListener('change', functio
|
||||
var message = '<p>App will reload to apply the new setting.</p>'
|
||||
if (event.target.value) {
|
||||
message += '<p><i>Please be aware that leaving this override setting on can have anomalous effects, ' +
|
||||
'e.g. the app will no longer check whether the OS supports full-text searching and searches may fail silently.</i></p>'
|
||||
'e.g. the app will no longer check whether the OS supports full-text searching and searches may fail silently.</i></p>';
|
||||
}
|
||||
uiUtil.systemAlert(message,
|
||||
'Developer option!', true).then(function (confirm) {
|
||||
|
@ -257,6 +257,7 @@ document.getElementById('hideToolbarsState').innerHTML = (params.hideToolbars ==
|
||||
document.getElementById('openExternalLinksInNewTabsCheck').checked = params.openExternalLinksInNewTabs;
|
||||
document.getElementById('disableDragAndDropCheck').checked = params.disableDragAndDrop;
|
||||
document.getElementById('debugLibzimASMDrop').value = params.debugLibzimASM || '';
|
||||
if (params.debugLibzimASM === 'disable') document.getElementById('debugLibzimASMDrop').style.color = 'red';
|
||||
if (params.windowOpener === null) { // Setting has never been activated, so determine a sensible default
|
||||
params.windowOpener = /UWP/.test(params.appType) && params.contentInjectionMode === 'jquery' ? false :
|
||||
/iOS/.test(params.appType) ? false :
|
||||
|
@ -101,10 +101,12 @@ function ZIMArchive (storage, path, callbackReady, callbackError) {
|
||||
]).then(function () {
|
||||
// There is currently an exception thrown in the libzim wasm if we attempt to load a split ZIM archive, so we work around
|
||||
var isSplitZim = /\.zima.$/i.test(that._file._files[0].name);
|
||||
if (that._file.fullTextIndex && (params.debugLibzimASM || !isSplitZim && typeof Atomics !== 'undefined'
|
||||
// Note that Android and NWJS currently throw due to problems with Web Worker context
|
||||
&& !/Android/.test(params.appType) && !(window.nw && that._file._files[0].readMode === 'electron'))) {
|
||||
var libzimReaderType = params.debugLibzimASM || ('WebAssembly' in self ? 'wasm' : 'asm');
|
||||
var libzimReaderType = params.debugLibzimASM || ('WebAssembly' in self ? 'wasm' : 'asm');
|
||||
if (that._file.fullTextIndex && params.debugLibzimASM !== 'disable' && (params.debugLibzimASM || !isSplitZim &&
|
||||
// The ASM implementation requires Atomics support, whereas the WASM implementation does not
|
||||
(typeof Atomics !== 'undefined' || libzimReaderType === 'wasm') &&
|
||||
// Note that Android and NWJS currently throw due to problems with Web Worker context
|
||||
!/Android/.test(params.appType) && !(window.nw && that._file._files[0].readMode === 'electron'))) {
|
||||
console.log('Instantiating libzim ' + libzimReaderType + ' Web Worker...');
|
||||
LZ = new Worker('js/lib/libzim-' + libzimReaderType + '.js');
|
||||
that.callLibzimWorker({ action: 'init', files: that._file._files }).then(function (msg) {
|
||||
@ -126,6 +128,10 @@ function ZIMArchive (storage, path, callbackReady, callbackError) {
|
||||
params.searchProvider += ': no_atomics'; // message += 'this browser does not support Atomic operations.';
|
||||
} else if (/Android/.test(params.appType)) {
|
||||
params.searchProvider += ': no_sharedArrayBuffer';
|
||||
} else if (params.debugLibzimASM === 'disable') {
|
||||
params.searchProvider += ': disabled';
|
||||
} else {
|
||||
params.searchProvider += ': unknown';
|
||||
}
|
||||
uiUtil.reportSearchProviderToAPIStatusPanel(params.searchProvider);
|
||||
// uiUtil.systemAlert(message);
|
||||
|
Loading…
x
Reference in New Issue
Block a user