twitter-block-premium

block twitter premium promotion

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         twitter-block-premium
// @namespace    http://tampermonkey.net/
// @version      0.9
// @description  block twitter premium promotion
// @author       @amormaid
// @match        https://twitter.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=arxiv.org
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    const body = document.querySelector("body");
    let time_stamp = 0
    body.addEventListener('touchstart', () => {
        console.log(time_stamp)
        if (new Date() - time_stamp < 1000 && window.location.href.includes('verified-get-verified')) {
            window.location.href = 'https://twitter.com'
        }
        time_stamp = new Date() - 0;
    })
    // window.addEventListener('popstate', () => console.log(1));
    // window.addEventListener('pushState', () => console.log(2));
    // window.addEventListener('replaceState', () => console.log(3));
    // navigation.addEventListener('navigate', () => {
    //     console.log('page changed');
    //     if (window.location.href.includes('verified-get-verified')) {
    //         const body = document.querySelector("body");

    //         const interval_id = setInterval(() => {
    //             const query_list = Array.from(document.getElementsByTagName('SPAN')).filter(i => i.innerHTML.includes('Maybe later'))
    //             console.log('get span ', query_list.length)
    //             if (query_list.length) {
    //                 query_list[0].click()
    //             }
    //         }, 5)
    //         setTimeout(() => clearInterval(interval_id), 5 * 1000)


    //         const observer = new MutationObserver(mutations => {
    //             const query_list = Array.from(document.getElementsByTagName('SPAN')).filter(i => i.innerHTML.includes('Maybe later'))
    //             console.log('get span ', query_list.length)
    //             if (query_list.length) {
    //                 query_list[0].click()
    //                 observer.disconnect()
    //             }
    //         });
    //         observer.observe(body, { childList: true, subtree: true });
    //     }
    // });

})();