Fix failure to unhide document when using ZIM-sourced styles in SW mode

Former-commit-id: ec33bfb38c9ddb507b32c08ddd5055bf3db374fc [formerly ef32370b89909a473098dfa2ff518f07ac5f6453 [formerly 44c19934e0b87aa84d2722eb8595d4337d8d5e5e]]
Former-commit-id: a227394d8459953e072fe71bd56c1ffb6755b24d
Former-commit-id: 1f1a16e4085360513fd0c6376493bb6530f7c860
This commit is contained in:
Jaifroid 2021-05-15 18:43:16 +01:00
parent c1c3d5c42b
commit a2db7c15ce

View File

@ -1104,6 +1104,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
woHelp.innerHTML = params.windowOpener === 'tab' ?
'Use right-click / long-press / ctrl-click / middle-click. <i>May not work in mobile contexts.</i>' :
'Use right-click / long-press. You may need to turn off popup blocking. <i>May not work in mobile contexts.</i>';
document.getElementById('tapHint').innerHTML = params.windowOpener === 'tab' ? '-> tap again for window mode' : '';
}
} else {
woState.innerHTML = 'tab / window';
@ -3069,13 +3070,13 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
articleDocument.bgcolor = '';
docBody.hidden = false;
}, 200);
// If we reloaded the page to print the desktop style, we need to return to the printIntercept dialogue
if (params.printIntercept) printIntercept();
}
settingsStore.removeItem('lastPageLoad');
$("#searchingArticles").hide();
// If we reloaded the page to print the desktop style, we need to return to the printIntercept dialogue
if (params.printIntercept) printIntercept();
} else {
loaded = false;
}
// Show spinner when the article unloads
articleContainer.onunload = function () {
@ -3755,7 +3756,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
}
// Hide the document to avoid display flash before stylesheets are loaded; also improves performance during loading of
// assets in most browsers (the document will be unhidden again by renderIfCSSFulfilled).
// assets in most browsers
// DEV: We cannot do `articleWindow.document.documentElement.hidden = true;` because documentElement gets overwritten
// during the document.write() process; and since the latter is synchronous, we get slow display rewrites before it is
// effective if we do it after document.close().
@ -4044,7 +4045,6 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
if (!params.windowOpener || a.touched) return;
e.stopPropagation();
a.touched = true;
console.log('Touch activation detected:', e.target);
// The link will be clicked if the user long-presses for more than 600ms (if the option is enabled)
setTimeout(function () {
if (!a.touched || a.launched) return;