Fix unresponsive click on article

Former-commit-id: 8fb53644e892c569b6a5585a836a1b68a82ae9db [formerly 1fa30468411d5d2b5aa6c67d4eedbd1dbac1c813 [formerly f5b648bc5b970f989e7c2ba9c84c3e499532efae]]
Former-commit-id: 3c8b7bd55e9be025dabe8041aa98e916be20c6f7
Former-commit-id: f3c95bc7d185912e490928dca2f24bc79b711e57
This commit is contained in:
Jaifroid 2021-06-07 21:12:50 +01:00
parent b9ce9607af
commit 3b45a9a3dc

View File

@ -4083,8 +4083,11 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
addListenersToLink(anchor, href, baseUrl);
}
});
// Add event listeners to the main document so user can open current document in new tab or window
if (articleWindow.document.body) addListenersToLink(articleWindow.document.body, encodeURIComponent(dirEntry.url.replace(/[^/]+\//g, '')), baseUrl);
// Add event listeners to the main heading so user can open current document in new tab or window by clicking on it
if (articleWindow.document.body) {
var h1 = articleWindow.document.body.querySelector('h1');
if (h1) addListenersToLink(h1, encodeURIComponent(dirEntry.url.replace(/[^/]+\//g, '')), baseUrl);
}
}
/**
@ -4128,14 +4131,14 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
appstate.target = kiwixTarget;
articleWindow = thisWindow;
articleContainer = thisContainer;
if (a.tagName === 'BODY') {
// We have registered a click on the document
if (a.tagName === 'H1') {
// We have registered a click on the header
if (!a.newcontainer) return; // A new tab wasn't requested, so ignore
// If we're not clicking within the scope of an H1, H2, etc., ignore the click
if (!uiUtil.getClosestMatchForTagname(e.target, /H\d/)) {
setTimeout(reset, 1400);
return;
}
// if (!uiUtil.getClosestMatchForTagname(e.target, /H\d/)) {
// setTimeout(reset, 1400);
// return;
// }
}
if (params.windowOpener) {
// This processes Ctrl-click, Command-click, the long-press event, and middle-click