From e01a1e230c9489207e34a53662b374fec2df5ba7 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Fri, 17 May 2024 11:49:13 +0100 Subject: [PATCH] Embargo Wikivoyage landing page for popovers --- www/js/lib/uiUtil.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/www/js/lib/uiUtil.js b/www/js/lib/uiUtil.js index cfaa7c78..c18b10cb 100644 --- a/www/js/lib/uiUtil.js +++ b/www/js/lib/uiUtil.js @@ -1587,8 +1587,10 @@ function attachKiwixPopoverCss (doc, dark) { */ function attachKiwixPopoverDiv (ev, link, articleBaseUrl, dark) { // Do not show popover if the user has initiated an article load - if (link.articleloading || link.popoverisloading) { - // console.debug('Cancelled display of popover because user is loading the underlying article'); + if (link.articleloading || link.popoverisloading) return; + // Do not show popover if we are on Wikivoyage landing page + if (/^wikivoyage/i.test(appstate.selectedArchive.file.name) && (appstate.expectedArticleURLToBeDisplayed === appstate.selectedArchive.landingPageUrl || + appstate.expectedArticleURLToBeDisplayed === 'A/Wikivoyage:Offline_reader_Expedition/Home_page')) { return; } link.popoverisloading = true; @@ -1601,6 +1603,8 @@ function attachKiwixPopoverDiv (ev, link, articleBaseUrl, dark) { var articleWindow = currentDocument.defaultView; removeKiwixPopoverDivs(currentDocument); setTimeout(function () { + // Do not show popover if the user has initiated an article load + if (link.articleloading) return; // Check if the link is still being hovered over, and abort display of popover if not if (!linkHref || !link.matches(':hover') && currentDocument.activeElement !== link) return; var div = document.createElement('div');