Fix failure to display home or random pages in dynamic ZIMs #637 (#638)

This commit is contained in:
Jaifroid 2024-08-13 07:35:06 +01:00 committed by GitHub
parent 19ad658de8
commit 021b64d13e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4953,7 +4953,8 @@ function readArticle (dirEntry) {
appstate.expectedArticleURLToBeDisplayed = dirEntry.namespace + '/' + dirEntry.url; appstate.expectedArticleURLToBeDisplayed = dirEntry.namespace + '/' + dirEntry.url;
params.pagesLoaded++; params.pagesLoaded++;
// We must remove focus from UI elements in order to deselect whichever one was clicked (in both Restricted and SW modes), // We must remove focus from UI elements in order to deselect whichever one was clicked (in both Restricted and SW modes),
articleContainer = articleContainer || articleWindow; // articleContainer = articleContainer || articleWindow;
articleContainer = (articleWindow.self !== articleWindow.top) ? iframe : articleWindow;
if (!params.isLandingPage && articleContainer.contentWindow) articleContainer.contentWindow.focus(); if (!params.isLandingPage && articleContainer.contentWindow) articleContainer.contentWindow.focus();
uiUtil.pollSpinner() uiUtil.pollSpinner()
// Show the spinner with a loading message // Show the spinner with a loading message
@ -5248,7 +5249,7 @@ function filterClickEvent (event) {
// Get the window of the clicked anchor // Get the window of the clicked anchor
articleWindow = clickedAnchor.ownerDocument.defaultView; articleWindow = clickedAnchor.ownerDocument.defaultView;
// Determine if the window is in an iframe // Determine if the window is in an iframe
articleContainer = (articleWindow.self !== articleWindow.top) ? window.frames[0] : articleWindow; articleContainer = (articleWindow.self !== articleWindow.top) ? iframe : articleWindow;
// This prevents any popover from being displayed when the user clicks on a link // This prevents any popover from being displayed when the user clicks on a link
clickedAnchor.articleisloading = true; clickedAnchor.articleisloading = true;
// Check for Zimit links that would normally be handled by the Replay Worker // Check for Zimit links that would normally be handled by the Replay Worker