-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.user.js
26 lines (22 loc) · 870 Bytes
/
script.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// ==UserScript==
// @name YouTube O'Clock
// @description Always has the video timestamp in the URL
// @version 2024-04-02
// @author Robert Wesner (https://robert.wesner.io)
// @license MIT
// @namespace http://robert.wesner.io/
// @match https://*.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
setInterval(() => {
if (window.location.pathname !== '/watch') {
return;
}
let params = new URLSearchParams(location.search);
params.set('t', Math.floor(document.querySelector('#movie_player').getCurrentTime()).toString());
window.history.replaceState({}, '', `${window.location.pathname}?${params.toString()}`);
}, 1000);
})();