forked from namerena/namerena.github.io
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest2.html
215 lines (209 loc) · 6.42 KB
/
test2.html
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<html>
<head>
<title>文哥测号器</title>
<link rel="shortcut icon" href="wenge.ico">
<style type="text/css">
.main{
display: flex;
flex-direction: row;
width:100%;
height:100%;
}
div.w300{
margin:10px;
margin-top:0px;
width:350px;
height:100%;
}
div.w300>*{
margin-top:10px;
width:100%;
}
div.a100>input{
width:100%;
}
select{
width:100%;
}
textarea{
width:100%;
min-height:500px;
}
</style>
<script>
var D={
max_window:2,
cur_window:0,
prefix:"",
suffix:"",
team:"",
mode:"",
cur_digit:0,
threshold:0,
upgrade:false,
elite2:false,
stk:[],
is:0,
res:"",
res_all:"",
tested:0,
retry:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
}
var W=function(n){return document.querySelectorAll('iframe')[n].contentWindow};
var G=function(mode,nP,nS,nT){//generate
var s="";
if(mode=="hanzi"){
for(var i=1;i<=10;i++){
var t="";
for(var j=1;j<=3;j++)t+=unescape("%u"+Number(Math.floor(Math.random()*(0x9fa5-0x4e00)+0x4e00)).toString(16));
s+=nP+t+nS+"@"+nT+"\n";
}
}
else if(mode=="digit"){
for(var i=1;i<=10;i++){
s+=nP+D.cur_digit+nS+"@"+nT+"\n";
D.cur_digit++;
}
}
else{
for(var i=1;i<=10;i++){
var t="";
for(var j=1;j<=8;j++)t+="1234567890QWERTYUIOPASDFGHJKLZXCVBNM"[Math.floor(Math.random()*26)];
s+=nP+t+nS+"@"+nT+"\n";
}
}
D.tested+=10;
Q(".tested").value=D.tested;
return s;
}
var S=function(s,x){//start game
W(x).document.querySelector("#textdiv>textarea").value=s;
W(x).document.querySelector(".goBtn").click();
}
var Q=function(s){
return document.querySelector(s);
}
var WQA=function(x,s){
return W(x).cw().document.querySelectorAll(s);
}
var WR=function(x){
S(G(D.mode,D.prefix,D.suffix,D.team),x);
}
var R=function(){
for(var i=1;i<=D.max_window;i++)WR(i);
}
var T=function(){
for(var i=1;i<=D.max_window;i++){
if(D.retry[i]>20){
WR(i);
D.retry[i]=0;
console.log("skip in "+i);
}
if(WQA(i,"div.name").length<10){
D.retry[i]++;
continue;
}
var a=WQA(i,".s_elite3");
var n=a.length;
for(var j=0;j<n;j++){
var r=a[j].parentElement.previousElementSibling.textContent.replace(/^\s+|\s+$/g,"");
D.stk.push(r);
console.log(r);
}
WR(i);
D.retry[i]=0;
}
}
var B=function(){
if(D.is==0){
if(D.stk.length!=0){
var s=D.stk[D.stk.length-1];
D.res=s+" ";
S("!test!\n\n"+s,0);
D.is=1;
}
else{
S("",0);
}
}
else{
var a=WQA(0,"span.u");
var n=a.length;
if(n)if(a[n-1].textContent.search(/实力评估中...[1-9][1-9]%/)!=-1) {
D.res+=WQA(0,"span.u")[10].textContent.split(" ")[2]+"\n";
D.is=0;
D.stk.pop();
D.res_all+=D.res;
Q(".result").value=D.res_all;
}
}
}
var tsi,bsi,asi;
function start(){
D.max_window=Q(".max_window").value;
D.prefix=Q(".prefix").value;
D.suffix=Q(".suffix").value;
D.team=Q(".team").value;
D.delay=Q(".delay").value;
D.mode=Q(".mode").value;
D.threshold=Q(".threshold").value;
D.upgrade=Q(".upgrade").checked;
Q(".start").disabled=true;
for(var i=0;i<=D.max_window;i++){//start window
var NW = document.createElement('iframe');
NW.src="https://wengesvip.github.io/namerena.github.io";
NW.hidden=true;
document.body.appendChild(NW);
}
setTimeout(function(){ R();tsi=setInterval(function(){T()},Q(".delay").value);bsi=setInterval(function(){B()},5000); },10000);
/*if(document.querySelector(".autosave").checked==true){
setTimeout(function(){ asi=setInterval(function(){save()},10*60*1000) },10*60*1000);
}*/
}
function save(){
var data=result_all;
var name=((new Date()).toLocaleDateString() + (new Date()).toLocaleTimeString()).replace(/ *[:\/]/g,"_")+".txt";
var urlObject = window.URL || window.webkitURL || window;
var export_blob = new Blob([data]);
var save_link = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
save_link.href = urlObject.createObjectURL(export_blob);
save_link.download = name;
var ev = document.createEvent("MouseEvents");
ev.initMouseEvent("click", true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
save_link.dispatchEvent(ev);
}
</script>
</head>
<body>
<div class="main">
<div class="w300 settings">
<div class="a100">战队<input type="text" class="team" value="战队名"></input></div>
<div class="a100">前缀<input type="text" class="prefix" value="前缀"></input></div>
<div class="a100">后缀<input type="text" class="suffix" value=""></input></div>
<div class="a100">模式
<select class="mode">
<option value="hanzi">3个随机汉字(可能有bug)</option>
<option selected="selected" value="digit">从0开始的数字</option>
<option value="alnum">随机的8个数字和大写字母(可能有bug)</option>
</select>
</div>
<div><input type="checkbox" class="elite2" value="elite2">评测2级号(暂未更新)</input></div>
<div><input type="checkbox" class="upgrade" value="upgrade">将普评替换为强评(暂时无效)</input></div>
<div><input type="checkbox" class="autosave" value="autosave">每隔10分钟自动下载结果(暂时无效)</input></div>
</div>
<div style="float:left;margin:10px;margin-top: 20px;width: 1px;height: 90%; background: darkgray;"></div>
<div class="w300 settings">
<div class="a100">多开(1-16)<input type="text" class="max_window" value="2"></input></div>
<div class="a100">最低评分(暂时无效)<input type="text" class="threshold" value="6000"></input></div>
<div class="a100">检查时间(ms)<input type="text" class="delay" value="100"></input></div>
</div>
<div style="float:left;margin:10px;margin-top: 20px;width: 1px;height: 90%; background: darkgray;"></div>
<div class="w300 res">
<button onclick="start()" class="start">开始</button>
<div class="a100">测号计数<input type="text" class="tested" value="0" readonly></input></div>
<div class="a100">结果</div>
<button onclick="save()" class="save">下载结果</button>
<textarea class="result" placeholder="结果将会显示在这里" readonly></textarea>
</div>
</div>
</html>