2021-03-17 04:19:19 +00:00
|
|
|
let window_storage = window.localStorage;
|
|
|
|
newIcons = true;
|
2022-07-26 17:44:16 +00:00
|
|
|
if (window_storage.getItem("newicons") === "false") {
|
|
|
|
toggleIcons();
|
|
|
|
}
|
2022-07-24 21:31:23 +00:00
|
|
|
|
2021-03-17 04:19:19 +00:00
|
|
|
/** Toggle icons on the ENTIRE page.
|
|
|
|
*
|
|
|
|
*/
|
2022-07-26 17:44:16 +00:00
|
|
|
function toggleIcons() {
|
2021-03-17 04:19:19 +00:00
|
|
|
newIcons = !newIcons;
|
2022-07-26 17:44:16 +00:00
|
|
|
window_storage.setItem("newicons", newIcons.toString());
|
|
|
|
let newOrOld = (newIcons ? "new" : "old");
|
|
|
|
|
2022-07-24 21:31:23 +00:00
|
|
|
let imgs = document.getElementsByTagName("img");
|
2022-07-26 17:44:16 +00:00
|
|
|
let divs = document.getElementsByClassName("item-display-new-toggleable");
|
2021-03-17 04:19:19 +00:00
|
|
|
let favicon = document.querySelector("link[rel~='icon']");
|
2022-07-26 17:44:16 +00:00
|
|
|
favicon.href = favicon.href.replace("media/icons/" + (newIcons ? "old" : "new"), "media/icons/" + newOrOld);
|
|
|
|
for (const img of imgs) {
|
|
|
|
// if doesn't contain, replace() does nothing
|
|
|
|
img.src = img.src.replace("media/icons/" + (newIcons ? "old" : "new"), "media/icons/" + newOrOld);
|
|
|
|
}
|
|
|
|
for (let i = 0; i < divs.length; i++) {
|
|
|
|
divs.item(i).style.backgroundImage = "url('../media/items/" + (newIcons ? "new" : "old") + ".png')";
|
2022-07-24 21:31:23 +00:00
|
|
|
}
|
2021-03-17 04:19:19 +00:00
|
|
|
}
|