diff --git a/blog/static/js/edition-2/main.js b/blog/static/js/edition-2/main.js index e1fb157f..1ebee250 100644 --- a/blog/static/js/edition-2/main.js +++ b/blog/static/js/edition-2/main.js @@ -1,4 +1,9 @@ window.onload = function () { + let theme = localStorage.getItem("theme"); + if (theme != null) { + set_theme(theme) + } + let container = document.querySelector('#toc-aside'); if (container != null) { resize_toc(container); @@ -91,9 +96,3 @@ function set_giscus_theme(theme) { } } -function giscus_loaded() { - let theme = localStorage.getItem("theme"); - if (theme != null) { - set_giscus_theme(theme) - } -} diff --git a/blog/templates/snippets.html b/blog/templates/snippets.html index fc596c8c..96dbcf57 100644 --- a/blog/templates/snippets.html +++ b/blog/templates/snippets.html @@ -38,8 +38,7 @@ data-emit-metadata="1" data-theme="preferred_color_scheme" crossorigin="anonymous" - async - onload="giscus_loaded()"> + async>