]> iEval git - gruntmaster-page.git/blobdiff - js/90-themes.js
Merge branch 'master' into newmc
[gruntmaster-page.git] / js / 90-themes.js
index 347cad2db80ffa61f88583759136cf7c4de28851..6a4c6809dbbb3a7be503031d4823ebf0bcb1033d 100644 (file)
@@ -8,25 +8,22 @@ function set_style(name, trans){
        localStorage.setItem("theme", name);
        $(function() {
                if(name == 'slate' || name == 'cyborg')
-                       $('.logo').each(e => e.classList.remove('logo-light'));
+                       $('img').each(e => e.setAttribute('src', e.getAttribute('src').replace('logos/light', 'logos/dark')));
                else
-                       $('.logo').each(e => e.classList.add('logo-light'));
+                       $('img').each(e => e.setAttribute('src', e.getAttribute('src').replace('logos/dark', 'logos/light')));
        });
 }
 
 $(function() {
-       var theme_ul = '<ul class="list-inline" id="themes">' +
+       const theme_ul = '<ul class="list-inline" id="themes">' +
                '<li><a role="button" data-theme="cyborg">Black</a>' +
                '<li><a role="button" data-theme="slate">Grey</a>' +
                '<li><a role="button" data-theme="readable">White</a></ul>';
-       var sidebar = $('#sidebar')[0];
+       const sidebar = $('#sidebar')[0];
        sidebar.insertBefore(m(theme_ul), sidebar.firstChild);
        $('#themes a').on('click', e => set_style(e.target.dataset.theme, true));
 });
 
-let theme = localStorage.getItem("theme");
-if(theme) {
-       if(theme == "cerulean" || theme == "cosmo")
-               theme = "readable";
-       set_style(theme, false);
-}
+const theme = localStorage.getItem("theme");
+if(theme)
+       set_style(theme == "cerulean" || theme == "cosmo" ? "readable" : theme, false);
This page took 0.017364 seconds and 4 git commands to generate.