Use const wherever possible in js/
[plack-app-gruntmaster.git] / js / 90-themes.js
index aa2cdc903ca6ffd9a576a90f18fe937850903676..a9d9b5185ebf5f1bd905dffc0767b46841b7bf4e 100644 (file)
@@ -9,18 +9,15 @@ function set_style(name, trans){
 }
 
 $(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.0103 seconds and 4 git commands to generate.