将洛谷一些粗略数字改为精确数字

将洛谷一些粗略数字(例如题目提交人数和通过人数)改为精确数字

// ==UserScript==
// @name		将洛谷一些粗略数字改为精确数字
// @namespace	https://www.luogu.com.cn/user/576074
// @license		SATA
// @version		1.2
// @description	将洛谷一些粗略数字(例如题目提交人数和通过人数)改为精确数字
// @author		123asdf123
// @match		*://www.luogu.com.cn/*
// @icon		https://asdf123asdf123asdf123.github.io/exact numbers.png
// @grant		none
// ==/UserScript==
var parser=new DOMParser(),ourl="";
function updd(newdoc){
	var x=JSON.parse(newdoc.getElementById("lentille-context").innerText),alls=x.data.problem.totalSubmit,acs=x.data.problem.totalAccepted,ch=document.querySelector("div.stat.stacked.with-vr.color-inv");
	ch.children[0].children[1].innerText=alls;ch.children[1].children[1].innerText=acs;
}
function updc(x){
	var cnt=x.currentData.contest.totalParticipants,ch=document.querySelector("div.stat.color-inverse");
	ch.children[1].children[1].innerText=cnt;
}
function updc2(x){
	var cnt=x.currentData.training.markCount,ch=document.querySelector("div.stat.color-inverse");
	ch.children[1].children[1].innerText=cnt;
}
function upd(){
    if(window.location.href!=ourl){
        if(window.location.href.indexOf("www.luogu.com.cn/problem")!=-1&&window.location.href.indexOf("solution")==-1&&window.location.href.indexOf("list")==-1){
            fetch(window.location.href).then(response=>response.text()).then(data=>(updd(parser.parseFromString(data,"text/html"))));
        }
        if(window.location.href.indexOf("www.luogu.com.cn/contest")!=-1&&window.location.href.indexOf("list")==-1&&window.location.href.indexOf("_contentOnly")==-1){
            fetch(window.location.href.slice(0,-window.location.hash.length)+"?_contentOnly").then(response=>response.json()).then(data=>(updc(data)));
        }
        if(window.location.href.indexOf("www.luogu.com.cn/training")!=-1&&window.location.href.indexOf("list")==-1&&window.location.href.indexOf("_contentOnly")==-1){
            fetch(window.location.href.slice(0,-window.location.hash.length)+"?_contentOnly").then(response=>response.json()).then(data=>(updc2(data)));
        }
        ourl=window.location.href;
    }
}
(function(){
	'use strict';
	setInterval(upd,50);
})();