From dadb5a1350724a517feb002336c74efb28bfd600 Mon Sep 17 00:00:00 2001 From: Ewy~ Date: Sun, 4 Jan 2026 02:02:48 +0100 Subject: add check to see if the state actually needs to be updated --- youtube-auto-timestamper.user.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/youtube-auto-timestamper.user.js b/youtube-auto-timestamper.user.js index ec384cb..b2efcef 100644 --- a/youtube-auto-timestamper.user.js +++ b/youtube-auto-timestamper.user.js @@ -17,6 +17,8 @@ const timeDelay = 0; const timeRegex = /(([&?])t=[0-9]+)/ +let lastTime = undefined; + const tick = () => { const ytplayer = document.getElementById("movie_player"); if (!ytplayer) { @@ -40,6 +42,12 @@ const tick = () => { } else { currentUrl = currentUrl + "&t=" + time } + + if (time == lastTime) { + return + } + + lastTime = time history.replaceState(currentUrl, "", currentUrl) } -- cgit v1.3