aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorproller <proller@github.com>2013-04-11 20:18:34 +0400
committerproller <proller@github.com>2013-04-11 20:20:11 +0400
commit17cfb1850d35148b9e2445dfdd160a164d02ebf9 (patch)
tree12719cd90817ad0d34b7192da7db2f94070ecd6d
parente7f5cdf9d4cbe17a2a42015e072a791659b3886b (diff)
downloadminetest-17cfb1850d35148b9e2445dfdd160a164d02ebf9.tar.gz
minetest-17cfb1850d35148b9e2445dfdd160a164d02ebf9.tar.bz2
minetest-17cfb1850d35148b9e2445dfdd160a164d02ebf9.zip
Fix masterserver javascript: adjustable output id
-rw-r--r--util/master/index.html2
-rw-r--r--util/master/list.js7
2 files changed, 5 insertions, 4 deletions
diff --git a/util/master/index.html b/util/master/index.html
index 63ee5c70f..328dd8934 100644
--- a/util/master/index.html
+++ b/util/master/index.html
@@ -5,7 +5,7 @@
<title>Minetest server list</title>
<link rel="stylesheet" href="style.css"/>
</head>
- <body><div id="table"></div></body>
+ <body><div id="servers_table"></div></body>
</html>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="list.js"></script>
diff --git a/util/master/list.js b/util/master/list.js
index 990bb6ded..98f5ad490 100644
--- a/util/master/list.js
+++ b/util/master/list.js
@@ -1,3 +1,5 @@
+var master_root, output_to;
+
function e(s) {
if (typeof s === "undefined") s = '';
return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;'); //mc"
@@ -39,7 +41,7 @@ function human_time(t, abs) {
function success(r) {
if (!r || !r.list) return;
- var h = '<table class="mts_table"><tr class="mts_head"><th>ip[:port]</th><th>clients/max</th><th>version gameid</th><th>name</th><th>desc</th><th>flags</th><th>uptime</th><th>ping</th></tr>';
+ var h = '<table class="mts_table"><tr class="mts_head"><th>ip[:port]</th><th>clients/max</th><th>version gameid</th><th>name</th><th>description</th><th>flags</th><th>uptime</th><th>ping</th></tr>';
for (var i = 0; i < r.list.length; ++i) {
var s = r.list[i];
if (!s) continue;
@@ -60,9 +62,8 @@ function success(r) {
h += '</tr>';
}
h += '</table>'
- jQuery('#table').html(h);
+ jQuery(output_to || '#servers_table').html(h);
}
-var master_root;
function get() {
jQuery.getJSON((master_root || '') + 'list', success);