diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-05-30 22:27:54 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-30 22:27:54 -0300 |
commit | a038ef2b08bac548ea7b5a31e74467ac93b4516b (patch) | |
tree | 66d33b0972ccaafe190092fbf99380439ff93105 | |
parent | 42dbfbcbc383c34b2fe4b4c1c193f391438435c8 (diff) |
client: fix scoped chronology links activating w/o switcher
-rw-r--r-- | src/static/js/client.js | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/static/js/client.js b/src/static/js/client.js index 49326663..5ff3ab9a 100644 --- a/src/static/js/client.js +++ b/src/static/js/client.js @@ -3001,6 +3001,7 @@ clientSteps.addPageListeners.push(addAdditionalNamesBoxListeners); // Scoped chronology links -------------------------------- const scopedChronologyLinksInfo = initInfo('scopedChronologyLinksInfo', { + switcher: null, containers: null, switcherLinks: null, modes: null, @@ -3013,18 +3014,18 @@ const scopedChronologyLinksInfo = initInfo('scopedChronologyLinksInfo', { function getScopedChronologyLinksReferences() { const info = scopedChronologyLinksInfo; - const switcher = + info.switcher = document.querySelector('.scoped-chronology-switcher'); - if (!switcher) { + if (!info.switcher) { return; } info.containers = - Array.from(switcher.querySelectorAll(':scope > div')); + Array.from(info.switcher.querySelectorAll(':scope > div')); info.switcherLinks = - Array.from(switcher.querySelectorAll('.switcher-link')); + Array.from(info.switcher.querySelectorAll('.switcher-link')); info.modes = info.containers @@ -3038,6 +3039,10 @@ function addScopedChronologyLinksPageHandlers() { const info = scopedChronologyLinksInfo; const {session} = scopedChronologyLinksInfo; + if (!info.switcher) { + return; + } + for (const [index, { container: currentContainer, switcherLink: currentSwitcherLink, @@ -3070,6 +3075,10 @@ function addScopedChronologyLinksPageHandlers() { function mutateScopedChronologyLinksContent() { const info = scopedChronologyLinksInfo; + if (!info.switcher) { + return; + } + const {selectedMode} = info.session; if (info.modes.includes(selectedMode)) { |