mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 06:17:49 +00:00
Wait 500ms before changing giscus theme on load to make sure that it's ready
This commit is contained in:
@@ -1,15 +1,17 @@
|
|||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
let theme = localStorage.getItem("theme");
|
|
||||||
if (theme != null) {
|
|
||||||
set_theme(theme)
|
|
||||||
}
|
|
||||||
|
|
||||||
let container = document.querySelector('#toc-aside');
|
let container = document.querySelector('#toc-aside');
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
resize_toc(container);
|
resize_toc(container);
|
||||||
toc_scroll_position(container);
|
toc_scroll_position(container);
|
||||||
window.onscroll = function () { 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) {
|
function resize_toc(container) {
|
||||||
|
|||||||
Reference in New Issue
Block a user