您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically remove Twitter Ads.
// ==UserScript== // @name Twitter No Ads // @version 1.4.2 // @author PartMent // @description Automatically remove Twitter Ads. // @match https://mobile.twitter.com/* // @match https://twitter.com/* // @license MIT // @grant none // @namespace https://greasyfork.org/users/310437 // ==/UserScript== let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; if (MutationObserver) console.log('No Ads is enabled.'); let observer = new MutationObserver(e => { let ads = document.querySelector('div div div article div div[data-testid="tweet"] > div:nth-of-type(2) > div:nth-of-type(2) > div:nth-of-type(4):not([role="group"]) > div > span') if (ads) { let line = ads.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; line.setAttribute("style", "display: none;"); ads = ads.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; ads.remove(); console.log('Ads have been removed.'); } }); observer.observe(document.body, {childList: true, subtree: true});