From 1a7666b9db7cedde838beb20939ca98ab484a053 Mon Sep 17 00:00:00 2001 From: Martin Trapp <94928215+martrapp@users.noreply.github.com> Date: Thu, 14 Nov 2024 17:07:12 +0100 Subject: [PATCH] hide and seek --- src/pages/tips/hide-and-seek/problem.astro | 13 +++++++------ src/pages/tips/hide-and-seek/solution.astro | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/pages/tips/hide-and-seek/problem.astro b/src/pages/tips/hide-and-seek/problem.astro index 4b3807c..2294689 100644 --- a/src/pages/tips/hide-and-seek/problem.astro +++ b/src/pages/tips/hide-and-seek/problem.astro @@ -44,12 +44,13 @@ import "./_problem_styles.css"; ]; addEventListener("pagereveal", (event) => { - const from = new URL(navigation.activation.from.url, location.href); - if ( - event.viewTransition && - from.pathname !== "/tips/hide-and-seek/problem/" - ) { - event.viewTransition.skipTransition?.(); + if (event.viewTransition) { + if ( + new URL(navigation.activation.from.url, location.href).pathname !== + "/tips/hide-and-seek/problem/" + ) { + event.viewTransition.skipTransition?.(); + } } const scrollInfo = JSON.parse( sessionStorage.getItem("vtbag-hide-seek") || diff --git a/src/pages/tips/hide-and-seek/solution.astro b/src/pages/tips/hide-and-seek/solution.astro index 7221636..11dea75 100644 --- a/src/pages/tips/hide-and-seek/solution.astro +++ b/src/pages/tips/hide-and-seek/solution.astro @@ -43,12 +43,13 @@ import "./_solution_styles.css"; ]; addEventListener("pagereveal", (event) => { - const from = new URL(navigation.activation.from.url, location.href); - if ( - event.viewTransition && - from.pathname !== "/tips/hide-and-seek/solution/" - ) { - event.viewTransition.skipTransition?.(); + if (event.viewTransition) { + if ( + new URL(navigation.activation.from.url, location.href).pathname !== + "/tips/hide-and-seek/solution/" + ) { + event.viewTransition.skipTransition?.(); + } } const scrollInfo = JSON.parse( sessionStorage.getItem("vtbag-hide-seek") ||