Skip to content

Instantly share code, notes, and snippets.

@jasonleonhard
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonleonhard/177b67f135c443719fe8 to your computer and use it in GitHub Desktop.
Save jasonleonhard/177b67f135c443719fe8 to your computer and use it in GitHub Desktop.
remove_yt_a
// ==UserScript==
// @name remove_yt_a
// @description remove_yt_a
// @match *://*.youtube.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @grant GM_addStyle
// @version 0.4
// @author un5t0ppab13
// ==/UserScript==
window.setInterval(function(){
// call your function here // function killAds() {
// remove all iframes and scripts and bs ads
var iframes = document.getElementsByTagName('iframe');
for (var i = 0; i < iframes.length; i++) {
iframes[i].parentNode.removeChild(iframes[i]);
}
// remove all scripts
var scriptS = document.getElementsByTagName('script');
for (var i = 0; i < scriptS.length; i++) {
scriptS[i].parentNode.removeChild(scriptS[i]);
}
// LOAD JQUERY THEN remove promo bs
$(".ad-container").remove();
$(".click-layer").remove();
$(".videoAdUi").remove();
$(".ytp-ad-progress").remove();
$("#masthead-positioner").remove();
$("#masthead-positioner-height-offset").remove();
$("#yt-masthead-container").remove();
//$(".annotation").remove();
//$(".ytp-block-autohide").remove();
// document.getElementsByClassName("ad-container")[0].remove();
}, 5000); //bc youtube injects iframes and scripts I just remove them every 5 sec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment