2 Star 2 Fork 6

xyf007/namerena_scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Emoji.html 1.84 KB
一键复制 编辑 原始数据 按行查看 历史
xyf007 提交于 2020-11-12 19:43 . modify all the wrong 'for's.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Emoji &#x6A21;&#x5F0F;</title>
</head>
<body>
<pre>
const prefix = '';
const team = '';
const nameLength = 5;
let names = '';
let name = '';
let result = '';
/**
* Generate a random number.
* @param {number} min min.
* @param {number} max max.
* @return {number} A random number in range [min, max]
*/
function randomAccess(min, max) {
return Math.floor(min + Math.floor(Math.random() * (max - min + 1)));
}
/**
* Get a random name.
* @return {String} The name.
*/
function getRandomName() {
name = '';
for (let i = 0; i < nameLength; i++) {
if (Math.floor(Math.random() * 2)) {
name += String.fromCodePoint(randomAccess(0x2600, 0x27BF));
} else {
name += String.fromCodePoint(randomAccess(0x1F300, 0x1F64F));
}
}
return name;
}
/**
* 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

搜索帮助