added greasemonkey script
This commit is contained in:
parent
377e2c1c0e
commit
d47a59d188
31
yt-auto-reject.js
Normal file
31
yt-auto-reject.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @name YouTube Reject All
|
||||||
|
// @version 1
|
||||||
|
// @grant none
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
var retryLimit = 5 // seconds
|
||||||
|
|
||||||
|
var query
|
||||||
|
if (!window.location.href.includes("consent.youtube.com")) {
|
||||||
|
if (!window.location.href.includes("youtube.com")) return
|
||||||
|
query = '[aria-label="Reject the use of cookies and other data for the purposes described"]'
|
||||||
|
} else {
|
||||||
|
query = '[aria-label="Reject all"]'
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('load', consentMonitor);
|
||||||
|
async function consentMonitor() {
|
||||||
|
var retryTotal = retryLimit * 1000
|
||||||
|
const timeout = 100
|
||||||
|
|
||||||
|
for(var i = 0; i < retryTotal; i += timeout) {
|
||||||
|
await new Promise(r => setTimeout(r, 100));
|
||||||
|
|
||||||
|
var e = document.querySelector(query)
|
||||||
|
if (!e) continue
|
||||||
|
|
||||||
|
e.click()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user