Greasy Fork

Greasy Fork is available in English.

Google广告屏蔽

2024/2/4 14:58:03

当前为 2024-02-04 提交的版本,查看 最新版本

// ==UserScript==
// @name        Google广告屏蔽
// @namespace   Violentmonkey Scripts
// @match       *://*/*
// @grant       none
// @version     1.0
// @author      0x00
// @description 2024/2/4 14:58:03
// @license     MIT
// @icon        data:image/svg+xml,<svg t="1707035371940" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2554" width="200" height="200"><path d="M881 442.4H519.7v148.5h206.4c-8.9 48-35.9 88.6-76.6 115.8-34.4 23-78.3 36.6-129.9 36.6-99.9 0-184.4-67.5-214.6-158.2-7.6-23-12-47.6-12-72.9s4.4-49.9 12-72.9c30.3-90.6 114.8-158.1 214.7-158.1 56.3 0 106.8 19.4 146.6 57.4l110-110.1c-66.5-62-153.2-100-256.6-100-149.9 0-279.6 86-342.7 211.4-26 51.8-40.8 110.4-40.8 172.4S151 632.8 177 684.6C240.1 810 369.8 896 519.7 896c103.6 0 190.4-34.4 253.8-93 72.5-66.8 114.4-165.2 114.4-282.1 0-27.2-2.4-53.3-6.9-78.5z" p-id="2555"></path></svg>
// ==/UserScript==

(function(){
  function clearAD(){
    // 查询所有class为"adsbygoogle adsbygoogle-noablate"的div元素
    //var divElements = document.querySelectorAll("adsbygoogle adsbygoogle-noablate");
    var divElements = document.getElementsByClassName("adsbygoogle adsbygoogle-noablate");

    // 遍历每个div元素并删除
    for (var i = 0; i < divElements.length; i++) {
      var element = divElements[i];
      element.parentNode.removeChild(element); // 从父节点中移除该元素
    }
  }
  setTimeout(()=>{clearAD();},1000);
})();