-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathYouTube.js
20 lines (20 loc) · 879 Bytes
/
YouTube.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// https://www.youtube.com/
function adblock($x) {
// delete the scripts to avoid problems later when manipulating the DOM
$x("//script").forEach(e => e.remove());
// move the video to the document body root
$x("//video").forEach(e => document.body.appendChild(e));
// delete all the other elements
$x("//*[local-name()!='video' and local-name()!='body' and local-name()!='html']").forEach(e => e.remove());
// delete all the other attributes
$x("//@*[local-name()!='src']").forEach(a => a.ownerElement.removeAttribute(a.name));
// set the video properties
$x("//video").forEach(e => {
e.controls = true;
e.loop = true;
e.play();
});
document.body.style.backgroundColor = 'black';
}
adblock($x);
window.setTimeout(adblock, 10000, $x); // we must pass the Chrome developer tool's internal variable $x to the timeout because it doesn't exist in that future scope