Greasy Fork

来自缓存

Codeforces显示problemSet页面的题目数量统计

一款可以显示当前页面的题目数量和已解决题目数量和待解决题目数量的Codeforces插件。

// ==UserScript==
// @name         Codeforces显示problemSet页面的题目数量统计
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  一款可以显示当前页面的题目数量和已解决题目数量和待解决题目数量的Codeforces插件。
// @author       turgen
// @match        https://codeforces.com/problemset*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=codeforces.com
// @license        GPL
// ==/UserScript==

(function() {
 window.onload=function(){
   var table = document.querySelector("table.problems");
    if (table) {
        var tbody = table.querySelector("tbody");
        if (tbody) {
            var problemCount = tbody.querySelectorAll("tr").length-1;
            var AcceptedCount= tbody.querySelectorAll("tr.accepted-problem").length;
        }
        var org=table.getElementsByClassName("top")[1]
        if(problemCount>0)org.innerHTML="<strong>题目</strong>"+"<strong>(本页面总共<span style='color: red'>"+problemCount+"</span>道题目,</strong>"+"<strong>已解决<span style='color: green'>"+AcceptedCount+"</span>道,</strong>"+"<strong>剩余<span style='color: red'>"+(problemCount-AcceptedCount)+"</span>道未解决)</strong>"
    }
 }
})();