您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
移除 twitter 的敏感内容警告
当前为
- // ==UserScript==
- // @name Twitter remove content warning
- // @name:zh-CN Twitter 移除内容警告
- // @icon https://twitter.com/favicon.ico
- // @namespace https://github.com/Tsuk1ko
- // @version 1.0.0
- // @description Remove twitter content warning
- // @description:zh-CN 移除 twitter 的敏感内容警告
- // @author 神代綺凛
- // @include https://twitter.com/*
- // @include https://mobile.twitter.com/*
- // @license MIT
- // @grant GM_addStyle
- // @run-at document-end
- // ==/UserScript==
- (async () => {
- 'use strict';
- const css = (strings, ...values) => GM_addStyle(String.raw({ raw: strings }, ...values));
- /**
- * @template {Function} T
- * @param {T} func
- * @param {number} timeout
- * @returns {ReturnType<T>}
- */
- const waitValue = (func, timeout = 10000) =>
- new Promise((resolve, reject) => {
- const val = func();
- if (val) {
- resolve(val);
- return;
- }
- const timeoutTimer = setTimeout(() => {
- clearInterval(timer);
- reject();
- }, timeout);
- const timer = setInterval(() => {
- const val = func();
- if (val) {
- clearTimeout(timeoutTimer);
- clearInterval(timer);
- resolve(val);
- }
- }, 500);
- });
- const findBlurCssRule = () => {
- for (const ss of document.styleSheets) {
- for (const rule of ss.cssRules) {
- if (!(rule instanceof CSSStyleRule)) continue;
- if (rule.style.filter === 'blur(30px)') {
- return rule;
- }
- }
- }
- };
- const rule = await waitValue(findBlurCssRule);
- if (!rule) return;
- rule.style.filter = '';
- css`
- ${rule.selectorText} + div {
- display: none;
- }
- `;
- })();