Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save prochor666/5be1b74fba999efa624ad37d583bea01 to your computer and use it in GitHub Desktop.
Save prochor666/5be1b74fba999efa624ad37d583bea01 to your computer and use it in GitHub Desktop.
Youtube allow ads popup blocker
// ==UserScript==
// @name youtube popup killer
// @namespace http://tampermonkey.net/
// @version 0.3
// @description try to take over the world!
// @author Selbereth
// @match https://*.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
(function () {
window.debug = true;
if (debug) console.log("started");
setInterval(() => {
if (!!popupFind()) {
if (debug) console.log("remove popup");
const popup = popupFind()
console.log(popup)
popup.parentNode.removeChild(popup)
if (debug) console.log("resume video");
//pauseFind().click()
if (debug) console.log("done ");
}
}, 1000);
})();
function popupFind() {
return document.querySelector("body > ytd-app > ytd-popup-container");
}
function pauseFind(){
return document.querySelector("#movie_player > div.ytp-chrome-bottom > div.ytp-chrome-controls > div.ytp-left-controls > button");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment