// ==UserScript== // @name 洛谷用户名优化 Luogu username optimize // @namespace http://tampermonkey.net/ // @version 3.1 // @description 让你的洛谷用户名变成紫色并添加管理员标签与金钩,让自己变成神仙管理员QAQ // @author gandyli // @match https://www.luogu.com.cn/* // @match http://www.luogu.com.cn/* // @match https://www.luogu.com.cn // @match http://www.luogu.com.cn // @match https://www.luogu.com.cn/user/* // @match http://www.luogu.com.cn/user/* // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; var tar = document.getElementsByClassName("lg-fg-red lg-bold"); // 红 //var tar = document.getElementsByClassName("lg-fg-orange lg-bold"); // 橙 //var tar = document.getElementsByClassName("lg-fg-green"); // 绿 //var tar = document.getElementsByClassName("lg-fg-bluelight"); // 蓝 //var tar = document.getElementsByClassName("lg-fg-grey"); // 灰 var ele = " "; for (var i = 0; i < tar.length; i++) { if (tar[i].attributes['href'].value == "/user/84282") { tar[i].innerHTML = "andyli "; //$(tar[i]).after(ele); } } var css = ""; if (false || (new RegExp("^((?!blog).)*https://www.luogu.com.cn((?!blog).)*$")).test(document.location.href) || (new RegExp("^((?!blog).)*http://www.luogu.com.cn((?!blog).)*$")).test(document.location.href) || (new RegExp("^((?!blog).)*https://www2.luogu.com.cn((?!blog).)*$")).test(document.location.href) || (new RegExp("^((?!blog).)*http://www2.luogu.com.cn((?!blog).)*$")).test(document.location.href)) {// 如果你使用了氩洛谷 css += [ "a[class^=\"lg-fg-\"][href*=\"84282\"] {", " color: #8e44ad !important;", "}", "a[class^=\"lg-fg-\"][href*=\"84282\"]:after {", " content:\"管理员\";", " display: inline-block;", " min-width: 10px;", " padding: .25em .625em;", " font-size: 1.2rem;", " font-weight: 700;", " color: #fff;", " line-height: 1;", " vertical-align: baseline;", " white-space: nowrap;", " background-color: #8e44ad;", " border-radius: 50px;", " margin-left: 3px;", " padding-left: 10px;", " padding-right: 10px;", " padding-top: 4px;", " padding-bottom: 4px;", " transition: all .15s;", "}" ].join("\n"); // 如果你没有使用氩洛谷 /* css += [ "a[class^=\"lg-fg-\"][href*=\"84282\"] {", " color: #8e44ad !important;", "}", "a[class^=\"lg-fg-\"][href*=\"84282\"]:after {", " content:\"管理员\";", " display: inline-block;", " min-width: 10px;", " padding: .25em .625em;", " font-size: 1.2rem;", " font-weight: 700;", " color: #fff;", " line-height: 1;", " vertical-align: baseline;", " white-space: nowrap;", " background-color: #8e44ad;", " margin-left: 3px;", " transition: all .15s;", "}" ].join("\n"); */ if (typeof GM_addStyle != "undefined") { GM_addStyle(css); } else if (typeof PRO_addStyle != "undefined") { PRO_addStyle(css); } else if (typeof addStyle != "undefined") { addStyle(css); } else { var node = document.createElement("style"); node.type = "text/css"; node.appendChild(document.createTextNode(css)); var heads = document.getElementsByTagName("head"); if (heads.length > 0) { heads[0].appendChild(node); } else { // no head yet, stick it whereever document.documentElement.appendChild(node); } } }})();