Phigros in luogu 插件修改版
Phigros in luogu 插件
by Unknown Fixed By ljx_蒟蒻007
找不到原作者了,侵权必删
7.30 & 8.1 Update:为什么我每次试用都能出新bug。。。现在不是正好一年了
距上次更新正好一年
正片
使用方式
使用篡改猴脚本安装,详情见官网
源代码在文章最下方
更新内容
- 适应洛谷近期更新(如难度调整)
- 定数数值膨胀(
第九章预告) - 增加
4 种评测结果 - 修复了题目 AC 后图标无法显示的问题
- 修复了原来的 html 移动机制无法适应各种特殊情况的问题
- 在提交数小于
20 或通过数小于1 时定数显示问号
由于一些神秘原因,在题目列表与题单中,第
功能介绍
为了更好的做题体验,未对个人中心进行修改
- 基于难度与通过人数显示定数
:::info[演示] :::
- 基于评测结果显示各种判定
:::info[演示] :::
- 在题目与评测记录页面的分数将被放大 10000 倍,AC 还有神秘 AP 图标
:::info[演示]
享受各种 bug(
:::info[演示]
源代码
:::info[源代码]
// ==UserScript==
// @name Phigros in luogu
// @namespace http://tampermonkey.net/
// @version 2026-08-01
// @description Phigros in luogu
// @author Unknown Fixed By ljx_蒟蒻007
// @match https://www.luogu.com.cn/*
// @grant none
// @license MIT
// @downloadURL https://update.greasyfork.org/scripts/501823/phigros%20in%20luogu.user.js
// @updateURL https://update.greasyfork.org/scripts/501823/phigros%20in%20luogu.meta.js
// ==/UserScript==
(function () {
'use strict';
function setName(lv, ratio, ac) {
function calclv(l, r) {
if(ac < 20)return "?";
if (ratio > 1) ratio = 1;
let level = l + (r - l) * Math.pow(1 - ratio, 3);
if(level < 8)return Math.floor(level * 2 + 0.5) / 2;
return Math.floor(level * 10 + 0.5) / 10;
}
if(lv == undefined)return;
let s = lv.innerText;
if (location.pathname.includes("list")){
if (s == "暂无评定" || s == "入门" || s == "普及−" || s == "普及" || s == "普及+/提高−" || s == "提高" || s == "提高+/省选−" || s == "省选/NOI−" || s == "NOI/NOI+/CTS" || s.includes("EZ") || s.includes("HD") || s.includes("IN") || s.includes("AT") || s.includes("SP")) {
let color = lv.style.backgroundColor;
if (color == "rgb(254, 76, 97)") lv.innerText = "EZ" + (ratio == undefined ? "" : " Lv." + calclv(1, 5));
if (color == "rgb(243, 156, 17)") lv.innerText = "EZ" + (ratio == undefined ? "" : " Lv." + calclv(4, 8));
if (color == "rgb(255, 193, 22)") lv.innerText = "HD" + (ratio == undefined ? "" : " Lv." + calclv(7, 11));
if (color == "rgb(83, 196, 26)") lv.innerText = "HD" + (ratio == undefined ? "" : " Lv." + calclv(10, 14));
if (color == "rgb(19, 194, 194)") lv.innerText = "IN" + (ratio == undefined ? "" : " Lv." + calclv(12, 15));
if (color == "rgb(52, 152, 219)") lv.innerText = "IN" + (ratio == undefined ? "" : " Lv." + calclv(13, 16));
if (color == "rgb(156, 61, 207)") lv.innerText = "AT" + (ratio == undefined ? "" : " Lv." + calclv(15, 17));
if (color == "rgb(14, 29, 105)") lv.innerText = "AT" + (ratio == undefined ? "" : " Lv." + calclv(16, 18));
if (color == "rgb(232, 232, 232)") lv.innerText = "SP" + (ratio == undefined ? "" : " Lv.?");
}
}else{
if(s == "暂无评定")lv.innerText = "SP" + (ratio == undefined ? "" : " Lv. ?");
if(s == "入门")lv.innerText = "EZ" + (ratio == undefined ? "" : " Lv." + calclv(1, 5));
if(s == "普及−")lv.innerText = "EZ" + (ratio == undefined ? "" : " Lv." + calclv(4, 8));
if(s == "普及")lv.innerText = "HD" + (ratio == undefined ? "" : " Lv." + calclv(7, 11));
if(s == "普及+/提高−")lv.innerText = "HD" + (ratio == undefined ? "" : " Lv." + calclv(10, 14));
if(s == "提高")lv.innerText = "IN" + (ratio == undefined ? "" : " Lv." + calclv(12, 15));
if(s == "提高+/省选−")lv.innerText = "IN" + (ratio == undefined ? "" : " Lv." + calclv(13, 16));
if(s == "省选/NOI−")lv.innerText = "AT" + (ratio == undefined ? "" : " Lv." + calclv(15, 17));
if(s == "NOI/NOI+/CTS")lv.innerText = "AT" + (ratio == undefined ? "" : " Lv." + calclv(16, 18));
}
}
setInterval(() => {
if (location.pathname.includes("/problem/")) {
if (location.pathname.includes("list")) {
let tmp = document.getElementsByClassName("row"), info = JSON.parse(document.getElementById("lentille-context").innerText).data, x, y;
if(info == undefined)info = [];
else if(info.problems == undefined)info = []
else if(info.problems.result == undefined)info = []
else info = info.problems.result;
for (let i=0; i < tmp.length; i++){
if(i < info.length && info[i].pid == tmp[i].children[1].innerText){
x = info[i].totalSubmit;
y = info[i].totalAccepted;
if(y == 0)setName(tmp[i].children[4].children[0].children[0], y / Math.max(x, 1), 0);
else setName(tmp[i].children[4].children[0].children[0], y / Math.max(x, 1), x);
}else{
x = tmp[i].children[5].children[0].children[0].style.width;
let ratio = x.substr(0, x.length - 1) * 0.01;
if(ratio == 0)setName(tmp[i].children[4].children[0].children[0], ratio, 0);
else setName(tmp[i].children[4].children[0].children[0], ratio, 114514);
tmp[i].style.transform = "translateX(" + -i*10 + ")";
}
// info只有刷新才会更新是什么机制。。。
}
} else {
let tmp = document.getElementsByClassName("top-row")[0].children[1].children[0];
let x = tmp.children[0].children[1].innerText; // 提交
if (x[x.length - 1] == "k") x = x.substring(0, x.length - 1) * 1000;
if (x[x.length - 1] == "M") x = x.substring(0, x.length - 1) * 1000000;
let y = tmp.children[1].children[1].innerText; // 通过
if (y[y.length - 1] == "k") y = y.substring(0, y.length - 1) * 1000;
if (y[y.length - 1] == "M") y = y.substring(0, y.length - 1) * 1000000;
// 定位到题目难度
let info = document.getElementsByClassName("side")[0], k, h = false;
for(let s = 0; s < info.children.length; s++){
for(k = 0; k < info.children[s].children.length; k++){
if(info.children[s].children[k].children[0] == undefined)continue;
if(info.children[s].children[k].children[0].innerText == "难度"){
h = true;
info = info.children[s];
break;
}
}
if(h)break;
}
let lv = info.children[k].children[1].children[0];
setName(lv, y / Math.max(x, 1), x);
let sc = info.children[k + 1].children[1].children[0]
if (sc.dataset.phiflag != 1) {
sc.dataset.phiflag = 1;
if (!isNaN(Number(sc.innerText))) {
sc.innerText *= 10000;
if (sc.innerText == 1000000) {
let img = document.createElement("img");
img.src = "https://cdn.luogu.com.cn/upload/image_hosting/kl0l200x.png"
img.style.height = "50px";
sc.parentNode.appendChild(img);
sc.remove();
}
}else if(sc.innerText == "Compile Error")sc.innerText = "闪退";
else if(sc.innerText == "Unknown Error")sc.innerText = "断触";
}
}
}
if (location.pathname.includes("/training/")) {
if (location.pathname.includes("list")) {
//?!滚木木滚!?
} else {
let tmp = document.getElementsByClassName("row"), info = JSON.parse(document.getElementById("lentille-context").innerText).data, x, y;
if(info == undefined)info = [];
else if(info.training == undefined)info = [];
else if(info.training.problems == undefined)info = [];
else info = info.training.problems;
for (let i=0; i<tmp.length - 3; i++){
if(i < info.length && info[i].pid == tmp[i].children[1].innerText){
x = info[i].totalSubmit;
y = info[i].totalAccepted;
setName(tmp[i].children[4].children[0].children[0], y / Math.max(x, 1), x);
}else{
x = tmp[i].children[5].children[0].children[0].style.width;
setName(tmp[i].children[4].children[0].children[0], x.substr(0, x.length - 1) * 0.01, 114514);
tmp[i].style.transform = "translateX(" + -i*10 + ")";
}
// info只有刷新才会更新是什么机制。。。
}
}
}
function getScoreByElm(elm, h, k){
if(h)return elm.parentNode.children[2];
else return document.getElementsByClassName("info-rows")[0].children[k + 1].children[1].children[0].children[0];
}
if (location.pathname.includes("/record/")) {
let tmp = document.getElementsByClassName("lfe-caption tag status-name"), h = true, k;
if (tmp.length == 0 && document.getElementsByClassName("info-rows").length > 0){
h = false
tmp = [document.getElementsByClassName("info-rows")[0].children[1].children[1].children[0]];
k = 1;
if(tmp[0].style.color == ''){
tmp = [document.getElementsByClassName("info-rows")[0].children[2].children[1].children[0]];
k = 2
}
}
for (let i of tmp) {
if (i != i.parentNode.children[1]) {
/*
制作一个替身,来修改显示的内容,但不影响原来的数据
*/
if (i.dataset.phiflag != 1 && i.dataset.phiflag != 2) {
i.dataset.phiflag = 1;
let s2 = document.createElement("span");
if(h){
s2.className = "lfe-caption tag status-name";
s2.dataset.phiflag = 1;
}
s2.style.display = "none";
i.parentNode.insertBefore(s2, i.parentNode.children[1]);
} else {
let c = i.parentNode.children[1];
if(h){
c.style.background = i.style.background;
c.style.color = "rgb(255, 255, 255)";
}else{
c.style.color = i.style.color;
}
c.style.fontFamily = i.style.fontFamily;
c.style.paddingLeft = "8px";
c.style.paddingRight = "8px";
c.style.display = "block"
let m = getScoreByElm(i, h, k), awa = 0;
if(m != undefined && m.innerText != ""){
if(i.dataset.phiflag != 2 && !h){
m.innerText *= 10000;
if(m.innerText == 1000000){
let img = document.createElement("img");
img.src = "https://cdn.luogu.com.cn/upload/image_hosting/kl0l200x.png"
img.style.height = "50px";
m.parentNode.appendChild(img);
m.remove();
}
}
awa = m.innerText;
}
i.dataset.phiflag = 2;
if (i.innerText.includes("Accepted") || i.innerText.includes("AC")) {
c.innerText = "Perfect";
} else if (i.innerText.includes("Unaccepted")) {
if(awa == 0)c.innerText = "Miss";
else if(awa < 60 || (!h && awa < 600000))c.innerText = "Bad";
else c.innerText = "Good";
} else if (i.innerText.includes("Compile Error") || i.innerText.includes("CE")) {
c.innerText = "闪退";
} else if (i.innerText.includes("Unknown Error")) {
c.innerText = "断触";
} else if (i.innerText.includes("Unshown")) {
c.innerText = "同步失败"
} else if (i.innerText.includes("Waiting")) {
c.innerText = "没电"
}
if(h || i.parentNode.parentNode.children[0].innerText == "评测状态")i.style.display = "none"
}
}
}
}
}, 10);
})();
:::
其他
- 已尝试在评测列表中将分数放大并失败,有大佬会的可以私信qwq
感谢机房教练没发现我不在做题(?- 猜你喜欢