From 981c5e3878a90d60d0f5a1e9f605b475ad692b90 Mon Sep 17 00:00:00 2001 From: zzz <zzz@i2pmail.org> Date: Fri, 11 Mar 2022 07:13:09 -0500 Subject: [PATCH] i2psnark: Don't js-reload CSS on first click --- apps/i2psnark/resources/js/configui.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/i2psnark/resources/js/configui.js b/apps/i2psnark/resources/js/configui.js index 6e0fb77699..336068313f 100644 --- a/apps/i2psnark/resources/js/configui.js +++ b/apps/i2psnark/resources/js/configui.js @@ -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; + } } } -- GitLab