Luogu 首页置顶助手

Luogu 首页顶部置顶任意链接(1个)

目前為 2019-08-04 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Luogu 首页置顶助手
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Luogu 首页顶部置顶任意链接(1个)
// @author       zz07
// @match        https://www.luogu.org
// @grant        GM_getValue
// @grant        GM_setValue
// ==/UserScript==

(function() {
    'use strict';
    $(function(){
        var title = $(".link-container");
        var prelink = GM_getValue("user_link");
        var pretext = GM_getValue("user_link_text")
        var link = '<a href="' + prelink + '" class="header-link color-none">' + pretext + '</a>';
        var button = '<button class="am-btn am-btn-sm am-btn-primary" style="margin-left: 1.5em;">编辑</button>';
        var helper = '<span data-v-86f2b1fc data-v-5b9d45a0 class="helper"></span>';
        console.log(button);
        if (pretext != undefined)
        {
            title.append(link, helper);
        }
        title.append(button, helper);
    });
})();