var buttons = document.getElementsByClassName("button");
var activeSheet = document.getElementById("style");
var clearStorageButton = document.getElementById("clear-storage");
if (localStorage.getItem("lastActiveSheet")) {
activeSheet.setAttribute("href", localStorage.getItem("lastActiveSheet"));
}
for (var i = 0; i < buttons.length; i++) {
buttons[i].addEventListener("click", switchStyle);
}
clearStorageButton.addEventListener("click", clearStorage);
function switchStyle() {
var selectedSheet = this.getAttribute("href");
activeSheet.setAttribute("href", selectedSheet);
localStorage.setItem("lastActiveSheet", selectedSheet);
}
function clearStorage() {
localStorage.clear();
}