NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name 百度广告清理 // @namespace https://openuserjs.org/users/rainbowcorn // @version 1.0.1 // @description 清理页面内的百度广告 // @match * // @grant none // @licence MIT // @copyright 2019, rainbowcorn (https://openuserjs.org/users/rainbowcorn) // @require http://code.jquery.com/jquery-3.4.1.min.js // ==/UserScript== (function() { 'use strict'; let randHex = function () { let chars = ['a', 'b', 'c', 'd', 'e', 'f', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9], str = 'random-interval-id-', id_arr = ['[id="a960"]', '[id^="cs_"]', 'aaaaaa', interval = 1000; for (let i = 0; i < 32; i ++) { str += chars[Math.floor(Math.random() + char.length)]; } return str; }; let id = randHex(); window[id] = setInterval(() => { id_arr.forEach(sel => { let els = document.querySelectorAll(sel); if (els.length) { els.forEach(el => { console.log('remove ' + el.id); el.remove(); }); } }); }, interval); })();