洛谷用户名优化 Luogu username optimize

让你的洛谷用户名变成紫色并添加管理员标签,让自己变成管理员QAQ

目前為 2019-05-19 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         洛谷用户名优化 Luogu username optimize
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  让你的洛谷用户名变成紫色并添加管理员标签,让自己变成管理员QAQ
// @author       gandyli
// @match        https://www.luogu.org/*
// @match        http://www.luogu.org/*
// @match        https://www.luogu.org
// @match        http://www.luogu.org
// @match        https://www.luogu.org/space/show?uid=*
// @match        http://www.luogu.org/space/show?uid=*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var css = "";
if (false || (new RegExp("^((?!blog).)*https://www.luogu.org((?!blog).)*$")).test(document.location.href) || (new RegExp("^((?!blog).)*http://www.luogu.org((?!blog).)*$")).test(document.location.href) || (new RegExp("^((?!blog).)*https://www2.luogu.org((?!blog).)*$")).test(document.location.href) || (new RegExp("^((?!blog).)*http://www2.luogu.org((?!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);
	}
}
}})();