diff --git a/script/single.js b/script/single.js index 31e464b..84c6309 100644 --- a/script/single.js +++ b/script/single.js @@ -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 newCaption; @@ -45,17 +45,13 @@ function setImage(id, src, width, height, href, cw, firstLoad) { mainlink.tabIndex = -1; } - mainimg.src = src; - mainfig.dataset.width = width; - mainfig.dataset.height = height; - mainlink.href = href; + mainimg.src = src; + mainlink.href = href; } -function activateButton(button, doPush = true, firstLoad = false) { +function activateButton(button, doPush = true) { setImage(button.id, button.value, - button.dataset.width, button.dataset.height, - button.dataset.link, button.dataset.warning, - firstLoad); + button.dataset.link, button.dataset.warning); if (doPush) history.pushState(null, '', '#' + button.id); } @@ -74,7 +70,7 @@ function useFragment(firstLoad = false) { if (button) { id = button.id; button.checked = true; - activateButton(button, false, firstLoad); + activateButton(button, false); } if (firstLoad) addCWListeners(id, document.getElementById('cw')); @@ -105,7 +101,7 @@ function setup() { } }; } - window.addEventListener('popstate', useFragment); + window.addEventListener('popstate', e => useFragment()); useFragment(true); }