-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactualCode.js
More file actions
51 lines (43 loc) · 1.63 KB
/
Copy pathactualCode.js
File metadata and controls
51 lines (43 loc) · 1.63 KB
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
43
44
45
46
47
48
49
50
51
var button = document.querySelector(".ytp-ad-skip-button-modern");
if (!button) {
button = document.querySelector(".ytp-skip-ad-button");
}
if (!button) {
button = document.querySelector(".ytp-button");
}
var unskippableOne = document.querySelector(".ytp-ad-preview-container .ytp-ad-preview-container-detached .ytp-preview-ad .ytp-preview-ad__text ytp-preview-ad__text--font--small .ytp-preview-ad__text--padding--wide");
if (!unskippableOne) {
unskippableOne = document.querySelector(".ytp-preview-ad__text--font--small");
}
var flyoutCTA = document.querySelector(".ytp-ad-text .ytp-ad-preview-text-modern");
if (!flyoutCTA) {
flyoutCTA = document.querySelector(".ytp-ad-preview-text-modern");
}
var VideoElem = document.querySelector(".video-stream")
if (!VideoElem) {
VideoElem = document.querySelector(".html5-main-video");
}
if (button.innerText.length > 0 || unskippableOne.innerText.length > 0) {
VideoElem.playbackRate = 15.0;
if (button.innerText = "Skip") {
button.click();
} else if (flyoutCTA.innerText = 'Video plays soon') {
VideoElem.playbackRate = 15.0;
}
setTimeout(function () {
chrome.browserAction.onClicked.addListener(function (tab) {
chrome.tabs.executeScript(
tab.id,
{ file: 'actualCode.js' }
);
});
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
if (changeInfo.status === 'complete') {
chrome.tabs.executeScript(
tabId,
{ file: 'actualCode.js' }
);
}
});
}, 1000);
}