Advertisement
Xyberviri

DeleteYouTubeAdContainers.user.js

Jun 28th, 2018
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name     Delete YouTube Ad Containers
  3. // @namespace    http://screwyoutube.com
  4. // @version      1.0
  5. // @description  Delete youtube's Ad Containers so it can't load ads into videos or on the page.
  6. // @author       Xyberviri
  7. // @include      http*://*.youtube.com/*
  8. // @include      http*://youtube.com/*
  9. // @include      http*://*.youtu.be/*
  10. // @include      http*://youtu.be/*
  11. // @run-at       document-end
  12. // ==/UserScript==
  13.  
  14. function DeleteAds() {
  15.   if(window.location.href.indexOf("watch?v=") < 0){
  16.     return false;
  17.   } else {    
  18.     try {
  19.       document.getElementById("google_companion_ad_div").remove();
  20.       }
  21.     catch(err) {}
  22.     try {
  23.             document.getElementById("player-ads").remove();
  24.         }
  25.     catch(err) {}
  26.     try {
  27.        document.getElementById("video-ads").remove();
  28.         }
  29.     catch(err) {}
  30.   }
  31. };
  32.  
  33. setInterval(DeleteAds(), 500);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement