aboutsummaryrefslogtreecommitdiff
path: root/static/index.js
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2026-05-14 21:32:43 -0500
committerTim Keller <tjk@tjkeller.xyz>2026-05-14 21:32:43 -0500
commit3bfeed5a50cd1bb405cbe145611410fa4f628413 (patch)
treea8b0bb6327f192bfcc8ebc3eada7a103e75aa30d /static/index.js
parent372756dcfaf98e2e1995c69d563695805b24e933 (diff)
downloadembedtube-master.tar.xz
embedtube-master.zip
fix clicking timestamp from commentsHEADmaster
Diffstat (limited to 'static/index.js')
-rw-r--r--static/index.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/static/index.js b/static/index.js
index ef3a097..c577050 100644
--- a/static/index.js
+++ b/static/index.js
@@ -178,8 +178,15 @@ function timestampLinkClick(e) {
if (!t)
return
player.seekTo(t)
- window.history.replaceState({}, "", url) /* reflect time in url bar */
- window.scrollTo(0, 0) /* return to page top */
+
+ // change url to match window in case clicking on youtube.com link
+ url.protocol = window.location.protocol
+ url.hostname = window.location.hostname
+ url.port = window.location.port
+
+ // reflect url and scroll to top of page
+ window.history.replaceState({}, "", url)
+ window.scrollTo(0, 0)
}
document.addEventListener("click", timestampLinkClick)