动漫花园dmhy.org广告去除插件

去除动漫花园上的广告

当前为 2022-01-07 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Remove dmhy.org AD
  3. // @name:zh-CN 动漫花园dmhy.org广告去除插件
  4. // @version 1.3
  5. // @description Remove dmhy.org Annoy AD
  6. // @description:zh-CN 去除动漫花园上的广告
  7. // @author terry
  8. // @require https://code.jquery.com/jquery-3.6.0.min.js
  9. // @include https://*.dmhy.org/*
  10. // @include http*://dmhy.anoneko.com/*
  11. // @icon https://share.dmhy.org/images/sitelogo.gif
  12. // @license MIT
  13. // @run-at document-body
  14. // @namespace https://greasyfork.org/users/859967
  15. // ==/UserScript==
  16.  
  17. const filters = [
  18. '[class*="kiwi"]',
  19. '[href*="taobao"]',
  20. 'a:not([href^="/"]):not([href*="dmhy.org"]):not([href*="magnet"]):not([href*="#"]):not([href*="google"])'
  21. ];
  22.  
  23. // Use ADBlock way to block some annoy element
  24. (function removeFilters() {
  25. var $hiddenStyle = $('<style type="text/css"></style>');
  26. $($('head')[0]).append($hiddenStyle);
  27. $hiddenStyle.append(filters + "{display: none !important; visibility: hidden !important;}");
  28. })();
  29.  
  30. // removeBackgroundAd
  31. document.body.removeAttribute("data-href");
  32. document.body.removeAttribute("style");
  33.  
  34. // set background to bar Color
  35. $(document.body).css("background-color", $(".navbar").css("background-color"));
  36.  
  37. (function removeTopAds() {
  38. var topDiv = document.getElementsByClassName("logoCon")[0];
  39. var adCount = topDiv.children.length - 1;
  40.  
  41. while (adCount > 0) {
  42. topDiv.removeChild(topDiv.lastElementChild);
  43. adCount--;
  44. }
  45. })();