From c60eaeb53510978427107bfa0f758e37094d0da9 Mon Sep 17 00:00:00 2001 From: Reorx Date: Sat, 28 May 2022 02:10:33 +0800 Subject: instantclick: support updating head tags only for meta and link (not stylesheet) tags --- layouts/partials/header.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'layouts/partials/header.html') diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 166eee1..0ed0b20 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -30,7 +30,7 @@ function setPrefTheme(theme) { const toggleThemeCallbacks = [] toggleThemeCallbacks.push((isDark) => { - // console.log('window toggle-theme') + // console.log('window toggle-theme 1') if (isDark) { setPrefTheme('light'); } else { @@ -42,6 +42,7 @@ toggleThemeCallbacks.push((isDark) => { // because window is never changed by InstantClick, // we add the listener to window to ensure the event is always received window.addEventListener('toggle-theme', function() { + // console.log('window toggle-theme') const isDark = isDarkTheme() toggleThemeCallbacks.forEach(callback => callback(isDark)) }); -- cgit v1.2.3