CleanTwitterPosts

Auto-remove useless twitter replies with "@SaveToNotion"

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         CleanTwitterPosts
// @namespace    http://tampermonkey.net/
// @version      0.9
// @author       You
// @description  Auto-remove useless twitter replies with "@SaveToNotion"
// @match        https://twitter.com/*
// @icon         https://twitter.com/favicon.ico
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const BLOCKED_AT = ['@SaveToNotion']

    const clean_once = () => {
        const posts = document.querySelectorAll('.css-1dbjc4n.r-1ila09b.r-qklmqi.r-1adg3ll.r-1ny4l3l')
        for(let i = 0 ; i < posts.length ; i++){
            const post = posts[i];
            const links = post.querySelectorAll('a')
            for(let j = 0 ; j < links.length ; j++){
                const text = links[j].text
                if(BLOCKED_AT.indexOf(text) !== -1){
                    post.remove()
                    break
                }
            }
        }
    }
    window.onload = () => {
        setInterval(clean_once, 3000)
    }

})();