-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
42 lines (40 loc) · 1.38 KB
/
scripts.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//prompt that asks for custom speed for YT playback
// also removes YT consent dialog(might not be needed since YT doesn't use it anymore)
(function () {
var isYT = window.location.href.indexOf("youtube.com");
if (isYT !== -1) {
var e = document.getElementById("consent-bump");
if (e) {
e.parentComponent.removeChild(e);
}
var defaultSpeed = 3;
var playbackSpeed = prompt(
`Choose desired speed(blank for ${defaultSpeed}x):`,
);
if (!playbackSpeed || isNaN(playbackSpeed)) {
playbackSpeed = defaultSpeed;
}
document.getElementsByTagName("video")[0].playbackRate = playbackSpeed;
document.getElementsByTagName("video")[0].play();
}
})();
// use the NSFW version of YT (taken from the site)
(function () {
var originalBaseURL = window.location.href;
var isyt = originalBaseURL.indexOf("youtube.com");
if (isyt != -1 && originalBaseURL.indexOf("nsfwyoutube.com") == -1) {
var http_url = originalBaseURL.replace("youtube.com", "nsfwyoutube.com");
window.location = http_url;
} else {
alert("You have to be on youtube.com for this to work!");
}
})();
// remove query string from URL
(function () {
var currentUrl = window.location.href;
var questionMarkIndex = currentUrl.indexOf("?");
if (questionMarkIndex !== -1) {
var newUrl = currentUrl.substring(0, questionMarkIndex);
window.location.href = newUrl;
}
})();