Greasy Fork

Greasy Fork is available in English.

洛谷顶栏添加其他链接

洛谷顶栏添加其他链接,可自定义

当前为 2022-06-17 提交的版本,查看 最新版本

// ==UserScript==
// @namespace    http://greasyfork.icu/zh-CN/users/772347
// @description  洛谷顶栏添加其他链接,可自定义
// @name         洛谷顶栏添加其他链接
// @namespace    http://tampermonkey.net/
// @version      1.0
// @author       WYXkk
// @match        https://www.luogu.com.cn/
// @match        https://www.luogu.com.cn/chat*
// @match        https://www.luogu.com.cn/notification*
// @match        https://www.luogu.com.cn/user/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    function add(link,text)
    {
        if(document.querySelectorAll('.link-container')[0]==undefined) setTimeout(function(){add(link,text)},50);
        else setTimeout(function(){var a=document.createElement("a");document.querySelectorAll('.link-container')[0].append(a);a.outerHTML=
        '<a data-v-303bbf52=\"\" data-v-e6ccd65e=\"\" href=\"'+link+'\" target=\"_blank\" colorscheme=\"none\" class=\"header-link color-none\">'+text+'</a>'
        ;},100);
    }
    //将网站的链接及文本在下方添加即可,下面只是一个示例
    var a=[
        {link:'https://www.bilibili.com',text:'Bilibili'},
        ];
    for(var i in a) add(a[i].link,a[i].text);
})();