cabin

Source code for personal website
git clone git://git.dimitrijedobrota.com/cabin.git
Log | Files | Refs | README | LICENSE

main.js (633B)


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