-
Notifications
You must be signed in to change notification settings - Fork 89
/
stat.html
175 lines (170 loc) · 5.34 KB
/
stat.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
<title>%l10n_title_stat%</title>
<head>
<script type="text/javascript">
function appendRow(rowid, idx, p1, p2, tt, of, th)
{
var td1 = $((th ? '<th>' : '<td>')).text(p1);
var td2 = $((th ? '<th>' : '<td>')).text(p2);
if (tt) td2.css('font-family', 'monospace');
if (of && (p2.length > 64))
{
td2.css('max-width', '700px');
td2.css('overflow-x', 'scroll');
}
var tr = $('<tr>');
tr.append(td1);
tr.append(td2);
$('#'+rowid).append(tr);
}
function parsestat(st, d)
{
if(!d.stat.data) return;
if (typeof d.stat.date == "string")
$('#stat_cap').text('%l10n_stat_caption% '+d.stat.date+' UTC.');
if (typeof d.stat.top == 'number')
{
$('#sttot').text('('+d.stat.total+')');
$('#stcnt').text('(%l10n_str_top%'+d.stat.top+')');
} else {
var total = 0;
for (var i = 0; i < d.stat.data.length; i++)
{
total += d.stat.data[i][0];
}
$('#sttot').text('('+total+')');
$('#stcnt').text('('+d.stat.data.length+')');
}
var tt = (st == 'stbss' || st == 'stwps');
var of = (st == 'stauth');
for (var i = 0; i < d.stat.data.length; i++)
{
appendRow('stat', i, d.stat.data[i][0], d.stat.data[i][1], tt, of);
}
}
function loadstat(e, st)
{
if (stLoading) return;
recheckCoordsLock();
stLoading = true;
$('td#stat_es').removeClass('stat_sel');
$(e).addClass('stat_sel');
$('.st1').show();
$('#stval').text('%l10n_stat_loading%');
$('#sttot').empty();
$('#stcnt').empty();
$('#stat').html('<tr><td></td><td><img src="img/loading.gif"></td></tr>');
$.get('3wifi.php?a=' + st, function(d)
{
stLoading = false;
if (d.result)
{
$('#stat').empty();
switch (st)
{
case 'stat':
$('#stat_cap').text('%l10n_stat_caption% '+d.stat.date+' UTC.');
$('#stval').text('%l10n_tbl_summary%');
appendRow('stat', 0, d.stat.total, '%l10n_tbl_total%');
appendRow('stat', 1, d.stat.bssids, '%l10n_tbl_with_bssid%');
appendRow('stat', 2, d.stat.uniqbss, '%l10n_tbl_uniq_bssid%');
appendRow('stat', 3, d.stat.onmap, '%l10n_tbl_on_map%');
appendRow('stat', 4, '%l10n_tbl_count%', '%l10n_tbl_task_state%', false, false, true);
appendRow('stat', 5, d.stat.tasks.uploading, '%l10n_tbl_task_load%', true);
appendRow('stat', 6, d.stat.tasks.processing, '%l10n_tbl_task_proc%', true);
if (d.stat.tasks.comment != null)
appendRow('stat', 7, '✓', '%l10n_tbl_task_now% ' + d.stat.tasks.comment + '', true);
appendRow('stat', 8, d.stat.geoloc, '%l10n_tbl_task_geo%', true);
break;
case 'stcmt':
$('#stval').text('%l10n_stat_comments%');
parsestat(st, d);
break;
case 'stdev':
$('#stval').text('%l10n_stat_devices_cap%');
parsestat(st, d);
break;
case 'stport':
$('#stval').text('%l10n_stat_ports%');
parsestat(st, d);
break;
case 'stauth':
$('#stval').text('%l10n_stat_auth_cap%');
parsestat(st, d);
break;
case 'stbss':
$('#stval').text('%l10n_stat_bssids_cap%');
parsestat(st, d);
break;
case 'stess':
$('#stval').text('%l10n_stat_essids_cap%');
parsestat(st, d);
break;
case 'stsec':
$('#stval').text('%l10n_stat_security_cap%');
parsestat(st, d);
break;
case 'stkey':
$('#stval').text('%l10n_stat_wifikey_cap%');
parsestat(st, d);
break;
case 'stwps':
$('#stval').text('%l10n_stat_wpspin_cap%');
parsestat(st, d);
break;
case 'stdns':
$('#stval').text('%l10n_stat_dns_cap%');
parsestat(st, d);
break;
case 'stsid':
$('#stval').text('%l10n_stat_users_cap%');
parsestat(st, d);
break;
}
} else {
$('#stval').text('%l10n_no_data%');
$('#stat > tr > :nth-child(2)').text('%l10n_err_data%.');
}
}).fail(function(jqXHR, textStatus, errorThrown) {
$('#stval').text('%l10n_no_data%');
$('#stat > tr > :nth-child(2)').text('%l10n_err_data%.');
stLoading = false;
});
}
function delCoordCallback()
{
}
function initpage()
{
stLoading = false;
$('td#stat_es')[0].click();
}
</script>
</head>
<body>
<h2 align=center><span class=header_cap id=stat_cap>%l10n_msg_stat%</span></h2>
<noscript>%l10n_msg_nojs%</noscript>
<table class=st2 cellspacing=0>
<tr><td id=stat_es onclick="loadstat(this,'stat')" class=first>%l10n_stat_summary%</td>
<td rowspan=13 id=stat_cn>
<span class=coordlock></span>
<table class=st1 style="display: none;">
<tbody>
<tr><th>%l10n_tbl_count% <span id=sttot></span></th><th><span id=stval>%l10n_tbl_value%</span> <span id=stcnt></span></th></tr>
</tbody>
<tbody id=stat></tbody>
</table>
</td></tr>
<tr><td id=stat_es onclick="loadstat(this,'stcmt')">%l10n_stat_comments%</td></tr>
<tr><td id=stat_es onclick="loadstat(this,'stdev')">%l10n_stat_devices%</td></tr>
<tr><td id=stat_es onclick="loadstat(this,'stport')">%l10n_stat_ports%</td></tr>
<tr><td id=stat_es onclick="loadstat(this,'stauth')">%l10n_stat_auth%</td></tr>
<tr><td id=stat_es onclick="loadstat(this,'stbss')">%l10n_stat_bssids%</td></tr>
<tr><td id=stat_es onclick="loadstat(this,'stess')">%l10n_stat_essids%</td></tr>
<tr><td id=stat_es onclick="loadstat(this,'stsec')">%l10n_stat_security%</td></tr>
<tr><td id=stat_es onclick="loadstat(this,'stkey')">%l10n_stat_wifikey%</td></tr>
<tr><td id=stat_es onclick="loadstat(this,'stwps')">%l10n_stat_wpspin%</td></tr>
<tr><td id=stat_es onclick="loadstat(this,'stdns')">%l10n_stat_dns%</td></tr>
<tr><td id=stat_es class=last onclick="loadstat(this,'stsid')">%l10n_stat_users%</td></tr>
<tr><td id=stat_ft> </td></tr>
</table>
</body>