summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEwy~ <ewy0@protonmail.com>2026-01-04 02:02:48 +0100
committerEwy~ <ewy0@protonmail.com>2026-01-04 02:02:48 +0100
commitdadb5a1350724a517feb002336c74efb28bfd600 (patch)
tree21e76e73724103ad4d53487ce3be70adf2bf4ab7
parent8175ef1cd145d68b987efece442ae244bef892e4 (diff)
add check to see if the state actually needs to be updatedHEADmaster
-rw-r--r--youtube-auto-timestamper.user.js8
1 files changed, 8 insertions, 0 deletions
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)
}