diff options
author | Giovanni Condello <giovanni.condello@coderit.it> | 2022-08-04 19:41:23 +0200 |
---|---|---|
committer | Simone Bortolin <simonebortolin@users.noreply.github.com> | 2022-12-19 22:48:31 +0100 |
commit | 669e2c60c51c9df52e8fa1ae8fffc86eb8794bd0 (patch) | |
tree | d458409409493a304d9358b25b42973d7dabdaf9 /assets/js | |
parent | AFM TIM hacking (diff) | |
download | hack-gpon.github.io-669e2c60c51c9df52e8fa1ae8fffc86eb8794bd0.tar hack-gpon.github.io-669e2c60c51c9df52e8fa1ae8fffc86eb8794bd0.tar.gz hack-gpon.github.io-669e2c60c51c9df52e8fa1ae8fffc86eb8794bd0.tar.bz2 hack-gpon.github.io-669e2c60c51c9df52e8fa1ae8fffc86eb8794bd0.tar.lz hack-gpon.github.io-669e2c60c51c9df52e8fa1ae8fffc86eb8794bd0.tar.xz hack-gpon.github.io-669e2c60c51c9df52e8fa1ae8fffc86eb8794bd0.tar.zst hack-gpon.github.io-669e2c60c51c9df52e8fa1ae8fffc86eb8794bd0.zip |
Diffstat (limited to 'assets/js')
-rw-r--r-- | assets/js/theme-switch.js | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/assets/js/theme-switch.js b/assets/js/theme-switch.js index 148ef26..02b0ce9 100644 --- a/assets/js/theme-switch.js +++ b/assets/js/theme-switch.js @@ -1,21 +1,21 @@ - -if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { - jtd.setTheme('dark'); -} else { - jtd.setTheme('light'); -} - -window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => { - const newColorScheme = event.matches ? "dark" : "light"; - jtd.setTheme(newColorScheme); -}); - - -const toggleDarkMode = document.querySelector('.js-toggle-dark-mode'); -jtd.addEvent(toggleDarkMode, 'click', function(){ - if (jtd.getTheme() === 'dark') { - jtd.setTheme('light'); - toggleDarkMode.textContent = 'Preview dark color scheme'; - } else { jtd.setTheme('dark'); - toggleDarkMode.textContent = 'Return to the light side'; } +
+if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
+ jtd.setTheme('dark');
+} else {
+ jtd.setTheme('light');
+}
+
+window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
+ const newColorScheme = event.matches ? "dark" : "light";
+ jtd.setTheme(newColorScheme);
+});
+
+
+const toggleDarkMode = document.querySelector('.js-toggle-dark-mode');
+jtd.addEvent(toggleDarkMode, 'click', function(){
+ if (jtd.getTheme() === 'dark') {
+ jtd.setTheme('light');
+ toggleDarkMode.textContent = 'Preview dark color scheme';
+ } else { jtd.setTheme('dark');
+ toggleDarkMode.textContent = 'Return to the light side'; }
});
\ No newline at end of file |