summary refs log tree commit diff stats
path: root/nimdoc/test_out_index_dot_html/expected
diff options
context:
space:
mode:
authorManuel Bojato <30560560+KingDarBoja@users.noreply.github.com>2020-07-10 08:06:07 -0500
committerGitHub <noreply@github.com>2020-07-10 15:06:07 +0200
commit04232d92cd401bf301a9e4cac582273356c86cfa (patch)
treea8e20ee46117156219435a0f34625f3fc35714e3 /nimdoc/test_out_index_dot_html/expected
parent4603197fe8f2c6fb1fd74fa7ad5b4ef510e8bfb7 (diff)
downloadNim-04232d92cd401bf301a9e4cac582273356c86cfa.tar.gz
Fix theme switch load from local storage (#14897)
* fix theme switch load from local storage

* Fix tests

Co-authored-by: Clyybber <darkmine956@gmail.com>
Diffstat (limited to 'nimdoc/test_out_index_dot_html/expected')
-rw-r--r--nimdoc/test_out_index_dot_html/expected/index.html19
-rw-r--r--nimdoc/test_out_index_dot_html/expected/theindex.html19
2 files changed, 10 insertions, 28 deletions
diff --git a/nimdoc/test_out_index_dot_html/expected/index.html b/nimdoc/test_out_index_dot_html/expected/index.html
index a8b65b2c9..f35334503 100644
--- a/nimdoc/test_out_index_dot_html/expected/index.html
+++ b/nimdoc/test_out_index_dot_html/expected/index.html
@@ -47,21 +47,12 @@ function main() {
 
   toggleSwitch.addEventListener('change', switchTheme, false);
 
+  const currentTheme = localStorage.getItem('theme') ? localStorage.getItem('theme') : null;
+  if (currentTheme) {
+    document.documentElement.setAttribute('data-theme', currentTheme);
 
-  if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
-    document.documentElement.setAttribute('data-theme', "dark");
-    toggleSwitch.checked = true;
-  } else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) {
-    document.documentElement.setAttribute('data-theme', "light");
-    toggleSwitch.checked = false;
-  } else {
-    const currentTheme = localStorage.getItem('theme') ? localStorage.getItem('theme') : null;
-    if (currentTheme) {
-      document.documentElement.setAttribute('data-theme', currentTheme);
-
-      if (currentTheme === 'dark') {
-        toggleSwitch.checked = true;
-      }
+    if (currentTheme === 'dark') {
+      toggleSwitch.checked = true;
     }
   }
 }
diff --git a/nimdoc/test_out_index_dot_html/expected/theindex.html b/nimdoc/test_out_index_dot_html/expected/theindex.html
index 095dd7471..b2863f99a 100644
--- a/nimdoc/test_out_index_dot_html/expected/theindex.html
+++ b/nimdoc/test_out_index_dot_html/expected/theindex.html
@@ -47,21 +47,12 @@ function main() {
 
   toggleSwitch.addEventListener('change', switchTheme, false);
 
+  const currentTheme = localStorage.getItem('theme') ? localStorage.getItem('theme') : null;
+  if (currentTheme) {
+    document.documentElement.setAttribute('data-theme', currentTheme);
 
-  if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
-    document.documentElement.setAttribute('data-theme', "dark");
-    toggleSwitch.checked = true;
-  } else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) {
-    document.documentElement.setAttribute('data-theme', "light");
-    toggleSwitch.checked = false;
-  } else {
-    const currentTheme = localStorage.getItem('theme') ? localStorage.getItem('theme') : null;
-    if (currentTheme) {
-      document.documentElement.setAttribute('data-theme', currentTheme);
-
-      if (currentTheme === 'dark') {
-        toggleSwitch.checked = true;
-      }
+    if (currentTheme === 'dark') {
+      toggleSwitch.checked = true;
     }
   }
 }