1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
var colors = [ 'rgb(191, 191, 191)', 'rgb(254, 76, 97)', 'rgb(243, 156, 17)', 'rgb(255, 193, 22)', 'rgb(82, 196, 26)', 'rgb(52, 152, 219)', 'rgb(157, 61, 207)', 'rgb(14, 29, 105)' ];
var classList = [ 'diff0', 'diff1', 'diff2', 'diff3', 'diff4', 'diff5', 'diff6', 'diff7', ]
var diffWord = [ "[无] ", "[红] ", "[橙] ", "[黄] ", "[绿] ", "[蓝] ", "[紫] ", "[黑] " ]
$(window).load(function () { 'use strict'; var problems = [];
var style = document.createElement("style"); style.type = "text/css" var text = document.createTextNode(` .diff0:before{content: "无][";} .diff1:before{content: "红][";} .diff2:before{content: "橙][";} .diff3:before{content: "黄][";} .diff4:before{content: "绿][";} .diff5:before{content: "蓝][";} .diff6:before{content: "紫][";} .diff7:before{content: "黑][";} `) style.appendChild(text) var head = document.getElementsByTagName("head")[0] head.appendChild(style)
for (var passed of window._feInjection.currentData.passedProblems) problems.push({ pid: passed.pid, dif: passed.difficulty, rendered: false }); for (var tryed of window._feInjection.currentData.submittedProblems) problems.push({ pid: tryed.pid, dif: tryed.difficulty, rendered: false }); console.log(window._feInjection)
var button = document.createElement("div"); button.style.backgroundColor = "#fff"; button.style.boxShadow = "0 1px 3px rgba(26,26,26,.1)" button.style.padding = "1.3em" $(".side").append(button);
var h3Text = document.createElement("h3"); h3Text.style.fontWeight = "normal" h3Text.style.fontSize = "1.125em" h3Text.style.marginTop = "0" h3Text.style.marginBottom = ".5em" h3Text.style.fontFamily = "inherit" h3Text.style.lineHeight = "1.2" h3Text.innerText = "手动刷新" button.append(h3Text);
var btn = document.createElement("button"); btn.style = "border-color: #3085d6;border-width: 1px;background-color: #3085d6;border-radius: 5px;color: white;box-shadow: none;"; btn.innerText = "刷新"; button.append(btn); btn.onclick = () => { for (var i = 0; i < problems.length; i++) problems[i].rendered = false; }
setInterval(() => { if (window.location.href.split("#").length == 2 && window.location.href.split("#")[1] == 'practice') { for (var i = 0; i < problems.length; i++) { if (!problems[i].rendered) { var elements = document.querySelectorAll('a'); for (var el of elements) { if (el.textContent == problems[i].pid) { if (el.classList) { try { el.className = el.className.replace('color-default', `${classList[problems[i].dif]}`); } catch {
}
} problems[i].rendered = true; el.style.color = colors[problems[i].dif]; break; } } } } } else { for (var j = 0; j < problems.length; j++) { problems[j].rendered = false; } } }, 1000);
for (let i = 0; i < $(".difficulty-tags .row .lfe-caption").length; i++) { var nowText = $(`.difficulty-tags .row:eq(${i}) .lfe-caption`).text() $(`.difficulty-tags .row:eq(${i}) .lfe-caption`).text(`${diffWord[i]}${nowText}`) } });
|