{ const init = () =>{ document.cookie.split('; ').forEach(itCookie = cookie =>{ //I know that this is a shitty way of fixing things... But I'll try to fix it in the future. if(cookie.split("=")[0] == "theme" && cookie.split("=")[1] == "darkmode"){ document.querySelector(".toggleDarkmode").innerHTML = "Enter lightmode" document.querySelector(".toggleDarkmode").id = "lightmode"; } if(cookie.split("=")[0] == "theme" && cookie.split("=")[1] == "customTheme"){ document.querySelector(".background").innerHTML = '
'; } if(cookie.split("=")[0] == "performance" && cookie.split("=")[1] == "highPerformance" && document.querySelector(".changePerformance")){ document.querySelector(".changePerformance").innerHTML = "enable low performance"; document.querySelector(".changePerformance").id = "lowPerformance"; } }); document.querySelectorAll('.changeThemeButton').forEach(changeThemeButton= e => {e.addEventListener(`click`, handleClickChangeTheme)}); document.querySelectorAll('.changePerformance').forEach(changeThemeButton= e => {e.addEventListener(`click`, handleClickChangePerformance)}); } const handleClickChangePerformance = e => { document.cookie = "performance = "+e.currentTarget.id+";path=/"; location.reload(); } const handleClickChangeTheme = e =>{ document.cookie = "theme = "+e.currentTarget.id+";path=/"; location.reload(); } init(); }