// ==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();
})();
网友评论