From 0a2de78da418c7cdeb1cf9b898d049100804fb29 Mon Sep 17 00:00:00 2001 From: proller Date: Sat, 13 Jul 2013 00:37:28 +0400 Subject: Better masterserver html --- util/master/list.js | 6 +++++- util/master/master.cgi | 3 +-- util/master/style.css | 20 +++++++++++++++++--- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/util/master/list.js b/util/master/list.js index c414a92b4..9e033b609 100644 --- a/util/master/list.js +++ b/util/master/list.js @@ -49,8 +49,12 @@ function success(r) { h += ''; h += '' + e(s.address) + (s.port != 30000 ? (':' + e(s.port)) : '') + ''; h += '' + e(s.clients) + (s.clients_max ? '/' + e(s.clients_max) : '') + (s.clients_top ? ', ' + s.clients_top : '') + ''; - h += '' + e(s.version) + ' ' + e(s.gameid); + var mods; if (s.mods && jQuery.isArray(s.mods)) { + mods = 1; + } + h += '' + e(s.version) + ' ' + e(s.gameid); + if (mods) { h += '
Mods:
'; for (m in s.mods) { h += s.mods[m] + '
'; diff --git a/util/master/master.cgi b/util/master/master.cgi index e283fe3a2..975fa94e2 100755 --- a/util/master/master.cgi +++ b/util/master/master.cgi @@ -152,7 +152,6 @@ sub float { return ($_[0] < 8 and $_[0] - int($_[0])) ? sprintf('%.' . ($_[0] < 1 ? 3 : ($_[0] < 3 ? 2 : 1)) . 'f', $_[0]) : int($_[0]); - } sub mineping ($$) { @@ -236,7 +235,7 @@ sub request (;$) { $param->{first} ||= $old->{first} || $old->{time} || $param->{time}; $param->{clients_top} = $old->{clients_top} if $old->{clients_top} > $param->{clients}; $param->{clients_top} ||= $param->{clients} || 0; - $param->{mods} ||= $old->{mods}; + $param->{mods} ||= $old->{mods} unless $param->{action} ~~ 'start'; delete $param->{action}; $listk->{$param->{key}} = $param; #printlog Dumper $param; diff --git a/util/master/style.css b/util/master/style.css index a83794041..c92c56f6e 100644 --- a/util/master/style.css +++ b/util/master/style.css @@ -13,6 +13,20 @@ div#table table { width: 100%; } -.mts_mods {visibility: hidden; border:gray solid 1px; position:absolute; z-index:100; background-color:white; padding:.5em;} -.mts_version:hover .mts_mods {visibility: visible;} -.mts_version {text-decoration:underline; text-decoration-style:dashed;} \ No newline at end of file +.mts_mods { + visibility: hidden; + border:gray solid 1px; + position:absolute; + z-index:100; + background-color:white; + padding:.5em; +} + +.mts_version:hover .mts_mods { + visibility: visible; +} + +.mts_version.mts_ismods { + text-decoration:underline; + text-decoration-style:dashed; +} -- cgit v1.2.3