Restore Twitter Logo

Restores the default blue bird Twitter logo and removes the dog logo forced by Elon Musk

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Restore Twitter Logo
// @description  Restores the default blue bird Twitter logo and removes the dog logo forced by Elon Musk
// @namespace    https://www.example.com/
// @version      1.7.3
// @author       noxljlfsd
// @grant        none
// @match        https://twitter.com/*
// @license       MIT
// ==/UserScript==
 
(function() {
    'use strict';
 
    function chageDogLogo() {
        //if(true||document.readyState === 'complete') {
            // Set the default Twitter logo URL
            const defaultLogoUrl = 'https://abs.twimg.com/responsive-web/client-web/icon-ios.8ea219d5.png';
            // Find the Twitter logo element and restore the default logo
            const twitterLogo = document.querySelector("#react-root > div > div > div.css-1dbjc4n.r-18u37iz.r-13qz1uu.r-417010 > header > div > div > div > div:nth-child(1) > div.css-1dbjc4n.r-dnmrzs.r-1vvnge1 > h1 > a > div > svg");
            if (twitterLogo) {
                twitterLogo.outerHTML = `<image xlink:href="${defaultLogoUrl}" src="${defaultLogoUrl}" style="width:1.75rem;height:1.75rem;" alt="">`;
                return true;
            }
            else { return false;}
 
        //}
    }
    function TryChageLogo(){
        let times = 0;
        function changeDogLogoAndCount(){
            let tryResult = chageDogLogo();
            if(times++ >= 30 || tryResult){
                clearInterval();
            }
        }
        setInterval(changeDogLogoAndCount,1000);
    }
    TryChageLogo();
})();