aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2024-03-26 14:23:22 +0000
committerLouis Pilfold <louis@lpil.uk>2024-03-26 14:23:22 +0000
commit4584a2908610c4e57b912bb7b11c9a667f1e5a63 (patch)
treec9b6eb5068d300579f54ba8bf62e76efb2fcbc9e /src
parente0d7e32903fdd4a52098dd442ed380c0f6f742a9 (diff)
downloadtour-4584a2908610c4e57b912bb7b11c9a667f1e5a63.tar.gz
tour-4584a2908610c4e57b912bb7b11c9a667f1e5a63.zip
Remove off brand transitions
Diffstat (limited to 'src')
-rw-r--r--src/tour.gleam2
-rw-r--r--src/tour/widgets.gleam11
2 files changed, 1 insertions, 12 deletions
diff --git a/src/tour.gleam b/src/tour.gleam
index ef4ed02..2a64561 100644
--- a/src/tour.gleam
+++ b/src/tour.gleam
@@ -1000,7 +1000,7 @@ pub fn render_page_html(page config: PageConfig) -> Html {
],
),
lang: "en-GB",
- attributes: [#("class", "theme-light theme-init")],
+ attributes: [#("class", "theme-light")],
body: BodyConfig(
attributes: [body_class],
scripts: config.scripts.body,
diff --git a/src/tour/widgets.gleam b/src/tour/widgets.gleam
index 3a6f0a0..8ac9f08 100644
--- a/src/tour/widgets.gleam
+++ b/src/tour/widgets.gleam
@@ -138,15 +138,6 @@ function toggleTheme() {
setTheme(getAppliedTheme() === 'dark' ? 'light' : 'dark');
}
-function reEnableTransitions() {
- // re-enable transitions when triggered after first-render to avoid fouc
- // setTimeout(fn, 0) needed to give CSS at lease 1 frame without transitions and thus avoid FOUC
- setTimeout(() => {
- // executed after css has loaded & theme swiching has occured
- document.documentElement.classList.toggle('theme-init', false);
- }, 0);
-}
-
function initThemeEvents() {
// Watch the device's preferred theme and update theme if user did not select a theme
mediaPrefersDarkTheme.addEventListener('change', () => {
@@ -159,8 +150,6 @@ function initThemeEvents() {
document
.querySelector('.theme-picker')
?.addEventListener('click', toggleTheme);
- // Re-enable transitons only when all content has loaded
- window.addEventListener('DOMContentLoaded', reEnableTransitions);
}
function initTheme() {