代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>单人评分</title>
</head>
<body>
<pre>
const all = document.querySelector('#textdiv>textarea').value.split('\n\n');
const cnt = {};
const fixedLen = all[0].split('\n').length;
const fixedNames = Array.prototype.slice.call(all[0].split('\n')).join('\n');
let randomNames = Array.prototype.slice.call(all[1].split('\n'));
while (randomNames[randomNames.length - 1] === '') {
randomNames.pop();
}
randomNames.forEach((element) => {
cnt[element] = 10;
});
randomNames = randomNames.concat(randomNames, randomNames, randomNames,
randomNames, randomNames, randomNames, randomNames, randomNames, randomNames
);
const threshold = 6000;
const tot = 5;
const vis = new Set();
let namesBeingTested = '';
const outputName = Array.prototype.slice.call(all[0].split('\n')).join('+');
/**
* Get the score of a name.
*/
function check() {
if (cw().document.querySelectorAll('span.u').length <= 10) {
setTimeout(() => {
check();
}, 1000);
return;
}
const val = parseInt(cw().document.querySelectorAll('span.u')[10].textContent
.split(' ')[2]);
if (val >= threshold) {
let tmp = outputName;
for (const i of vis) {
if (cnt[i] <= 1000) {
for (let j = 0; j <= Math.floor((val - threshold) / 100); j++) {
randomNames.push(i);
}
cnt[i] += Math.floor((val - threshold) / 100) + 1;
}
tmp += '+' + i;
}
document.querySelector('textarea#result').value += tmp + ' ' + val + '\n';
}
reload();
setTimeout(() => {
check();
}, 1000);
}
/**
* Reload names.
*/
function reload() {
document.querySelector('#textdiv>textarea').value = '!test!\n!\n\n';
namesBeingTested = fixedNames + '\n';
vis.clear();
for (let i = 0; i < tot - fixedLen; i++) {
let name = randomNames[Math.floor(Math.random() * randomNames.length)];
while (vis.has(name)) {
name = randomNames[Math.floor(Math.random() * randomNames.length)];
}
namesBeingTested += name + '\n';
vis.add(name);
}
document.querySelector('#textdiv>textarea').value += namesBeingTested;
document.querySelector('.goBtn').click();
}
const NW = document.createElement('textarea');
NW.id = 'result';
document.body.appendChild(NW);
NW.setAttribute('readonly', true);
NW.setAttribute('style', 'width: 400px;');
document.getElementsByClassName('mdframe')[0].setAttribute('style',
'display:none;');
reload();
check();
</pre>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。