动漫花园广告去除插件

去除动漫花园上的广告

目前为 2022-01-01 提交的版本。查看 最新版本

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