diff options
author | proller <proler@github.com> | 2013-11-04 12:59:55 +0400 |
---|---|---|
committer | proller <proler@github.com> | 2013-11-04 13:02:42 +0400 |
commit | cf0786dc9d3e900692b54d2654fc8f298600f3bd (patch) | |
tree | 53876ca92cad1cf3b63002d29167c04aa764e3ca | |
parent | 4a8a50a2a22e9a87089b817f966bf5270eb4bc2f (diff) | |
download | minetest-cf0786dc9d3e900692b54d2654fc8f298600f3bd.tar.gz minetest-cf0786dc9d3e900692b54d2654fc8f298600f3bd.tar.bz2 minetest-cf0786dc9d3e900692b54d2654fc8f298600f3bd.zip |
Masterserver fixes
-rw-r--r-- | util/master/list.js | 26 | ||||
-rw-r--r-- | util/master/servers.jst | 3 |
2 files changed, 19 insertions, 10 deletions
diff --git a/util/master/list.js b/util/master/list.js index a47111342..2a831a268 100644 --- a/util/master/list.js +++ b/util/master/list.js @@ -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 diff --git a/util/master/servers.jst b/util/master/servers.jst index 5031f083d..bf4a4bf54 100644 --- a/util/master/servers.jst +++ b/util/master/servers.jst @@ -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 ' : ''}} |