跳到正文

剪贴板

剪贴板 tafgv7x3

原文
剪贴板信息

剪贴板信息

收录
更新

提交记录优化 & 代码缺省源

最新版

JavaScript
// ==UserScript==
// @name         洛谷提交记录显示优化
// @namespace
// @version      1.4
// @description  修改提交记录背景
// @author       沉石鱼惊旋
// @match        *://www.luogu.com.cn/record/*
// @run-at       document-end
// @license      MIT
// ==/UserScript==

// let jsdelivr = 'https://cdn.jsdelivr.net'
// let jsdelivr = 'https://cdn.mengze.vip'
let jsdelivr = 'https://jsdelivrcn.netlify.app'
let AC = 'https://cdn.luogu.com.cn/upload/image_hosting/rdonhhr0.png'
let WA = 'https://cdn.luogu.com.cn/upload/image_hosting/mepm72du.png'
let TLE = 'https://cdn.luogu.com.cn/upload/image_hosting/ghrtno1z.png'
let MLE = 'https://cdn.luogu.com.cn/upload/image_hosting/6bewp635.png'
let RE = 'https://cdn.luogu.com.cn/upload/image_hosting/7wuhfk1y.png'
let OLE = 'https://cdn.luogu.com.cn/upload/image_hosting/ifzdy695.png'
let UKE = 'https://cdn.luogu.com.cn/upload/image_hosting/ifzdy695.png'
let Judging = 'https://cdn.luogu.com.cn/upload/image_hosting/56t3iedd.png'
let CE = `https://cdn.luogu.com.cn/upload/image_hosting/92txqfq0.png`
let Waiting = `https://cdn.luogu.com.cn/upload/image_hosting/56t3iedd.png`

let TL = 'https://cdn.luogu.com.cn/upload/image_hosting/yjk9cl5y.png'
let PM = 'https://cdn.luogu.com.cn/upload/image_hosting/nl5nk8fv.png'

let ACcol = `rgba(0,0,0, 0.1)`;
let WAcol = `rgba(231, 76, 60, 0.2)`;
let TLEcol = `rgba(75,96,141, 0.5)`;
let MLEcol = `rgba(60,77,113, 0.6)`;
let REcol = `rgba(174,120,132, 0.6)`;
let OLEcol = `rgba(5, 34, 66, 0.4)`;
let UKEcol = `rgba(5, 34, 66, 0.4)`;
let Judgingcol = `rgba(20, 85, 143, 0.3)`;
let CEcol = `rgba(250, 219, 20, 0.1)`;
let Waitingcol = `rgba(20, 85, 143, 0.3)`;
let sta = [AC, WA, TLE, MLE, RE, OLE, UKE, Judging, CE, Waiting];
let col = [ACcol, WAcol, TLEcol, MLEcol, REcol, OLEcol, UKEcol, Judgingcol, CEcol, Waitingcol];
let txt = ["AC", "WA", "TLE", "MLE", "RE", "OLE", "UKE", "Judging", "CE", "WJ"];
let arc_txt = ["TEST ACCEPTED", "WRONG ANSWER", "TIME EXCEEDED", "MEMORY EXCEEDED", "RUNTIME ERROR", "OUTPUT EXCEEDED", "UNKNOWN ERROR", "TEST JUDGING", "COMPILE ERROR", "TEST WAITING"];
let arc_col1 = ["#008B45","#8B475D","#CD2990","#CD2990","#8B3A62","#CD2990","#000000","#00868B","#B8860B","#00868B"]
let arc_col2 = ["#00EE00","#FF6A6A","#00BFFF","#00BFFF","#FF82AB","#00BFFF","#708090","#00FFFF","#FFD700","#00FFFF"]

function getCol(x) {
    return `background: linear-gradient(${col[x]}, ${col[x]}), url('${sta[x]}'); background-size: cover;`;
}
function getCol2(x) {
    return `background: url('${sta[x]}'); background-size: cover;`;
}
function getArcCol(x) {
    return `background: url('${sta[x]}'); background-size: cover;`;
}
function main() {
    let tc = document.getElementsByClassName('test-case');
    let len = tc.length;
    let firstSTA = -1;
    let ac = 0;
    let judging = 0;
    sta = [AC, WA, TLE, MLE, RE, OLE, UKE, Judging, CE, Waiting];
    for (let i = 0; i < len; i += 1) {
        if (tc[i].id === 'luogu_submission_better_right_row') continue;
        if (tc[i].style.background === 'rgb(20, 85, 143)') {
            judging = 1;
            tc[i].style = getCol(7);
            continue;
        }
        let status = tc[i].getElementsByClassName('status')[0].innerHTML;
        if (status.length > 2) status = status.substring(0, 2);
        let tmpSTA = -1;
        if (status === "AC") {
            tmpSTA = 0;
        } else if (status === "WA") {
            tmpSTA = 1;
        } else if (status === "TL") {
            tmpSTA = 2;
        } else if (status === "ML") {
            tmpSTA = 3;
        } else if (status === "RE") {
            tmpSTA = 4;
        } else if (status === "OL") {
            tmpSTA = 5;
        } else if (status === "UK") {
            tmpSTA = 6;
        }
        tc[i].style = getCol(tmpSTA);
        if (tmpSTA === 0) {
            ac = 1;
        }
        if (tmpSTA != 0 && firstSTA === -1) {
            firstSTA = tmpSTA;
        }
    }
    sta = [PM, TL, TL, TL, TL, TL, TL, Judging, CE, Waiting];
    if (judging) firstSTA = 7;
    if (firstSTA === -1 && ac) firstSTA = 0;
    let doc = document.getElementsByClassName('info-rows')[0];
    let id = -1;
    for (let i = 0; i < doc.children.length; i += 1) {
        if (doc.children[i].children[0].children[0].innerHTML.includes('评测状态')) {
            id = i;
            break;
        }
    }
    let info = document.getElementsByClassName('info-rows')[0].children[id].children[1];;
    if (info.innerHTML.includes('Judging')) firstSTA = 7;
    if (info.innerHTML.includes('Compile Error') || info.innerHTML.includes('CE')) firstSTA = 8;
    if (info.innerHTML.includes('Unknown Error') || info.innerHTML.includes('UKE')) firstSTA = 6;
    if (info.innerHTML.includes('Waiting') || info.innerHTML.includes('WJ')) firstSTA = 9;
    // info.innerHTML = `${firstSTA}`;
    // info.innerHTML = `${txt[firstSTA]}`;
    if (firstSTA === -1) return;
    if (firstSTA == 7) {
        if (!info.innerHTML.includes('spinner')) {
            //info.innerHTML = `<div data-v-21e0a7cc="" class="test-case" style="${getCol(firstSTA)}" id="luogu_submission_better_right_row"><div data-v-21e0a7cc="" class="content"><div data-v-bbdab89a="" data-v-21e0a7cc="" class="spinner" style="width: 32px; height: 32px;"><div data-v-bbdab89a="" style="width: 32px; height: 32px; border-width: 2px;"></div></div></div></div>`
            info.innerHTML = `<div data-v-21e0a7cc="" class="test-case" style="width:180px;height:22px;" id="luogu_submission_better_right_row"><div data-v-21e0a7cc="" class="content" style=""><div data-v-21e0a7cc="" class="status" style="text-align:right !important; font-weight:bold !important;font-size:19px !important;background: linear-gradient(to bottom, ${arc_col1[firstSTA]}, ${arc_col2[firstSTA]}) !important;-webkit-background-clip: text !important;-webkit-text-fill-color:transparent !important;position: absolute !important;right: -3px !important;">${arc_txt[firstSTA]}</div></div> </div>`;
        }
    }
    //else if(firstSTA==8||firstSTA==9){
    //    if (!info.innerHTML.includes(txt[firstSTA])) {
    //        info.innerHTML = `<div data-v-21e0a7cc="" class="test-case" style="${getCol(firstSTA)}" id="luogu_submission_better_right_row"><div data-v-21e0a7cc="" class="content"><div data-v-21e0a7cc="" class="status">${txt[firstSTA]}</div></div> </div>`;
    //    }
    //}
    else {
        if (!info.innerHTML.includes(txt[firstSTA])) {
            //alert('qwq')
            //info.innerHTML = `<div data-v-21e0a7cc="" class="test-case" style="${getCol2(firstSTA)} width:240px;height:120px;" id="luogu_submission_better_right_row"><div data-v-21e0a7cc="" class="content"><div data-v-21e0a7cc="" class="status">PURE MEMORY</div></div> </div>`;
            info.innerHTML = `<div data-v-21e0a7cc="" class="test-case" style="width:180px;height:22px;" id="luogu_submission_better_right_row"><div data-v-21e0a7cc="" class="content" style=""><div data-v-21e0a7cc="" class="status" style="text-align:right !important; font-weight:bold !important;font-size:19px !important;background: linear-gradient(to bottom, ${arc_col1[firstSTA]}, ${arc_col2[firstSTA]}) !important;-webkit-background-clip: text !important;-webkit-text-fill-color:transparent !important;position: absolute !important;right: -3px !important;">${arc_txt[firstSTA]}</div></div> </div>`;
        }
    }
};
(function () {
    setInterval(function () {
        main();
    }, 200);
})();
CSS
.status{
    color: white;
}
@keyframes blink {
    0%, 100% {
        opacity: 1; /* 显现 */
    }
    50% {
        opacity: 0.6; /* 消失 */
    }
}
#luogu_submission_better_right_row{
    animation: blink 0.05s step-start infinite !important;
}
C++
// ==UserScript==
// @name         洛谷提交记录显示优化
// @namespace    https://github.com/chenyuxuan2009/luogu_submission_better
// @version      1.4
// @description  修改提交记录背景
// @author       沉石鱼惊旋
// @match        *://www.luogu.com.cn/record/*
// @run-at       document-end
// @license      MIT
// ==/UserScript==

// let jsdelivr = 'https://cdn.jsdelivr.net'
// let jsdelivr = 'https://cdn.mengze.vip'
let jsdelivr = 'https://jsdelivrcn.netlify.app'
let AC = 'https://cdn.luogu.com.cn/upload/image_hosting/rdonhhr0.png'
let WA = 'https://cdn.luogu.com.cn/upload/image_hosting/mepm72du.png'
let TLE = 'https://cdn.luogu.com.cn/upload/image_hosting/ghrtno1z.png'
let MLE = 'https://cdn.luogu.com.cn/upload/image_hosting/6bewp635.png'
let RE = 'https://cdn.luogu.com.cn/upload/image_hosting/7wuhfk1y.png'
let OLE = 'https://cdn.luogu.com.cn/upload/image_hosting/ifzdy695.png'
let UKE = 'https://cdn.luogu.com.cn/upload/image_hosting/ifzdy695.png'
let Judging = 'https://cdn.luogu.com.cn/upload/image_hosting/56t3iedd.png'
let CE = `https://cdn.luogu.com.cn/upload/image_hosting/92txqfq0.png`
let Waiting = `https://cdn.luogu.com.cn/upload/image_hosting/56t3iedd.png`

let TL = 'https://cdn.luogu.com.cn/upload/image_hosting/yjk9cl5y.png'
let PM = 'https://cdn.luogu.com.cn/upload/image_hosting/nl5nk8fv.png'

let ACcol = `rgba(0,0,0, 0.1)`;
let WAcol = `rgba(231, 76, 60, 0.2)`;
let TLEcol = `rgba(75,96,141, 0.5)`;
let MLEcol = `rgba(60,77,113, 0.6)`;
let REcol = `rgba(174,120,132, 0.6)`;
let OLEcol = `rgba(5, 34, 66, 0.4)`;
let UKEcol = `rgba(5, 34, 66, 0.4)`;
let Judgingcol = `rgba(20, 85, 143, 0.3)`;
let CEcol = `rgba(250, 219, 20, 0.1)`;
let Waitingcol = `rgba(20, 85, 143, 0.3)`;
let sta = [AC, WA, TLE, MLE, RE, OLE, UKE, Judging, CE, Waiting];
let col = [ACcol, WAcol, TLEcol, MLEcol, REcol, OLEcol, UKEcol, Judgingcol, CEcol, Waitingcol];
let txt = ["AC", "WA", "TLE", "MLE", "RE", "OLE", "UKE", "Judging", "CE", "WJ"];
let arc_txt = ["PURE MEMORY", "TRACK LOST", "TRACK LOST", "TRACK LOST", "TRACK LOST", "TRACK LOST", "TRACK LOST", "TRACK LOST", "TRACK LOST", "TRACK LOST"];
function getCol(x) {
    return `background: linear-gradient(${col[x]}, ${col[x]}), url('${sta[x]}'); background-size: cover;`;
}
function getCol2(x) {
    return `background: url('${sta[x]}'); background-size: cover;`;
}
function getArcCol(x) {
    return `background: url('${sta[x]}'); background-size: cover;`;
}
function main() {
    let tc = document.getElementsByClassName('test-case');
    let len = tc.length;
    let firstSTA = -1;
    let ac = 0;
    let judging = 0;
    sta = [AC, WA, TLE, MLE, RE, OLE, UKE, Judging, CE, Waiting];
    for (let i = 0; i < len; i += 1) {
        if (tc[i].id === 'luogu_submission_better_right_row') continue;
        if (tc[i].style.background === 'rgb(20, 85, 143)') {
            judging = 1;
            tc[i].style = getCol(7);
            continue;
        }
        let status = tc[i].getElementsByClassName('status')[0].innerHTML;
        if (status.length > 2) status = status.substring(0, 2);
        let tmpSTA = -1;
        if (status === "AC") {
            tmpSTA = 0;
        } else if (status === "WA") {
            tmpSTA = 1;
        } else if (status === "TL") {
            tmpSTA = 2;
        } else if (status === "ML") {
            tmpSTA = 3;
        } else if (status === "RE") {
            tmpSTA = 4;
        } else if (status === "OL") {
            tmpSTA = 5;
        } else if (status === "UK") {
            tmpSTA = 6;
        }
        tc[i].style = getCol(tmpSTA);
        if (tmpSTA === 0) {
            ac = 1;
        }
        if (tmpSTA != 0 && firstSTA === -1) {
            firstSTA = tmpSTA;
        }
    }
    sta = [PM, TL, TL, TL, TL, TL, TL, Judging, CE, Waiting];
    if (judging) firstSTA = 7;
    if (firstSTA === -1 && ac) firstSTA = 0;
    let doc = document.getElementsByClassName('info-rows')[0];
    let id = -1;
    for (let i = 0; i < doc.children.length; i += 1) {
        if (doc.children[i].children[0].children[0].innerHTML.includes('评测状态')) {
            id = i;
            break;
        }
    }
    let info = document.getElementsByClassName('info-rows')[0].children[id].children[1];;
    if (info.innerHTML.includes('Judging')) firstSTA = 7;
    if (info.innerHTML.includes('Compile Error') || info.innerHTML.includes('CE')) firstSTA = 8;
    if (info.innerHTML.includes('Unknown Error') || info.innerHTML.includes('UKE')) firstSTA = 6;
    if (info.innerHTML.includes('Waiting') || info.innerHTML.includes('WJ')) firstSTA = 9;
    // info.innerHTML = `${firstSTA}`;
    // info.innerHTML = `${txt[firstSTA]}`;
    if (firstSTA === -1) return;
    if (firstSTA == 7) {
        if (!info.innerHTML.includes('spinner')) {
            info.innerHTML = `<div data-v-21e0a7cc="" class="test-case" style="${getCol(firstSTA)}" id="luogu_submission_better_right_row"><div data-v-21e0a7cc="" class="content"><div data-v-bbdab89a="" data-v-21e0a7cc="" class="spinner" style="width: 32px; height: 32px;"><div data-v-bbdab89a="" style="width: 32px; height: 32px; border-width: 2px;"></div></div></div></div>`
        }
    }
    else if(firstSTA==8||firstSTA==9){
        if (!info.innerHTML.includes(txt[firstSTA])) {
            info.innerHTML = `<div data-v-21e0a7cc="" class="test-case" style="${getCol(firstSTA)}" id="luogu_submission_better_right_row"><div data-v-21e0a7cc="" class="content"><div data-v-21e0a7cc="" class="status">${txt[firstSTA]}</div></div> </div>`;
        }
    }
    else {
        if (!info.innerHTML.includes(txt[firstSTA])) {
            //info.innerHTML = `<div data-v-21e0a7cc="" class="test-case" style="${getCol2(firstSTA)} width:240px;height:120px;" id="luogu_submission_better_right_row"><div data-v-21e0a7cc="" class="content"><div data-v-21e0a7cc="" class="status">PURE MEMORY</div></div> </div>`;
            info.innerHTML = `<div data-v-21e0a7cc="" class="test-case" style="width:150px;height:25px;" id="luogu_submission_better_right_row"><div data-v-21e0a7cc="" class="content"><div data-v-21e0a7cc="" class="status" style="font-size:20px !important;background: linear-gradient(to bottom, #800080, #6495ED) !important;-webkit-background-clip: text !important;-webkit-text-fill-color:transparent !important;">${arc_txt[firstSTA]}</div></div> </div>`;
        }
    }
};
(function () {
    setInterval(function () {
        main();
    }, 10);
})();
C++
{
	// Place your snippets for cpp here. Each snippet is defined under a snippet name and has a prefix, body and
	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
	// same ids are connected.
	// Example:
	// "Print to console": {
	// 	"prefix": "log",
	// 	"body": [
	// 		"console.log('$1');",
	// 		"$2"
	// 	],
	// 	"description": "Log output to console"
	// }

	"Basic": {
		"prefix": "#include",
		"body": [
			"// Code by UniGravity",
			"#include<bits/stdc++.h>",
			"#define ll long long",
			"#define pii pair<int,int>",
			"#define forto(i,a,b) for(int i=(a),_##i(b);i<=_##i;i++)",
			"#define forbk(i,a,b) for(int i=(a),_##i(b);i>=_##i;i--)",
			"#define forv(i,a) for(int i(0),_##i(a);i<_##i;i++)",
			"#define fst first",
			"#define snd second",
			"#define il inline",
			"#define eb emplace_back",
			"#define mkp make_pair",
			"using namespace std;",
			"il int read(){",
			"    int x=0,f=1;char c=getchar();",
			"    while(c<'0'||'9'<c)c=='-'?(f=-1):0,c=getchar();",
			"    while('0'<=c&&c<='9')x=x*10+c-'0',c=getchar();",
			"    return x*f;",
			"}",
			"",
			"signed main(){",
			"    $1",
			"    return 0;",
			"}"
		],
		"description": ""
	},
	"DataMaker": {
		"prefix": "#dat",
		"body": [
			"// Code by UniGravity | DataMaker",
			"#include<bits/stdc++.h>",
			"#define ll long long",
			"#define pii pair<int,int>",
			"#define forto(i,a,b) for(int i=(a),_##i(b);i<=_##i;i++)",
			"#define forbk(i,a,b) for(int i=(a),_##i(b);i>=_##i;i--)",
			"#define forv(i,a) for(int i(0),_##i(a);i<_##i;i++)",
			"#define fst first",
			"#define snd second",
			"#define il inline",
			"#define eb emplace_back",
			"#define mkp make_pair",
			"using namespace std;",
			"il int read(){",
			"    int x=0,f=1;char c=getchar();",
			"    while(c<'0'||'9'<c)c=='-'?(f=-1):0,c=getchar();",
			"    while('0'<=c&&c<='9')x=x*10+c-'0',c=getchar();",
			"    return x*f;",
			"}",
			"mt19937 rnd(random_device{}());",
			"il int rd(int l,int r){return l+rnd()%(r-l+1);}",
			"il ll rd(ll l,ll r){return l+(__int128)rnd()*rnd()%(r-l+1);}",
			"",
			"signed main(){",
			"    $1",
			"    return 0;",
			"}"
		],
		"description": ""
	},
	"Checker": {
		"prefix": "#chk",
		"body": [
			"// Code by UniGravity | Checker",
			"#include<bits/stdc++.h>",
			"#define ll long long",
			"#define pii pair<int,int>",
			"#define forto(i,a,b) for(int i=(a),_##i(b);i<=_##i;i++)",
			"#define forbk(i,a,b) for(int i=(a),_##i(b);i>=_##i;i--)",
			"#define forv(i,a) for(int i(0),_##i(a);i<_##i;i++)",
			"#define fst first",
			"#define snd second",
			"#define il inline",
			"#define eb emplace_back",
			"#define mkp make_pair",
			"using namespace std;",
			"il int read(){",
			"    int x=0,f=1;char c=getchar();",
			"    while(c<'0'||'9'<c)c=='-'?(f=-1):0,c=getchar();",
			"    while('0'<=c&&c<='9')x=x*10+c-'0',c=getchar();",
			"    return x*f;",
			"}",
			"",
			"signed main(){",
			"    string dat=\"$1\",now=\"\",std=\"\";",
			"    system((\"make \"+dat).c_str()),system((\"make \"+now).c_str()),system((\"make \"+std).c_str());",
			"    for(int i=1;;i++){",
			"        system((\"./\"+dat+\" > in\").c_str()),system((\"./\"+now+\" < in > out\").c_str()),system((\"./\"+std+\" < in > ans\").c_str());",
			"        if(system(\"diff out ans -w\"))break;printf(\"%d\\n\",i);",
			"    }return 0;",
			"}"
		],
		"description": ""
	},
	"MultiTest": {
		"prefix": "#mul",
		"body": [
			"// Code by UniGravity",
			"#include<bits/stdc++.h>",
			"#define ll long long",
			"#define pii pair<int,int>",
			"#define forto(i,a,b) for(int i=(a),_##i(b);i<=_##i;i++)",
			"#define forbk(i,a,b) for(int i=(a),_##i(b);i>=_##i;i--)",
			"#define forv(i,a) for(int i(0),_##i(a);i<_##i;i++)",
			"#define fst first",
			"#define snd second",
			"#define il inline",
			"#define eb emplace_back",
			"#define mkp make_pair",
			"using namespace std;",
			"il int read(){",
			"    int x=0,f=1;char c=getchar();",
			"    while(c<'0'||'9'<c)c=='-'?(f=-1):0,c=getchar();",
			"    while('0'<=c&&c<='9')x=x*10+c-'0',c=getchar();",
			"    return x*f;",
			"}",
			"",
			"il void work(){",
			"    $1",
			"}",
			"signed main(){int t=read();while(t--)work();return 0;}"
		],
		"description": ""
	}
}