main.js (633B)
1 // This code is only used to remember theme selection 2 const themeSwitch = document.querySelector('.theme_switch'); 3 themeSwitch.checked = localStorage.getItem('switchedTheme') === 'true'; 4 5 themeSwitch.addEventListener('change', function (e) { 6 if(e.currentTarget.checked === true) { 7 // Add item to localstorage 8 localStorage.setItem('switchedTheme', 'true'); 9 } else { 10 // Remove item if theme is switched back to normal 11 localStorage.removeItem('switchedTheme'); 12 } 13 }); 14 15 document.querySelectorAll(".back").forEach((element, key) => { 16 element.addEventListener('click', function(event){ 17 history.go(-1); 18 }) 19 })