Remove redundant code, make IE11 work with null contents, reduce spinner annoyance

Former-commit-id: 4b67a37f204bd35faca19bd8b6b834425358c39e [formerly 02f158f39ee0e1abdac3c84142cdeb550c912091] [formerly 4de0e6d48d67d8f430939d04080f494bd63cdbc3] [formerly 443bd0189dc55dceb3a534851eafcc7732e5a62b [formerly c37256ec1939550afd6ad174ee47f590f5cf7299 [formerly 42d5a44af0acdc209e4ef34c27c9ce7c0e48bcc1]]]
Former-commit-id: 36f2b8794eab322af6f60f3b83628e39c599d069 [formerly 1ab5d66958baf83c7a834b81435f8bade7d46d60 [formerly 311889d16839c7b7ff77db1674d40aa189fd6ed9]]
Former-commit-id: a8c534a00df4e2f05f6ed3485ca3b9cb901a4013 [formerly 292c3411f95fbdf1a9b8a3b348680fd96aa9f5cb]
Former-commit-id: 98899702ba970d9a72759256324f39001e9298e8
This commit is contained in:
Jaifroid 2022-01-31 08:56:01 +00:00
parent 2dfa41e955
commit 8db32e68e3

View File

@ -3696,7 +3696,9 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
'content': buffer
};
clearTimeout(spinnerTimer);
spinnerTimer = setTimeout(uiUtil.clearSpinner, 2000);
// Android is extremely slow, so this presents the spinner flashing on and off too much
if (/Android/i.test(params.appType)) spinnerTimer = setTimeout(uiUtil.clearSpinner, 1800);
else spinnerTimer = setTimeout(uiUtil.clearSpinner, 900);
if (content.buffer) {
// In Edge Legacy, we have to transfer the buffer inside an array, whereas in Chromium, this produces an error
// due to type not being transferrable... (and already detached, which may be to do with storing in IndexedDB in Electron)
@ -3756,9 +3758,6 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
// New windows do not respect the onload event because they've been pre-populated,
// so we have to simulate this event (note potential for race condition if timeout is too short)
// NB The UWP app cannot control the opened window, so it can only be controlled by the Service Worker
setTimeout(function () {
if (appstate.target === 'iframe') articleContainer.style.display = 'block';
}, 800);
setTimeout(function () {
uiUtil.clearSpinner();
}, 2000);
@ -4147,10 +4146,11 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
//DEV: Uncomment line below and break on next to capture cssContent for local filesystem cache
//var cssContent = util.uintToString(content);
var mimetype = /\.ico$/i.test(title) ? 'image' : 'text/css';
var cssBlob = new Blob([content], {
var cssBlob;
if (content) cssBlob = new Blob([content], {
type: mimetype
});
var newURL = [title, URL.createObjectURL(cssBlob)];
var newURL = cssBlob ? [title, URL.createObjectURL(cssBlob)] : [title, ''];
blobArray.push(newURL);
if (cssBlobCache)
cssBlobCache.set(newURL[0], newURL[1]);