Remove Baidu.pos

百度广告

  1. // ==UserScript==
  2. // @name Remove Baidu.pos
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description 百度广告
  6. // @author Xeon
  7. // @match http*://*/*
  8. // @grant none
  9. // ==/UserScript==
  10. (function (win) {
  11. 'use strict';
  12. // Your code here...
  13. //observer object
  14. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  15. var observer = new MutationObserver(function(/*mutations*/) {
  16. // mutations.forEach(function(mutation) {
  17. // // console.log(mutation);
  18. // });
  19. });
  20. var config = {childList:true,subtree:true};
  21. var target = document.querySelectorAll('iframe');
  22. var isrc = "pos.baidu.com";
  23.  
  24. for (var i = 0; i < target.length; i++) {
  25. observer.observe(target[i], config);
  26. var iframes = target[i].src;
  27.  
  28. if (iframes.indexOf(isrc)>-1) {
  29. target[i].parentNode.removeChild(target[i]);
  30. }
  31. }
  32. })();