fix pages without a skipAll

This commit is contained in:
rhiannon morris 2022-12-30 03:18:52 +01:00
parent bd0fe2983f
commit 88b81681cb
1 changed files with 9 additions and 5 deletions

View File

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