From 64ab0a69787187dd3528e47eb33aff28b944a67a Mon Sep 17 00:00:00 2001 From: Ashley Date: Sat, 10 Jun 2023 14:44:04 +0000 Subject: [PATCH] fix a thingy --- css/app.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/css/app.js b/css/app.js index f1005283..4a901d38 100644 --- a/css/app.js +++ b/css/app.js @@ -92,6 +92,23 @@ links.forEach(link => { }); }); +function jumpToTime(e) { + e.preventDefault(); + + const link = e.target; + const video = document.getElementById('video'); + const time = link.dataset.jumpTime; + + video.currentTime = time; + + window.location.hash = 'top'; // Add #video to the URL + + setTimeout(() => { + history.replaceState(null, null, ' '); // Remove #video after 1 second + }, 250); +} + + // Handle click events for time-based links const timeLinks = document.querySelectorAll('a[data-onclick="jump_to_time"]'); timeLinks.forEach(link => {