diff options
| author | Doge <guiqiqi187@gmail.com> | 2021-05-08 01:58:02 +0800 | 
|---|---|---|
| committer | Doge <guiqiqi187@gmail.com> | 2021-05-08 01:58:02 +0800 | 
| commit | 45265444c24fc2439c9769d9151a6bf560f22575 (patch) | |
| tree | 42579c0a1d45e47a32b4b8369704d3ab17c4db35 /layout/_partial | |
| parent | d10d58fe931e2f42ad4e9f6b0cc98c03eeedc125 (diff) | |
| download | chromate-45265444c24fc2439c9769d9151a6bf560f22575.tar.gz chromate-45265444c24fc2439c9769d9151a6bf560f22575.tar.bz2 chromate-45265444c24fc2439c9769d9151a6bf560f22575.zip | |
Minor bug fixes
Diffstat (limited to 'layout/_partial')
| -rw-r--r-- | layout/_partial/head.ejs | 1 | ||||
| -rw-r--r-- | layout/_partial/scripts.ejs | 27 | 
2 files changed, 15 insertions, 13 deletions
| diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs index 1206434..3d4ee79 100644 --- a/layout/_partial/head.ejs +++ b/layout/_partial/head.ejs @@ -21,5 +21,6 @@      <!-- Scripts and styles -->      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma/css/bulma.min.css">      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css"> +    <link rel="stylesheet" type="text/css" href="https://unpkg.com/bulma-prefers-dark" />      <%- css("css/style.css") %>  </head>
\ No newline at end of file diff --git a/layout/_partial/scripts.ejs b/layout/_partial/scripts.ejs index a60011f..c07d83d 100644 --- a/layout/_partial/scripts.ejs +++ b/layout/_partial/scripts.ejs @@ -11,7 +11,6 @@  <% } %>  <!-- Darkmode support --> -<link rel="stylesheet" type="text/css" href="https://unpkg.com/bulma-prefers-dark" />  <%- js('js/darkmode.js') %>  <script>      var darklistener = new DarkmodeListener(); @@ -25,18 +24,20 @@      <link id="highlight-dark-theme" rel="stylesheet"          href="https://cdn.jsdelivr.net/npm/highlightjs@9.16.2/styles/<%= theme.highlight.darkmode %>.min.css">      <script> -        const theme_selector = (mode) => { -            if (mode === SystemDarkmodePrefrence.dark) { -                document.getElementById("highlight-light-theme").setAttribute("disabled", "disabled"); -                document.getElementById("highlight-dark-theme").removeAttribute("disabled"); -            } else { -                document.getElementById("highlight-dark-theme").setAttribute("disabled", "disabled"); -                document.getElementById("highlight-light-theme").removeAttribute("disabled"); -            } -        }; -        theme_selector(darklistener.mode()); -        darklistener.add(theme_selector); -        hljs.initHighlightingOnLoad(); +        window.addEventListener("load", () => { +            const theme_selector = (mode) => { +                if (mode === SystemDarkmodePrefrence.dark) { +                    document.getElementById("highlight-light-theme").setAttribute("disabled", "disabled"); +                    document.getElementById("highlight-dark-theme").removeAttribute("disabled"); +                } else { +                    document.getElementById("highlight-dark-theme").setAttribute("disabled", "disabled"); +                    document.getElementById("highlight-light-theme").removeAttribute("disabled"); +                } +            }; +            theme_selector(darklistener.mode()); +            darklistener.add(theme_selector); +            hljs.initHighlightingOnLoad(); +        }, false);      </script>  <% } %> | 
