Masterserver fixes
parent
4a8a50a2a2
commit
cf0786dc9d
|
@ -1,10 +1,10 @@
|
||||||
var master;
|
var master;
|
||||||
if (!master) {
|
if (!master) master = {};
|
||||||
master = {
|
if (typeof(master.root)=='undefined') master.root = "http://servers.minetest.net/";
|
||||||
url: "http://servers.minetest.net/list",
|
if (!master.output) master.output = '#server_list';
|
||||||
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) {
|
function humanTime(seconds) {
|
||||||
if (!seconds) return '?';
|
if (!seconds) return '?';
|
||||||
|
@ -63,13 +63,21 @@ function hoverList(name, list) {
|
||||||
return str + '</div>';
|
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) {
|
function draw(json) {
|
||||||
html = window.render.servers(json);
|
html = window.render.servers(json);
|
||||||
jQuery(master.output || '#server_list').html(html);
|
jQuery(master.output).html(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get() {
|
function get() {
|
||||||
jQuery.getJSON(master.url, draw);
|
jQuery.getJSON(master.list_url, draw);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loaded(){
|
function loaded(){
|
||||||
|
@ -82,7 +90,7 @@ function loaded(){
|
||||||
// https://github.com/pyrsmk/toast
|
// 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)};
|
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')
|
if (typeof(jQuery)!='undefined')
|
||||||
loaded();
|
loaded();
|
||||||
else
|
else
|
||||||
|
|
|
@ -47,7 +47,8 @@
|
||||||
{{=tooltipString(server.description, 50)}}
|
{{=tooltipString(server.description, 50)}}
|
||||||
</td>{{?}}
|
</td>{{?}}
|
||||||
{{? !master.no_flags}}
|
{{? !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.creative ? 'Cre ' : ''}}
|
||||||
{{=server.dedicated ? 'Ded ' : ''}}
|
{{=server.dedicated ? 'Ded ' : ''}}
|
||||||
{{=server.damage ? 'Dmg ' : ''}}
|
{{=server.damage ? 'Dmg ' : ''}}
|
||||||
|
|
Loading…
Reference in New Issue