forked from binarymaster/3WiFi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
365 lines (357 loc) · 11.4 KB
/
index.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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<html>
<head>
<title>%title%</title>
<meta http-equiv=Content-Type content="text/html;charset=UTF-8">
<meta name="keywords" content="3wifi, wifi, router, scan, Router Scan, access point, map, internet, free"/>
<link rel=stylesheet href="%theme_css%" type="text/css">
<style type="text/css">
body { margin: 0px }
</style>
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript">
function isMobile()
{
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
|| navigator.userAgent.match(/Mobile/i))
{
return true;
}
if(window.innerWidth <= 800 && window.innerHeight <= 600)
{
return true;
}
return false;
}
function errorStr(error)
{
switch (error)
{
case 'database':
return '%l10n_err_database%';
case 'loggedin':
return '%l10n_err_loggedin%';
case 'unauthorized':
return '%l10n_err_unauthorized%';
case 'loginfail':
return '%l10n_err_loginfail%';
case 'form':
return '%l10n_err_form%';
case 'invite':
return '%l10n_err_invite%';
case 'login':
return '%l10n_err_login%';
case 'nick':
return '%l10n_err_nick%';
case 'password':
return '%l10n_err_password%';
case 'lowlevel':
return '%l10n_err_lowlevel%';
case 'limit':
return '%l10n_err_limit%';
case 'token':
return '%l10n_err_token%';
case 'notfound':
return '%l10n_err_notfound%';
default:
return '%l10n_err_unknown%';
}
}
function showModal(frm)
{
$('#win_login').css({left: '-9999px'});
$('#win_reg').css({left: '-9999px'});
$('#win_newpass').css({left: '-9999px'});
$(frm).css({left: '50%'});
$(frm).css({top: '50%'});
$('.modal').show();
$('.modal').animate({opacity: 1}, 250);
}
function hideModal()
{
$('.modal').animate({opacity: 0}, 250, function() { $('.modal').hide() });
}
function showFrm(frm)
{
var frm2 = (frm == '#win_login' ? '#win_reg' : '#win_login')
switch (Math.round(Math.random()*3))
{
case 0: // right to left
$(frm).css({left: '150%'});
$(frm).css({top: '50%'});
$(frm2).animate({left: '-50%'}, 500);
$(frm).animate({left: '50%'}, 500);
break;
case 1: // left to right
$(frm).css({left: '-50%'});
$(frm).css({top: '50%'});
$(frm2).animate({left: '150%'}, 500);
$(frm).animate({left: '50%'}, 500);
break;
case 2: // bottom to top
$(frm).css({left: '50%'});
$(frm).css({top: '150%'});
$(frm2).animate({top: '-50%'}, 500);
$(frm).animate({top: '50%'}, 500);
break;
case 3: // top to bottom
$(frm).css({left: '50%'});
$(frm).css({top: '-50%'});
$(frm2).animate({top: '150%'}, 500);
$(frm).animate({top: '50%'}, 500);
break;
}
}
function doLogin()
{
var formdata = $('#frm_login').serialize();
$('#frm_login :input').prop('disabled', true);
$('#loginstat').html('<img src="img/loading.gif">');
$.post('user.php?a=login', formdata, function(json)
{
if (json.result)
{
$('#loginstat').html('<img src="img/ok.png" style="position: relative; top: 3px"> %l10n_login_ok%');
setTimeout($('#stayhere').prop('checked') ? 'window.location.reload();' : 'window.location.href = \'user\';', 1000);
}
else
{
var errstr = (typeof json.error == 'string' ? json.error : '');
$('#loginstat').html('<img src="img/no.png" style="position: relative; top: 3px"> ' + errorStr(errstr));
$('#frm_login :input').prop('disabled', false);
}
});
}
function doLogout()
{
var onFail = function(jqXHR, textStatus, errorThrown)
{
alert('%l10n_err_data%');
};
$.get('user.php?a=token', function(json)
{
if (!json.result)
{
alert(errorStr(json.error));
return;
} else {
var data = '';
data += '&token=' + encodeURIComponent(json.token);
$.get('user.php?a=logout' + data, function(json)
{
window.location.href = 'home';
});
}
}).fail(onFail);
}
function doReg()
{
var formdata = $('#frm_reg').serialize();
$('#frm_reg :input').prop('disabled', true);
$('#regstat').html('<img src="img/loading.gif">');
$.post('user.php?a=reg', formdata, function(json)
{
if (json.result)
{
$('#checkinv').empty();
$('#regstat').html('<img src="img/ok.png" style="position: relative; top: 3px"> %l10n_reg_ok%');
setTimeout('window.location.href = \'user\';', 2000);
}
else
{
var errstr = (typeof json.error == 'string' ? json.error : '');
$('#regstat').html('<img src="img/no.png" style="position: relative; top: 3px"> ' + errorStr(errstr));
if (errstr == 'invite') $('#checkinv').html('<img src="img/no.png">');
$('#frm_reg :input').prop('disabled', false);
}
});
}
function loginBtn()
{
if (ProfileInfo.isUser == 0)
{
showModal('#win_login');
} else {
doLogout();
}
}
var ProfileInfo = {%profile%};
function initmenu()
{
if (ProfileInfo.isUser == 0) $('a[href=user]').hide();
if(!isMobile())
{
$('.multi').mouseenter(function()
{
$(this.children[1]).show();
}).mouseleave(function()
{
$(this.children[1]).hide();
});
}
else
{
$('.multi').click(function()
{
if(!this.children[1].isDoubleTap)
{
this.children[1].isDoubleTap = true;
$(this.children[1]).show();
return false;
}
$(this.children[1]).hide();
this.children[1].isDoubleTap = false;
return true;
});
}
$('#frm_login :input').keydown(function(e) { if (e.keyCode==13) doLogin(); });
$('#frm_reg :input').keydown(function(e) { if (e.keyCode==13) doReg(); });
$('#frm_newpass :input').keydown(function(e) { if (e.keyCode==13) changePassword(); });
$('#frm_reg :input[name=invite]').keyup(function(e) { $('#checkinv').empty(); });
var reglog = $('#frm_reg :input[name=login]');
reglog.keyup(function(e)
{
var chk = reglog.val();
if (chk == '')
{
$('#checklogin').empty();
return;
}
$.post('user.php?a=checklogin', 'invite='+encodeURIComponent($('#frm_reg :input[name=invite]').val())+'&login='+encodeURIComponent(chk), function(json)
{
if (json.error == 'invite')
{
$('#checkinv').html('<img src="img/no.png">');
}
else
{
$('#checkinv').empty();
$('#checklogin').html('<img src="img/'+(json.result ? 'ok' : 'no')+'.png">');
}
});
});
var regnick = $('#frm_reg :input[name=nick]');
regnick.keyup(function(e)
{
var chk = regnick.val();
if (chk == '')
{
$('#checknick').empty();
return;
}
$.post('user.php?a=checknick', 'invite='+encodeURIComponent($('#frm_reg :input[name=invite]').val())+'&nick='+encodeURIComponent(chk), function(json)
{
if (json.error == 'invite')
{
$('#checkinv').html('<img src="img/no.png">');
}
else
{
$('#checkinv').empty();
$('#checknick').html('<img src="img/'+(json.result ? 'ok' : 'no')+'.png">');
}
});
});
var regpass = $('#frm_reg :input[name=password]');
regpass.keyup(function(e)
{
var chk = regpass.val();
$('#checkpass').html(chk == '' ? '' : '<img src="img/'+(chk.length < 6 || chk.length > 100 ? 'no' : 'ok')+'.png">');
});
}
</script>
%head%
</head>
<body onload="initmenu(); initpage()">
<div class=header>
%theme_head%
<div class=mainmenu>
<a href="home"><img class=menulogo src="img/logo.png"></a>
<div class="menubtn logoplace"><p></p></div>
<span class=multi>
<a href="home"><div class="%chk_docs%"><p>%l10n_menu_about%</p></div></a>
<span class=submenu>
<a href="home"><div class="%chk_home%"><p>%l10n_menu_home%</p></div></a>
<a href="faq"><div class="%chk_faq%"><p>%l10n_menu_faq%</p></div></a>
<a href="apidoc"><div class="%chk_apidoc%"><p>%l10n_menu_api%</p></div></a>
<a href="rules"><div class="%chk_rul%"><p>%l10n_menu_rules%</p></div></a>
</span>
</span>
<a href="map"><div class="%chk_map%"><p>%l10n_menu_map%</p></div></a>
<a href="find"><div class="%chk_find%"><p>%l10n_menu_find%</p></div></a>
<span class=multi>
<a href="ranges"><div class="%chk_tool%"><p>%l10n_menu_tools%</p></div></a>
<span class=submenu>
<a href="ranges"><div class="%chk_rang%"><p>%l10n_menu_ranges%</p></div></a>
<a href="devmac"><div class="%chk_dev%"><p>%l10n_menu_devmac%</p></div></a>
<a href="wpspin"><div class="%chk_wps%"><p>%l10n_menu_wpspin%</p></div></a>
</span>
</span>
<a href="upload"><div class="%chk_load%"><p>%l10n_menu_upload%</p></div></a>
<span class=multi>
<a href="stat"><div class="%chk_st%"><p>%l10n_menu_state%</p></div></a>
<span class=submenu>
<a href="stat"><div class="%chk_stat%"><p>%l10n_menu_stats%</p></div></a>
<a href="graph"><div class="%chk_grph%"><p>%l10n_menu_dynamic%</p></div></a>
</span>
</span>
<a href="javascript://" onclick="loginBtn()" style="float: right"><div class=menubtn><p>%login_str%</p></div></a>
<a href="user"><div class="%chk_user%" style="float: right" id=nickname><p>%nick%</p></div></a>
</div>
</div>
%broadcast%
<div class=content>%content%</div>
<div class=footer>© 2015-2017 akokarev, binarymaster, Felis-Sapiens, Fusix</div>
<div class=modal>
<div class=modal_bkg onclick="hideModal()"></div>
<div class=modal_cnt align=center id=win_login>
<div class=modal_main>
<div class=modal_div>
<h2>%l10n_msg_login%</h2>
<form id=frm_login method=post><table>
<tr><td>%l10n_str_login%</td><td><input type=text name=login></td></tr>
<tr><td>%l10n_str_pass%</td><td><input type=password name=password></td></tr>
<tr><td colspan=2 align=center style="font-size: 13px"><input type=checkbox id=stayhere style="vertical-align: middle; margin: 0 5 3 0"><label for=stayhere>%l10n_str_stay_here%</label></td></tr>
<tr><td colspan=2 align=center id=loginstat style="font-size: 13px; padding-top: 0px"></td></tr>
<tr><td><input type=button value="%l10n_btn_login%" onclick="doLogin()"></td><td align=right><a href="javascript://" onclick="showFrm('#win_reg')">%l10n_str_reg%</a></td></tr>
</table></form>
</div>
</div>
</div>
<div class=modal_cnt align=center id=win_reg>
<div class=modal_main>
<div class=modal_div>
<h2>%l10n_msg_reg%</h2>
<form id=frm_reg method=post><table>
<tr><td>%l10n_str_invite%</td><td><input type=text name=invite></td><td id=checkinv></td></tr>
<tr><td>%l10n_str_login%</td><td><input type=text name=login></td><td id=checklogin></td></tr>
<tr><td>%l10n_str_nick%</td><td><input type=text name=nick></td><td id=checknick></td></tr>
<tr><td>%l10n_str_pass%</td><td><input type=password name=password></td><td id=checkpass></td></tr>
<tr><td align=right><input type=checkbox onclick="$('#frm_reg').find('input[type=button]').prop('disabled', !this.checked)"></td><td style="font-size: 12px">%l10n_str_accept_rules%</td></tr>
<tr><td colspan=2 align=center id=regstat style="font-size: 13px; padding-top: 0px"></td></tr>
<tr><td><input type=button value="%l10n_btn_reg%" onclick="doReg()" disabled></td><td align=right><a href="javascript://" onclick="showFrm('#win_login')">%l10n_str_has_login%</a></td></tr>
</table></form>
</div>
</div>
</div>
<div class=modal_cnt align=center id=win_newpass>
<div class=modal_main>
<div class=modal_div>
<h2>%l10n_msg_chpass%</h2>
<form id=frm_newpass method=post><table>
<tr><td>%l10n_str_pass%</td><td><input type=password name=password></td></tr>
<tr><td>%l10n_str_pass_rep%</td><td><input type=password name=password2></td></tr>
<tr><td colspan=2 align=center id=regstat style="font-size: 13px; padding-top: 0px"></td></tr>
<tr><td><input type=button value="%l10n_btn_chpass%" onclick="changePassword()"></td></tr>
</table></form>
</div>
</div>
</div>
</div>
</body>
</html>