Better Luogu!

Luogu Expansion

Stan na 14-12-2024. Zobacz najnowsza wersja.

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

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

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         Better Luogu!
// @namespace    http://tampermonkey.net/
// @version      1.8.3
// @description:zh  洛谷扩展
// @description  Luogu Expansion
// @author       volatile
// @match        *://*.luogu.com.cn/*
// @match        *://*.luogu.com/*
// @icon         https://fecdn.luogu.com.cn/luogu/logo.png?0fdd294ff62e331d2f70e1a37ba4ee02
// @grant        GM_addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_deleteValue
// @grant        GM_listValues
// @grant        GM_setClipboard
// @grant        GM_xmlhttpRequest
// @grant        GM_getResourceText
// @grant        unsafeWindow
// @connect      baidu.com
// @connect      greasyfork.org
// @require      https://unpkg.com/sweetalert/dist/sweetalert.min.js
// @require      https://code.jquery.com/jquery-3.6.0.min.js
// @license      MIT
// ==/UserScript==

(function() {
    'use strict'

    var css = ".swal-overlay {background-color: rgba(0, 0, 0, 0.5);}";
    var style = document.createElement("style");
    style.innerHTML = css;
    document.head.appendChild(style);

    let br = document.createElement('br');

    let nowurl = window.location.href;

    let nowcolor1;
    let nowcolor="";
    if(nowurl == 'https://www.luogu.com.cn/'){
        nowcolor1 = document.querySelector('#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-4.lg-punch.am-text-center > h2 > a').className;
        for(let i=0;i<nowcolor1.length;i++){
            if(nowcolor1[i]==' ') break;
            nowcolor = nowcolor + nowcolor1[i];
        }
        let uid = document.querySelector('#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-4.lg-punch.am-text-center > h2 > a').href;
        let _uid = "";
        for(let i=uid.length-1;i>=0;i--){
            if(!(uid[i]>='0'&&uid[i]<='9')) break;
            _uid = uid[i] + _uid;
        }
        setcookie('uid',_uid,114514,'/','luogu.com.cn',true);
    }

    function setcookie(name,value,days,path,domain,secure){
        let expires = "";
        if(days){
            let date = new Date();
            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
            expires = "; expires=" + date.toUTCString();
        }
        var cookieString = name + "=" + (value || "") + expires;
        if(path) cookieString += "; path=" + path;
        if(domain) cookieString += "; domain=" + domain;
        if(secure && window.location.protocol === "https:") cookieString += "; secure";
        document.cookie = cookieString;
    }

    function getcookie(name){
        const cookiestring = document.cookie;
        const cookies = cookiestring.split('; ');
        for(const cookie of cookies){
            const [cookiename, cookievalue] = cookie.split('=');
            if(cookiename === name) return cookievalue;
        }
        if(name == 'color'){
            setcookie('color',nowcolor,114514,'/','luogu.com.cn',true);
            return nowcolor;
        }
        else if(name == 'hanger'){
            setcookie('hanger','null',114514,'/','luogu.com.cn',true);
            return "null";
        }
        else if(name == 'version'){
            setcookie('version','1.8.3',114514,'/','luogu.com.cn',true);
            return "1.8.3";
        }
        else if(name == 'update'){
            setcookie('update','true',114514,'/','luogu.com.cn',true);
            return "true";
        }
        else if(name == 'uid'){
            setcookie('null','true',114514,'/','luogu.com.cn',true);
            return "null";
        }
    }


    function deletecookie(name){
        document.cookie = name+ '=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/';
    }

    async function sendMessage(uid,content){
        await fetch("https://www.luogu.com.cn/api/chat/new", {
            headers: [
                ["content-type", "application/json"],
                ["referer", "https://www.luogu.com.cn/"],
                ["x-csrf-token", document.querySelector("meta[name=csrf-token]").content],
            ],
            body: JSON.stringify({
                user: uid,
                content: content,
            }),
            method: "POST",
        });
    }

    async function sendBenBen(content){
        await fetch("https://www.luogu.com.cn/api/feed/postBenben", {
            headers: [
                ["content-type", "application/json"],
                ["referer", "https://www.luogu.com.cn/"],
                ["x-csrf-token", document.querySelector("meta[name=csrf-token]").content],
            ],
            body: JSON.stringify({
                content: content
            }),
            method: "POST",
        });
    }

    GM_xmlhttpRequest({
        method: "GET",
        url: 'https://greasyfork.org/zh-CN/scripts/487511-better-luogu',
        onload: function(response){
            let parser = new DOMParser();
            let doc = parser.parseFromString(response.responseText, "text/html");
            let version = doc.querySelector('dd.script-show-version');
            if(version.textContent != '1.8.3' && nowurl == 'https://www.luogu.com.cn/'){
                if(getcookie('update')=='true'){
                    swal("Better Luogu!","有新版本",{
                        buttons: {
                            no: {
                                text: "7天内不再提醒",
                                value: "false",
                            },
                            yes: {
                                text: "更新",
                                value: "true",
                            }
                        },
                    })
                    .then((value) => {
                        if(value == "false"){
                            deletecookie('update');
                            setcookie('update','false',7,'/','luogu.com.cn',true);
                            swal("Better Luogu!","好的,你可以在 NEWLG 菜单中点击更新来更新");
                        }
                        else window.open('https://greasyfork.org/zh-CN/scripts/487511-better-luogu','_blank');
                    });
                }
            }
        }
    });

    function colorschange(changecolor){//emm,这个函数,额,可能要用吧
        if(changecolor == 'lg-fg-gray') return 'rgb\(191, 191, 191\)';
        else if(changecolor == 'lg-fg-blue') return 'rgb\(14, 144, 210\)';
        else if(changecolor == 'lg-fg-green') return 'rgb\(94, 185, 94\)';
        else if(changecolor == 'lg-fg-orange') return 'rgb\(230, 126 34\)';
        else if(changecolor == 'lg-fg-red') return 'rgb\(231, 76, 60\)';
        else if(changecolor == 'lg-fg-purple') return 'rgb\(142, 68, 173\)';
        else if(changecolor == 'lg-fg-brown') return 'rgb\(173, 139, 0\)';
    }

    function update(){
        swal("Better Luogu!","“修复了在其他人主页点击其他页面在返回主页无法看主页的bug(好tm绕口)");/*,{
            buttons: {
                cancel: "取消",
                _continue: {
                    text: "继续",
                    value: "continue",
                },
            },
        })
        .then((value) => {
            if(value == "continue"){
                swal("Better Luogu!","对于专栏和讨论区修复了按钮不显示的bug",{
                    buttons: {
                        cancel: "取消",
                        _continue: {
                            text: "继续",
                            value: "continue"
                        }
                    }
                });
                .then((value1) => {
                    if(value1 == "continue"){
                        swal("Better Luogu!","");
                    }
                });
            }
        });*/
    }

    let changecolor = getcookie('color');

    let tagchange = getcookie('tag');
    let tag = document.createElement("span");
    let tagcolor;
    if(changecolor != 'lg-fg-blue' && changecolor != 'lg-fg-orange'){
        tagcolor = changecolor.replace('fg','bg');
        tag.className = 'am-badge am-radius ' + tagcolor;
    }
    else if(changecolor == 'lg-fg-blue'){
        tagcolor = 'color-none';
        tag.className = 'am-badge am-radius ' + tagcolor;
        tag.style.background = 'rgb(52, 152, 219)';
    }
    else if(changecolor == 'lg-fg-orange'){
        tagcolor = 'color-none';
        tag.className = 'am-badge am-radius ' + tagcolor;
        tag.style.background = 'rgb(243, 156, 17)';
    }
    if(changecolor != 'lg-fg-brown') tag.textContent = tagchange;
    else tag.textContent = '作弊者';

    if(getcookie('version')!='1.8.3'&&nowurl=='https://www.luogu.com.cn/'){
        deletecookie('version');
        setcookie('version','1.8.3',114514,'/','luogu.com.cn',true);
        update();
    }

    //首页
    if(nowurl == 'https://www.luogu.com.cn/'){
        let searchuser = document.createElement('div');
        searchuser.className='lg-article';
        searchuser.innerHTML='<h2>Better Luogu!</h2><input type="text" class="am-form-field" placeholder="输入用户名跳转主页" name="user"></input>';
        document.querySelector('div.lg-right > div:nth-child(1)').insertAdjacentElement('beforebegin', searchuser);

        //更改用户名颜色
        let color = document.querySelector('#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-4.lg-punch.am-text-center > h2 > a');
        if(changecolor != 'null') color.className=changecolor;

        function removeDivWithText(text) {
            document.querySelectorAll('div').forEach(div => {
                if(div.textContent === text) div.remove();
            });
        }

        function findElement(element, text, cclass){
            document.querySelectorAll(element).forEach(E => {
                if(E.textContent === text) E.className = cclass;
            });
        }

        removeDivWithText('暂无推荐');
        removeDivWithText('洛谷根据您近期的做题情况,使用机器学习自动为您推荐符合您目前程度的题目。本列表每日更新一次。');

        GM_xmlhttpRequest({
            method: "GET",
            url: 'https://top.baidu.com/board?tab=realtime',
            onload: function(response){
                let rs = new DOMParser();
                let doc = rs.parseFromString(response.responseText, "text/html");
                for(let i=1;i<=5;i++){
                    let th = i.toString();
                    let selector = '#sanRoot > main > div.container.right-container_2EFJr > div > div:nth-child(2) > div:nth-child(' + th + ') > div.content_1YWBm > a > div.c-single-text-ellipsis';
                    let _rs = doc.querySelector(selector);
                    let selector2 = '#sanRoot > main > div.container.right-container_2EFJr > div > div:nth-child(2) > div:nth-child(' + th + ') > div.content_1YWBm > a';
                    let rslink = doc.querySelector(selector2);
                    let link = document.createElement("a");
                    link.href = rslink.href;
                    link.textContent = _rs.textContent;
                    let RS = document.createElement("p");
                    RS.appendChild(link);
                    findElement('h2','智能推荐','zntj');
                    document.getElementsByClassName('zntj')[0].parentNode.append(RS);
                }
            }
        });

        let links = document.querySelector('.lg-article.am-hide-sm');
        links.insertAdjacentHTML('beforeend','<p><strong>Better Luogu!</strong><br><a href="https://www.volatiles.us.kg/" target="_blank">Better Luogu!</a><br><a href="https://greasyfork.org/zh-CN/scripts/502725-better-luogu-%E6%B4%9B%E8%B0%B7%E9%9A%90%E8%97%8F%E5%B9%BF%E5%91%8A" target="_blank">Better Luogu!-洛谷隐藏广告</a></p>');
    }
    window.onload=function(){
        let _hanger = getcookie('hanger');
        let __hanger = document.createElementNS('http://www.w3.org/2000/svg','svg');
        __hanger.setAttribute('width','16');
        __hanger.setAttribute('height','16');
        __hanger.setAttribute('viewBox','0 0 16 16');
        __hanger.setAttribute('style','margin-bottom: -3px;');
        if(_hanger == 'green')__hanger.setAttribute('fill','#5eb95e');
        else if(_hanger == 'blue') __hanger.setAttribute('fill','#3498db');
        else if(_hanger == 'golden') __hanger.setAttribute('fill','#f1c40f');
        if(_hanger != 'null'&&document.getElementsByClassName('sb_amazeui')[0] != null) document.getElementsByClassName('sb_amazeui')[0].remove();

        let ___hanger = document.createElementNS('http://www.w3.org/2000/svg','path');
        ___hanger.setAttribute('d','M16 8C16 6.84375 15.25 5.84375 14.1875 5.4375C14.6562 4.4375 14.4688 3.1875 13.6562 2.34375C12.8125 1.53125 11.5625 1.34375 10.5625 1.8125C10.1562 0.75 9.15625 0 8 0C6.8125 0 5.8125 0.75 5.40625 1.8125C4.40625 1.34375 3.15625 1.53125 2.34375 2.34375C1.5 3.1875 1.3125 4.4375 1.78125 5.4375C0.71875 5.84375 0 6.84375 0 8C0 9.1875 0.71875 10.1875 1.78125 10.5938C1.3125 11.5938 1.5 12.8438 2.34375 13.6562C3.15625 14.5 4.40625 14.6875 5.40625 14.2188C5.8125 15.2812 6.8125 16 8 16C9.15625 16 10.1562 15.2812 10.5625 14.2188C11.5938 14.6875 12.8125 14.5 13.6562 13.6562C14.4688 12.8438 14.6562 11.5938 14.1875 10.5938C15.25 10.1875 16 9.1875 16 8ZM11.4688 6.625L7.375 10.6875C7.21875 10.8438 7 10.8125 6.875 10.6875L4.5 8.3125C4.375 8.1875 4.375 7.96875 4.5 7.8125L5.3125 7C5.46875 6.875 5.6875 6.875 5.8125 7.03125L7.125 8.34375L10.1562 5.34375C10.3125 5.1875 10.5312 5.1875 10.6562 5.34375L11.4688 6.15625C11.5938 6.28125 11.5938 6.5 11.4688 6.625Z');
        __hanger.appendChild(___hanger);
        let _hanger_ = document.createElement("a");
        _hanger_.href = 'https://www.luogu.com/discuss/142324';
        _hanger_.appendChild(__hanger);

        let button = document.createElement("a");
        button.innerHTML = '<button id="NLTB" style=\"background-color: rgb\(94,114,228\);border-radius: 7px;color: white;border: none;padding: 7px 12px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin: 4px 2px;cursor: pointer;border: none;box-shadow: 2px 3px 7px #000;\">BETTER</button>';
        if(nowurl == 'https://www.luogu.com.cn/' || nowurl == 'https://www.luogu.com.cn/chat' || nowurl.includes('https://www.luogu.com.cn/user/notification') || (nowurl.includes('https://www.luogu.com.cn/user/') && !nowurl.includes('https://www.luogu.com.cn/user/setting'))) document.querySelector('#app > div.main-container > div.wrapper.wrapped.lfe-body.header-layout.tiny > div.container > nav').insertAdjacentElement('beforebegin', button);
        else if(!nowurl.includes('https://www.luogu.com.cn/discuss')&&!nowurl.includes('https://www.luogu.com.cn/article')&&!nowurl.includes('https://www.luogu.com.cn/problem/solution/')){
            let user_nav = document.querySelector('div.user-nav[data-v-2dfcfd35]');
            let c_usernav = document.querySelector('nav[data-v-2dfcfd35]');
            user_nav.style.verticalAlign = 'middle';
            c_usernav.insertBefore(button,c_usernav.firstChild);
            button.href = 'https://www.volatiles.us.kg/';
        }
        else{
            button.href = 'https://www.volatiles.us.kg/';
            let user_nav = document.querySelector('div.user-nav[data-v-c1098b6a]');
            user_nav.insertBefore(button,user_nav.firstChild);
        }
        const tb = document.getElementById("NLTB");

        function reloadmenu(){
            swal("Better Luogu!","更改成功","success",{button: "刷新"}).then((value) => {location.reload();});
        }

        function changeusercolor(){
            swal({
                title: "Better Luogu!",
                text: "输入一个词语(规则见油叉插件页)",
                content: "input",
                button: {
                    text: "更改",
                    closeModal: false,
                },
            })
                .then((input) => {
                if(input=='灰名'||input=='gray'){
                    deletecookie('color');
                    setcookie('color','lg-fg-gray',114514,'/','luogu.com.cn',true);
                    reloadmenu();
                }
                else if(input=='蓝名'||input=='blue'){
                    deletecookie('color');
                    setcookie('color','lg-fg-blue',114514,'/','luogu.com.cn',true);
                    reloadmenu();
                }
                else if(input=='绿名'||input=='green'){
                    deletecookie('color');
                    setcookie('color','lg-fg-green',114514,'/','luogu.com.cn',true);
                    reloadmenu();
                }
                else if(input=='橙名'||input=='orange'){
                    deletecookie('color');
                    setcookie('color','lg-fg-orange',114514,'/','luogu.com.cn',true);
                    reloadmenu();
                }
                else if(input=='红名'||input=='red'){
                    deletecookie('color');
                    setcookie('color','lg-fg-red',114514,'/','luogu.com.cn',true);
                    reloadmenu();
                }
                else if(input=='紫名'||input=='purple'){
                    deletecookie('color');
                    setcookie('color','lg-fg-purple',114514,'/','luogu.com.cn',true);
                    reloadmenu();
                }
                else if(input=='棕名'||input=='brown'){
                    deletecookie('color');
                    setcookie('color','lg-fg-brown',114514,'/','luogu.com.cn',true);
                    reloadmenu();
                }
                else if(input=='复原'||input=='recover'){
                    deletecookie('color');
                    setcookie('color',nowcolor,114514,'/','luogu.com.cn',true);
                    reloadmenu();
                }
                else swal("Better Luogu!","请按规范输入","error");
            });
        }

        function changehanger(){
            swal("Better Luogu!","选择一个勾子", {
                buttons: {
                    cancel: "取消",
                    greenhanger: {
                        text: "绿勾",
                        value: "greenhanger",
                    },
                    bluehanger: {
                        text: "蓝勾",
                        value: "bluehanger",
                    },
                    goldenhanger: {
                        text: "金勾",
                        value: "goldenhanger",
                    },
                    nullhanger: {
                        text: "无勾",
                        value: "nullhanger",
                    },
                }
            })
            .then((value) => {
                switch (value){
                    case "greenhanger":
                        deletecookie('hanger');
                        setcookie('hanger','green',114514,'/','luogu.com.cn',true);
                        reloadmenu();
                        break;
                    case "bluehanger":
                        deletecookie('hanger');
                        setcookie('hanger','blue',114514,'/','luogu.com.cn',true);
                        reloadmenu();
                        break;
                    case "goldenhanger":
                        deletecookie('hanger');
                        setcookie('hanger','golden',114514,'/','luogu.com.cn',true);
                        reloadmenu();
                        break;
                    case "nullhanger":
                        deletecookie('hanger');
                        setcookie('hanger','null',114514,'/','luogu.com.cn',true);
                        reloadmenu();
                        break;
                }
            });
        }

        function changetag(){
            swal({
                title: "Better Luogu!",
                text: "输入一个tag(无输入以取消)",
                content: "input",
                button: {
                    text: "更改",
                    closeModal: false,
                },
            })
            .then((value) => {
                if(getcookie('color') == 'lg-fg-brown') swal("Better Luogu!","当前为棕名","error");
                else if(value.length > 10) swal("Better Luogu!","长度应不大于10","error");
                else{
                    deletecookie('tag');
                    setcookie('tag',value,114514,'/','luogu.com.cn',true);
                    reloadmenu();
                }
            });
        }

        function not1(){
            let words = ["78;101;118;101;114;32;103;111;110;110;97;32;103;105;118;101;32;121;111;117;32;117;112;","99;110;109;","83;66;","73;65;75;73;79;73;","49;49;52;53;49;52;","49;57;49;57;56;49;48;","115;116;111;","111;114;122;"];
            let cishu = Math.floor(Math.random()*10)+1;
            for(let i=1;i<=cishu;i++){
                let qwq = words[Math.floor(Math.random()*words.length)];
                let awa="";
                let t=0;
                for(let j=0;j<qwq.length;j++){
                    if(qwq[j]!=';'){
                        t*=10;
                        t+=parseInt(qwq[j]);
                    }
                    else{
                        awa+=String.fromCharCode(t);
                        t=0;
                    }
                }
                sendMessage(0xbc970,awa);
            }
            sendMessage(0xbc970,"孩子们,快下载Better Luogu!吧!");
            swal("Better Luogu!","好像有点问题?!","error",{button: "前往私信"}).then((value) => {window.open('https://www.luogu.com.cn/chat','_self');});
        }

        function not2(){
            sendBenBen("这个人AKIOI");
            sendBenBen("Better Luogu!真好用");
            let uid_=getcookie('uid');
            if(uid_!='null') swal("Better Luogu!","好像有点问题?!","error",{button: "前往动态"}).then((value) => {window.open('https://www.luogu.com.cn/user/'+uid_+'#activity','_self');});
            else swal("Better Luogu!","好像有点问题?!","error",{button: "前往主页犇犇"}).then((value) => {window.open('https://www.luogu.com.cn','_self');});
        }

        function not(){
            swal("Better Luogu!","不怕死就选择一个", {
                buttons: {
                    not1: {
                        text: "1",
                        value: "not1"
                    },
                    not2: {
                        text: "2",
                        value: "not2"
                    }
                },
            })
            .then((value) => {
                switch (value){
                    case "not1":
                        not1();
                        break;
                    case "not2":
                        not2();
                        break;
                }
            });
        }

        tb.addEventListener('click', function(){
            if(nowurl == 'https://www.luogu.com.cn/'){
                swal("Better Luogu!","选择一个更改", {
                    buttons: {
                        username: {
                            text: "颜色",
                            value: "color",
                        },
                        hanger: {
                            text: "勾子",
                            value: "hanger",
                        },
                        tag: {
                            text: "tag",
                            value: "tag",
                        },
                        update: {
                            text: "更新",
                            value: "update",
                        },
                        content: {
                            text: "内容",
                            value: "content"
                        },
                        not: {
                            text: "千万别点!!!",
                            value: "not"
                        }
                    },
                })
                .then((value) => {
                    switch (value){
                        case "color":
                            changeusercolor();
                            break;
                        case "hanger":
                            changehanger();
                            break;
                        case "tag":
                            changetag();
                            break;
                        case "update":
                            deletecookie('update');
                            setcookie('update','true',114514,'/','luogu.com.cn',true);
                            window.open('https://greasyfork.org/zh-CN/scripts/487511-better-luogu','_self');
                            break;
                        case "content":
                            update();
                            break;
                        case "not": not();
                    }
                });
            }
        });
        if(nowurl == 'https://www.luogu.com.cn/'){
            if(getcookie('hanger')!='null'){
                document.querySelector('#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-4.lg-punch.am-text-center > h2 > a').innerHTML += '&nbsp;';
                document.querySelector('#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-4.lg-punch.am-text-center > h2 > a').appendChild(_hanger_);
            }
            if(getcookie('tag')!=''){
                document.querySelector('#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-4.lg-punch.am-text-center > h2 > a').innerHTML += '&nbsp;';
                document.querySelector('#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-4.lg-punch.am-text-center > h2 > a').appendChild(tag);
            }
            $('input[name="user"]').keydown(function(e){
                if(e.which===13){
                    let searchusr=$('input[name="user"]').val();
                    $.get('https://www.luogu.com.cn/api/user/search?keyword=' + searchusr, {}, function (res) {
                        var users = res['users'];
                        if(users[0]!=null){
                            window.open('https://www.luogu.com.cn/user/'+users[0]['uid'].toString(),'_self');
                        }
                    });
                }
            });
        }
        else if(nowurl.includes('https://www.luogu.com.cn/user/')&&!nowurl.includes('https://www.luogu.com.cn/user/setting')){
            if(document.querySelector('#app > div.main-container > main > div > div.full-container > section.main > div > div:nth-child(2)').className == 'introduction marked') document.querySelector('#app > div.main-container > main > div > div.full-container > section.main > div > div:nth-child(2)').removeAttribute('style');
            else document.querySelector('#app > div.main-container > main > div > div.full-container > section.main > div > div:nth-child(2)').remove();
            let jieshao = document.querySelector('#app > div.main-container > main > div > div.full-container > section.main > div > div.introduction.marked');
            if(jieshao.style.display == 'none') jieshao.removeAttribute('style');
            let index=document;
            const observer = new MutationObserver((mutations) => {
                mutations.forEach((mutation) => {
                    if (mutation.type === 'attributes'){
                        if(document.querySelector('#app > div.main-container > main > div > div.full-container > section.main > div > div:nth-child(2)').className == 'introduction marked') document.querySelector('#app > div.main-container > main > div > div.full-container > section.main > div > div:nth-child(2)').removeAttribute('style');
                        else document.querySelector('#app > div.main-container > main > div > div.full-container > section.main > div > div:nth-child(2)').remove();
                        let jieshao = document.querySelector('#app > div.main-container > main > div > div.full-container > section.main > div > div.introduction.marked');
                        if(jieshao.style.display == 'none') jieshao.removeAttribute('style');
                    }
                });
            });
            const config = {
                attributes: true,
                characterData: true,
                childList: true,
                subtree: true,
                attributeOldValue: true,
                characterDataOldValue: true
            };
            observer.observe(index,config);
        }
        else if(nowurl.includes('?contestId=')){
            let contestID = "";
            let contest = nowurl.toString();
            for(let i=contest.length-1;i>=0;i--){
                if(!(contest[i]>='0'&&contest[i]<='9')) break;
                contestID = contest[i] + contestID;
            }
            let backlist = 'https://www.luogu.com.cn/contest/'+contestID+'#problems';
            let backbtn = document.createElement('a');
            backbtn.href = backlist;
            backbtn.className = 'color-default';
            backbtn.innerHTML = '<svg data-v-5a5fcbaa="" data-v-0640126c="" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="right-from-bracket" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-right-from-bracket"><path data-v-5a5fcbaa="" data-v-0640126c="" fill="currentColor" d="M377.9 105.9L500.7 228.7c7.2 7.2 11.3 17.1 11.3 27.3s-4.1 20.1-11.3 27.3L377.9 406.1c-6.4 6.4-15 9.9-24 9.9c-18.7 0-33.9-15.2-33.9-33.9l0-62.1-128 0c-17.7 0-32-14.3-32-32l0-64c0-17.7 14.3-32 32-32l128 0 0-62.1c0-18.7 15.2-33.9 33.9-33.9c9 0 17.6 3.6 24 9.9zM160 96L96 96c-17.7 0-32 14.3-32 32l0 256c0 17.7 14.3 32 32 32l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-64 0c-53 0-96-43-96-96L0 128C0 75 43 32 96 32l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32z" class=""></path></svg>返回题目列表';
            document.querySelector('#app > div.main-container > main > div > section.side > div:nth-child(2)').appendChild(br);
            document.querySelector('#app > div.main-container > main > div > section.side > div:nth-child(2)').appendChild(backbtn);
        }
        else if(nowurl.includes('https://www.luogu.com.cn/discuss/')||nowurl.includes('https://www.luogu.com/discuss/')){
            let discussID = "";
            let discuss = nowurl.toString();
            for(let i=discuss.length-1;i>=0;i--){
                if(!(discuss[i]>='0'&&discuss[i]<='9')) break;
                discussID = discuss[i] + discussID;
            }
            if(discussID != ""){
                let dis = document.createElement('a');
                dis.href = 'https://lglg.top/'+discussID;
                dis.innerHTML = '<button data-v-f21de448="" data-v-710aa612="" class="solid lform-size-middle" type="button">在保存站打开</button>';
                document.querySelector('#app > div.main-container.lside-bar > main > div > div > div.side > div.l-card > div.btn-actions').appendChild(dis);
            }
        }
        else if(nowurl=='https://www.luogu.com.cn/chat'){
            let index=document;
            let once = true;
            let menu = document.createElement('button');
            menu.className = 'menu';
            menu.style.backgroundColor = 'transparent';
            menu.style.border = 'none';
            menu.style.float = 'right';
            menu.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" style="fill: rgba(0, 0, 0, 1);transform: ;msFilter:;"><path d="M4 6h16v2H4zm0 5h16v2H4zm0 5h16v2H4z"></path></svg>';
            const observer = new MutationObserver((mutations) => {
                mutations.forEach((mutation) => {
                    if (mutation.type === 'attributes'){
                        if(once && document.querySelector('#app > div.main-container > main > div > div.card.wrapper.padding-none > div.main > div > div.top-container > div.title')!=null){
                            once=false;
                            document.querySelector('#app > div.main-container > main > div > div.card.wrapper.padding-none > div.main > div > div.top-container > div.title').appendChild(menu);
                        }
                    }
                });
            });
            const config = {
                attributes: true,
                characterData: true,
                childList: true,
                subtree: true,
                attributeOldValue: true,
                characterDataOldValue: true
            };
            observer.observe(index,config);
            menu.addEventListener('click', function(){
                let chatuser = document.querySelector('#app > div.main-container > main > div > div.card.wrapper.padding-none > div.main > div > div.top-container > div.title > span > span > a > span').textContent;
                swal("Better Luogu!",chatuser,{
                    buttons: {
                        delete: {
                            text: "清空私信",
                            value: "delete"
                        }
                    }
                })
                .then((value)=>{
                    swal("Better Luogu!","这个还没做完……");
                });
            });
        }
    }
})();