i2psnark: Don't js-reload CSS on first click

This commit is contained in:
zzz
2022-03-11 07:13:09 -05:00
parent 393ee71ad9
commit 981c5e3878

View File

@@ -5,6 +5,7 @@
// a public domain is not usable.
var oldTheme = "ubergine";
var change = false;
function swapStyleSheet(theme) {
// https://stackoverflow.com/questions/14292997/changing-style-sheet-javascript
@@ -18,7 +19,12 @@ function initThemeSwitcher() {
}
oldtheme = theme.value;
theme.onclick = function() {
swapStyleSheet(theme.value);
if (change) {
swapStyleSheet(theme.value);
} else {
// skip the first click to avoid the flash
change = true;
}
}
}