Files
i2p.i2p/apps/i2psnark/resources/js/configui.js

36 lines
1.0 KiB
JavaScript
Raw Normal View History

2022-03-04 05:47:18 -05:00
/* @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0-1.0 */
// This component is dedicated to the public domain. It uses the CC0
// as a formal dedication to the public domain and in circumstances where
// a public domain is not usable.
var oldTheme = "ubergine";
var change = false;
2022-03-04 05:47:18 -05:00
function swapStyleSheet(theme) {
// https://stackoverflow.com/questions/14292997/changing-style-sheet-javascript
document.getElementById("pagestyle").setAttribute("href", "/i2psnark/.resources/themes/" + theme + "/snark.css");
}
function initThemeSwitcher() {
var theme = document.getElementById("theme");
if (theme == null) {
return;
}
oldtheme = theme.value;
theme.onclick = function() {
if (change) {
swapStyleSheet(theme.value);
} else {
// skip the first click to avoid the flash
change = true;
}
2022-03-04 05:47:18 -05:00
}
}
document.addEventListener("DOMContentLoaded", function() {
initThemeSwitcher();
}, true);
/* @license-end */