diff options
Diffstat (limited to 'static/index.js')
| -rw-r--r-- | static/index.js | 11 |
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) |
