forked from binarymaster/3WiFi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ranges.html
103 lines (100 loc) · 3.16 KB
/
ranges.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
<title>%l10n_title_ranges%</title>
<head>
<script type="text/javascript">
function find()
{
var formdata = $($('form')[0]).serialize();
$('input').prop('disabled', true);
$('button').prop('disabled', true);
$('#tranges').css('display', 'none');
$('#fdata').empty();
$('#fhead').empty();
$('#fhead').append('<tr><th>%l10n_tbl_iprange%</th><th>%l10n_tbl_netname%</th><th>%l10n_tbl_netdesc%</th><th>%l10n_tbl_country%</th></tr>');
$('#fdata').append('<tr><td colspan=4><img src="img/loading.gif"></td></tr>');
$.post('3wifi.php?a=ranges', formdata, function(d)
{
$('input').prop('disabled', false);
$('button').prop('disabled', false);
if (!d.result)
{
$('#fdata > tr:first-child > :first-child').text('%l10n_err_data%.');
return;
}
if (!d.auth)
{
$('#fdata > tr:first-child > :first-child').text('%l10n_err_unauthorized%.');
return;
}
if(typeof d.error != "undefined")
{
$('#fdata > tr:first-child > :first-child').text(errorStr(d.error));
return;
}
if (d.data.length > 0)
{
$('#fdata').empty();
$('#fhead').empty();
$('#fhead').append('<tr><th>%l10n_tbl_iprange%</th><th>%l10n_tbl_netname%</th><th>%l10n_tbl_netdesc%</th><th>%l10n_tbl_country%</th></tr>');
for (var i = 0; i < d.data.length; i++)
{
$('#fdata').append('<tr><td>'+d.data[i].range+'</td><td>'+d.data[i].netname+'</td><td>'+
d.data[i].descr+'</td><td>'+d.data[i].country+'</td></tr>');
}
} else {
$('#fdata > tr:first-child > :first-child').text('%l10n_find_not_found%.');
}
}).fail(function(jqXHR, textStatus, errorThrown) {
$('#fdata > tr:first-child > :first-child').text('%l10n_err_data%.');
$('input').prop('disabled', false);
$('button').prop('disabled', false);
});
}
function rangesText()
{
var data = $('#fdata > tr > :first-child');
var str = '';
for (var i = 0; i < data.length; i++)
{
var td = $(data[i]);
if (td.prop('colspan') == 4) continue;
str += td.text()+"\r\n";
}
return str;
}
function listRanges()
{
var str = rangesText();
if (str == '') {
$('#tranges').css('display', 'none');
return;
}
$('#tranges').val(str);
$('#tranges').css('display', 'block');
}
function initpage()
{
$('.content').css('padding-top', '0px');
}
</script>
</head>
<body>
<p>%l10n_msg_ranges%</p>
<form id=frangesform enctype="multipart/form-data" method="POST" onsubmit="find(); return false">
<table>
<tbody>
<tr><td>%l10n_str_lat%</td><td><input name="latitude" type="number" min="-90" max="90" step="0.00000001" value="%var_lat%" /></td><td>° [-90; 90]</td></tr>
<tr><td>%l10n_str_lon%</td><td><input name="longitude" type="number" min="-180" max="180" step="0.00000001" value="%var_lon%" /></td><td>° [-180; 180]</td></tr>
<tr><td>%l10n_str_radius%</td><td><input name="radius" type="number" min="0" max="25" step="0.1" value="%var_rad%" /></td><td>%l10n_ranges_radius_max%</td></tr>
</tbody>
<tbody>
<tr><td><input type=submit value="%l10n_btn_find%" /> <button onclick="listRanges(); return false">%l10n_btn_getlist%</button></td><td></td></tr>
</tbody>
</table>
</form>
<textarea id=tranges cols=24 rows=8 style="display: none"></textarea>
<br>
<table class=st1>
<tbody id=fhead></tbody>
<tbody id=fdata></tbody>
</table>
</body>