去广告

作者: _____西班木有蛀牙 | 来源:发表于2021-01-26 17:42 被阅读0次
    // ==UserScript==
    // @name         New Userscript
    // @namespace    http://tampermonkey.net/
    // @version      0.6
    // @description  try to take over the world!
    // @author       You
    // @include      *://*.imomoe.ai/*
    // @grant        none
    // ==/UserScript==
    
    (function () {
      'use strict';
      /** 广告列表 id,class */
      const ADSelectorList = [
        '#HMRichBox',
        '.h5game',
        '[id*="ad_"]'
      ];
    
      const domTrie = {}
    
      let time = 0;
    
      const deepHideDomBySelectorName = (selectorName) => {
        conso
        if (!selectorName || !(selectorName.trim())) return;
        if (domTrie[selectorName]) return;
        const dom = document.querySelectorAll(selectorName);
        if (dom.length === 0) return;
        console.log(dom)
        dom.forEach(item => item.style.display = "none");
        domTrie[selectorName] = true;
      }
    
      const isover = function () {
        const flag = 0;
        for (const item in domTrie) {
          if (domTrie[item]) {
            flag += 1
          };
        }
        return flag === ADSelectorList.length || time === 15;
      }
    
      const deepFn = function () {
        console.log(isover())
        if (isover()) {
          clearInterval(index);
          return;
        }
        console.log(ADSelectorList, domTrie)
        ADSelectorList.forEach(deepHideDomBySelectorName)
        time += 1;
      }
    
      var index = setInterval(deepFn, 2 * 1000);
    
      deepFn();
    
    })();
    

    相关文章

      网友评论

          本文标题:去广告

          本文链接:https://www.haomeiwen.com/subject/dgxnzktx.html