fix pages without a skipAll

This commit is contained in:
rhiannon morris 2022-12-30 03:18:52 +01:00
parent bd0fe2983f
commit 88b81681cb

View file

@ -28,7 +28,9 @@ function setImage(id, src, width, height, href, cw, firstLoad) {
let caption = document.getElementById('cw'); let caption = document.getElementById('cw');
let newCaption; let newCaption;
if (!skipAll.checked && !opened.has(id) && cw) { let checked = skipAll ? skipAll.checked : false;
if (!checked && !opened.has(id) && cw) {
newCaption = document.getElementById('cw-template') newCaption = document.getElementById('cw-template')
.content.firstElementChild.cloneNode(true); .content.firstElementChild.cloneNode(true);
newCaption.querySelector('#cw-text').innerHTML = cw; newCaption.querySelector('#cw-text').innerHTML = cw;
@ -96,10 +98,12 @@ function setup() {
button.onchange = e => { if (button.checked) activateButton(button); }; button.onchange = e => { if (button.checked) activateButton(button); };
} }
if (skipAll) {
skipAll.onchange = e => { if (skipAll.checked) { skipAll.onchange = e => { if (skipAll.checked) {
let caption = document.getElementById('cw'); let caption = document.getElementById('cw');
if (caption) { openCW(null, caption, false); } if (caption) { openCW(null, caption, false); }
} }; } };
}
window.addEventListener('popstate', useFragment); window.addEventListener('popstate', useFragment);
useFragment(true); useFragment(true);