From d6bf1b22710278ba0013551fc559e650062bbdeb Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Sun, 17 Oct 2021 18:35:45 +0200 Subject: [PATCH] Revert "Use onload handler to set giscus theme as soon as it's loaded" This reverts commit 7eb1426e1f14b22985e7b1983ed6afc2506fa698. --- blog/static/js/edition-2/main.js | 11 +++++------ blog/templates/snippets.html | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) 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>