洛谷钩子修改器

将指定用户的钩子改为金钩

// ==UserScript==
// @name         洛谷钩子修改器
// @namespace    http://tampermonkey.net/
// @version      1.1.8
// @description  将指定用户的钩子改为金钩
// @author       Cby
// @match        https://www.luogu.com.cn/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant        none
// @license      MIT
// ==/UserScript==
(function() {
    'use strict';
    var To="Genius_Star";
    function f(element){
        const children=element.children;
        var t=element;
        if(element.innerHTML=="\n  "+To+"\n"){
            t=element.parentNode.parentNode;
             if(t.children.length>1){
                 t=t.children[1];
                 if(t.children.length>=1){
                     t=t.children[0];
                     if(t.children.length>=1){
                         t=t.children[0];
                         t.style="--fa-primary-color: #fff; --fa-secondary-color: gold; --fa-secondary-opacity: 1;";
                     }
                 }
             }
        }
        if(element.innerHTML=="\n  "+To+"\n"){
            t=element.parentNode.parentNode.parentNode;
             if(t.children.length>1){
                 t=t.children[1];
                 if(t.children.length>=1){
                     t=t.children[0];
                     t.style="--fa-primary-color: #fff; --fa-secondary-color: gold; --fa-secondary-opacity: 1;";
                 }
             }
        }
        if(element.innerHTML=="\n  "+To+"\n"){
            t=element.parentNode.parentNode.parentNode.parentNode;
             if(t.children.length>1){
                 t=t.children[1];
                 if(t.children.length>=1){
                     t=t.children[0];
                     if(t.children.length>=1){
                         t=t.children[0];
                         t.style="--fa-primary-color: #fff; --fa-secondary-color: gold; --fa-secondary-opacity: 1;";
                     }
                 }
             }
        }
        if(element.innerHTML=="\n  "+To+"\n"){
            t=element.parentNode;
             if(t.children.length>1){
                 t=t.children[1];
                 if(t.children.length>=1){
                     t=t.children[0];
                     if(t.children.length>=1){
                         t=t.children[0];
                         t.style="--fa-primary-color: #fff; --fa-secondary-color: gold; --fa-secondary-opacity: 1;";
                     }
                 }
             }
        }
        if(element.innerHTML=="\n  "+To+"\n"){
            t=element.parentNode;
             if(t.children.length>1){
                 t=t.children[1];
                 if(t.children.length>=1){
                     t=t.children[0];
                     t.style.fill="gold";
                 }
             }
        }
        if(element.innerHTML==To){
            t=element.parentNode.parentNode;
             if(t.children.length>1){
                 t=t.children[1];
                 if(t.children.length>=1){
                     t=t.children[0];
                     if(t.children.length>=1){
                         t=t.children[0];
                         t.style="--fa-primary-color: #fff; --fa-secondary-color: gold; --fa-secondary-opacity: 1;";
                     }
                 }
             }
        }
        if(element.innerHTML==To){
            t=element.parentNode.parentNode.parentNode;
             if(t.children.length>1){
                 t=t.children[1];
                 if(t.children.length>=1){
                     t=t.children[0];
                     t.style="--fa-primary-color: #fff; --fa-secondary-color: gold; --fa-secondary-opacity: 1;";
                 }
             }
        }
        if(element.innerHTML==To){
            t=element.parentNode;
             if(t.children.length>1){
                 t=t.children[1];
                 if(t.children.length>=1){
                     t=t.children[0];
                     if(t.children.length>=1){
                         t=t.children[0];
                         t.style="--fa-primary-color: #fff; --fa-secondary-color: gold; --fa-secondary-opacity: 1;";
                     }
                 }
             }
        }
        if(element.innerHTML==To){
            t=element.parentNode;
             if(t.children.length>1){
                 t=t.children[1];
                 if(t.children.length>=1){
                     t=t.children[0];
                     t.style.fill="gold";
                 }
             }
        }
        if(element.innerHTML==To){
            t=element.parentNode.parentNode.parentNode.parentNode;
             if(t.children.length>1){
                 t=t.children[1];
                 if(t.children.length>=1){
                     t=t.children[0];
                     if(t.children.length>=1){
                         t=t.children[0];
                         t.style="--fa-primary-color: #fff; --fa-secondary-color: gold; --fa-secondary-opacity: 1;";
                     }
                 }
             }
        }
        for(let i=0;i<children.length;i++){
            f(children[i]);
        }
    }
    function g(){
        var feed=document.getElementsByClassName("feed");
        for(let i=0;i<feed.length;i++)f(feed[i]);
        var t2=document.getElementsByClassName("user-name");
        for(let i=0;i<t2.length;i++)f(t2[i]);
        var t3=document.getElementsByClassName("luogu-username user-name");
        for(let i=0;i<t3.length;i++)f(t3[i]);
        var t4=document.getElementsByClassName("user");
        for(let i=0;i<t4.length;i++)f(t4[i]);
        var t5=document.getElementsByClassName("title");
        for(let i=0;i<t5.length;i++)f(t5[i]);
        var t6=document.getElementsByClassName("item");
        for(let i=0;i<t6.length;i++)f(t6[i]);
        var t7=document.getElementsByClassName("feed-username");
        for(let i=0;i<t7.length;i++)f(t7[i]);
        var t8=document.getElementsByClassName("color-none");
        for(let i=0;i<t8.length;i++)f(t8[i]);
    }
    g();
    const T = new MutationObserver(g);
    T.observe(document,{childList:true,subtree:true});
})();