remove some unused cruft

This commit is contained in:
rhiannon morris 2023-06-21 22:38:49 +02:00
parent 8dcc603ade
commit db83137243
1 changed files with 7 additions and 11 deletions

View File

@ -24,7 +24,7 @@ function addCWListeners(id, caption) {
} }
} }
function setImage(id, src, width, height, href, cw, firstLoad) { function setImage(id, src, href, cw) {
let caption = document.getElementById('cw'); let caption = document.getElementById('cw');
let newCaption; let newCaption;
@ -45,17 +45,13 @@ function setImage(id, src, width, height, href, cw, firstLoad) {
mainlink.tabIndex = -1; mainlink.tabIndex = -1;
} }
mainimg.src = src; mainimg.src = src;
mainfig.dataset.width = width; mainlink.href = href;
mainfig.dataset.height = height;
mainlink.href = href;
} }
function activateButton(button, doPush = true, firstLoad = false) { function activateButton(button, doPush = true) {
setImage(button.id, button.value, setImage(button.id, button.value,
button.dataset.width, button.dataset.height, button.dataset.link, button.dataset.warning);
button.dataset.link, button.dataset.warning,
firstLoad);
if (doPush) history.pushState(null, '', '#' + button.id); if (doPush) history.pushState(null, '', '#' + button.id);
} }
@ -74,7 +70,7 @@ function useFragment(firstLoad = false) {
if (button) { if (button) {
id = button.id; id = button.id;
button.checked = true; button.checked = true;
activateButton(button, false, firstLoad); activateButton(button, false);
} }
if (firstLoad) addCWListeners(id, document.getElementById('cw')); if (firstLoad) addCWListeners(id, document.getElementById('cw'));
@ -105,7 +101,7 @@ function setup() {
} }; } };
} }
window.addEventListener('popstate', useFragment); window.addEventListener('popstate', e => useFragment());
useFragment(true); useFragment(true);
} }