Greasy Fork

Greasy Fork is available in English.

关闭推特敏感内容警告

关闭 警告:敏感内容

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

作者
花似
评分
0 0 0
版本
1.0
创建于
2024-04-13
更新于
2024-04-13
大小
1.4 KB
许可证
MIT
适用于

// ==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: #f7f9f9; color: #cccbcb; 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);
})();