From 00094c25c551d7990658228c61726d7d50b3c4fd Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sat, 24 Dec 2022 15:26:51 +0100 Subject: Activate theme switcher as soon as the body tag exists. --- assets/js/theme-switcher.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'assets') diff --git a/assets/js/theme-switcher.js b/assets/js/theme-switcher.js index 0cca832..f2e58f6 100644 --- a/assets/js/theme-switcher.js +++ b/assets/js/theme-switcher.js @@ -91,11 +91,9 @@ const themeSwitcher = { }, }; -window.addEventListener('load', function () { - themeSwitcher.addButton({ - tag: 'BUTTON', - class: 'contrast switcher theme-switcher', - target: 'body', - }); - themeSwitcher.init(); +themeSwitcher.addButton({ + tag: 'BUTTON', + class: 'contrast switcher theme-switcher', + target: 'body', }); +themeSwitcher.init(); -- cgit v1.2.3