Greasy Fork

Greasy Fork is available in English.

关闭推特敏感内容警告

关闭 警告:敏感内容

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         关闭推特敏感内容警告
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  关闭 警告:敏感内容
// @author       花似
// @match        https://twitter.com/*
// @icon         https://abs.twimg.com/responsive-web/client-web/icon-svg.ea5ff4aa.svg
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==
 
(function() {
    'use strict';
 
    // Add a counter at the bottom right corner
    var counter = document.createElement('div');
    counter.id = 'tm-counter';
    counter.textContent = '已经跳过警告 0 个';
    document.body.appendChild(counter);
 
    // Style the counter
    GM_addStyle('#tm-counter { position: fixed; right: 20px; bottom: 20px; background: #000; color: #fff; padding: 5px 10px; border-radius: 5px; }');
 
    var count = 0;
    var checkAndClick = function() {
        var warningElements = document.querySelectorAll('li[role="listitem"] div[role="button"] span');
        for (var i = 0; i < warningElements.length; i++) {
            var warningElement = warningElements[i];
            if (warningElement.textContent.includes('显示')) {
                warningElement.click();
                count++;
                counter.textContent = '已经跳过警告 ' + count + ' 个';
            }
        }
    };
 
    // Check every second
    setInterval(checkAndClick, 2000);
})();