mirror of
https://github.com/moparisthebest/minetest
synced 2024-11-05 00:45:05 -05:00
Masterserver fixes
This commit is contained in:
parent
4a8a50a2a2
commit
cf0786dc9d
@ -1,10 +1,10 @@
|
||||
var master;
|
||||
if (!master) {
|
||||
master = {
|
||||
url: "http://servers.minetest.net/list",
|
||||
output: "#server_list"
|
||||
};
|
||||
}
|
||||
if (!master) master = {};
|
||||
if (typeof(master.root)=='undefined') master.root = "http://servers.minetest.net/";
|
||||
if (!master.output) master.output = '#server_list';
|
||||
if (!master.list) master.list = "list";
|
||||
if (!master.list_root) master.list_root = master.root;
|
||||
if (!master.list_url) master.list_url = master.list_root + master.list;
|
||||
|
||||
function humanTime(seconds) {
|
||||
if (!seconds) return '?';
|
||||
@ -63,13 +63,21 @@ function hoverList(name, list) {
|
||||
return str + '</div>';
|
||||
}
|
||||
|
||||
function hoverString(name, string) {
|
||||
if (!string) return '';
|
||||
return '<div class="mts_hover_list">'
|
||||
+ name + ':<br />'
|
||||
+ escapeHTML(string) + '<br />'
|
||||
+ '</div>';
|
||||
}
|
||||
|
||||
function draw(json) {
|
||||
html = window.render.servers(json);
|
||||
jQuery(master.output || '#server_list').html(html);
|
||||
jQuery(master.output).html(html);
|
||||
}
|
||||
|
||||
function get() {
|
||||
jQuery.getJSON(master.url, draw);
|
||||
jQuery.getJSON(master.list_url, draw);
|
||||
}
|
||||
|
||||
function loaded(){
|
||||
@ -82,7 +90,7 @@ function loaded(){
|
||||
// https://github.com/pyrsmk/toast
|
||||
this.toast=function(){var e=document,t=e.getElementsByTagName("head")[0],n=this.setTimeout,r="createElement",i="appendChild",s="addEventListener",o="onreadystatechange",u="styleSheet",a=10,f=0,l=function(){--f},c,h=function(e,r,i,s){if(!t)n(function(){h(e)},a);else if(e.length){c=-1;while(i=e[++c]){if((s=typeof i)=="function"){r=function(){return i(),!0};break}if(s=="string")p(i);else if(i.pop){p(i[0]),r=i[1];break}}d(r,Array.prototype.slice.call(e,c+1))}},p=function(n,s){++f,/\.css$/.test(n)?(s=e[r]("link"),s.rel=u,s.href=n,t[i](s),v(s)):(s=e[r]("script"),s.src=n,t[i](s),s[o]===null?s[o]=m:s.onload=l)},d=function(e,t){if(!f)if(!e||e()){h(t);return}n(function(){d(e,t)},a)},v=function(e){if(e.sheet||e[u]){l();return}n(function(){v(e)},a)},m=function(){/ded|co/.test(this.readyState)&&l()};h(arguments)};
|
||||
|
||||
toast('style.css', 'servers.js', function() {
|
||||
toast(master.root+'style.css', master.root+'servers.js', function() {
|
||||
if (typeof(jQuery)!='undefined')
|
||||
loaded();
|
||||
else
|
||||
|
@ -47,7 +47,8 @@
|
||||
{{=tooltipString(server.description, 50)}}
|
||||
</td>{{?}}
|
||||
{{? !master.no_flags}}
|
||||
<td class="flags" {{? server.privs}}title="{{=escapeHTML(server.privs)}}"{{?}}>
|
||||
<td class="flags {{? server.privs}} mts_hover_list_text{{?}}">
|
||||
{{=hoverString("Privs", server.privs)}}
|
||||
{{=server.creative ? 'Cre ' : ''}}
|
||||
{{=server.dedicated ? 'Ded ' : ''}}
|
||||
{{=server.damage ? 'Dmg ' : ''}}
|
||||
|
Loading…
Reference in New Issue
Block a user