2 Star 2 Fork 6

xyf007/namerena_scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
8_random_capital_characters_or_digits.html 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
xyf007 提交于 2020-11-12 19:43 . modify all the wrong 'for's.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>
&#x516B;&#x4F4D;&#x968F;&#x673A;&#x5B57;&#x6BCD;&#x6570;&#x5B57;&#x6A21;&#x5F0F;
</title>
</head>
<body>
<pre>
const prefix = '';
const team = '';
let names = '';
let result = '';
/**
* Get a random name.
* @return {String} The name.
*/
function getRandomName() {
let s = '';
for (let i = 0; i < 8; i++) {
const val = Math.floor(Math.random() * 36);
if (val < 10) {
s += String.fromCharCode(48 + val);
} else {
s += String.fromCharCode(55 + val);
}
}
return s;
}
/**
* Reload names.
*/
function reload() {
names = team + '\n';
for (let i = 0; i < 10; i++) {
names += ` ${prefix}${getRandomName()}\n`;
}
document.querySelector('div>textarea').value = names;
document.querySelector('.goBtn').click();
}
/**
* Search for the names with elites.
*/
function maint() {
if (cw().document.querySelectorAll('div.name').length < 10) {
setTimeout(function() {
maint();
}, 100);
return;
}
const a = cw().document.querySelectorAll('.s_elite3');
for (const name of a) {
result += name.parentElement.previousElementSibling.textContent.replace(
/^\s+|\s+$/g, '') + '\n';
}
document.querySelector('textarea#result').value = result;
reload();
setTimeout(function() {
maint();
}, 100);
}
const NW = document.createElement('textarea');
NW.id = 'result';
document.body.appendChild(NW);
NW.setAttribute('readonly', true);
document.getElementsByClassName('mdframe')[0].setAttribute('style',
'display:none;');
reload();
maint();
</pre>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/xyf0076/namerena_scripts.git
git@gitee.com:xyf0076/namerena_scripts.git
xyf0076
namerena_scripts
namerena_scripts
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385