parent
5d5f31d295
commit
2f4ffde916
|
@ -80,8 +80,23 @@ function draw(json) {
|
|||
if (json == null)
|
||||
return;
|
||||
|
||||
// pre-filter by chosen protocol range
|
||||
var tmp = master.proto_range ? JSON.parse(master.proto_range) : null;
|
||||
if (tmp) {
|
||||
json = {
|
||||
list: json.list.filter(function(server) {
|
||||
return !(tmp[0] > server.proto_max || tmp[1] < server.proto_min);
|
||||
}),
|
||||
total: {clients: 0},
|
||||
total_max: {clients: "?", servers: "?"}
|
||||
};
|
||||
json.list.forEach(function(server) { json.total.clients += server.clients; });
|
||||
json.total.servers = json.list.length;
|
||||
}
|
||||
|
||||
var html = window.render.servers(json);
|
||||
jQuery(master.output).html(html);
|
||||
|
||||
jQuery('.proto_select', master.output).on('change', function(e) {
|
||||
master.proto_range = e.target.value;
|
||||
draw(master.cached_json); // re-render
|
||||
|
@ -110,6 +125,6 @@ toast(master.root + 'style.css', master.root + 'servers.js', function() {
|
|||
if (typeof(jQuery) != 'undefined')
|
||||
return loaded();
|
||||
else
|
||||
toast('//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', loaded);
|
||||
toast('//ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js', loaded);
|
||||
});
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
, Protocol: <select class="proto_select">
|
||||
<option value="">All</option>
|
||||
<option value="[11,32]" {{? master.proto_range=='[11,32]'}}selected{{?}}>11-32 (Minetest 0.4)</option>
|
||||
<option value="[37,99]" {{? master.proto_range=='[37,99]'}}selected{{?}}>37 (Minetest 5.0)</option>
|
||||
<option value="[37,99]" {{? master.proto_range=='[37,99]'}}selected{{?}}>37+ (Minetest 5.x)</option>
|
||||
</select>{{?}}
|
||||
</div>
|
||||
{{?}}
|
||||
|
@ -24,11 +24,9 @@
|
|||
{{? !master.no_ping}}<th>Ping, Lag</th>{{?}}
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
{{ var tmp = master.proto_range ? JSON.parse(master.proto_range) : null;}}
|
||||
{{~it.list :server:index}}
|
||||
{{ if (master.limit && index + 1 > master.limit) break;}}
|
||||
{{ if (master.min_clients && server.clients < master.min_clients) continue;}}
|
||||
{{ if (tmp && (tmp[0] > server.proto_max || tmp[1] < server.proto_min)) continue;}}
|
||||
<tr>
|
||||
{{? !master.no_address}}
|
||||
<td class="address">
|
||||
|
|
Loading…
Reference in New Issue