Wait 500ms before changing giscus theme on load to make sure that it's ready

This commit is contained in:
Philipp Oppermann
2021-10-17 18:41:24 +02:00
parent d6bf1b2271
commit 5c750985a6

View File

@@ -1,15 +1,17 @@
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);
toc_scroll_position(container);
window.onscroll = function () { toc_scroll_position(container) };
}
let theme = localStorage.getItem("theme");
if (theme != null) {
setTimeout(() => {
set_giscus_theme(theme)
}, 500);
}
}
function resize_toc(container) {