Better masterserver html

This commit is contained in:
proller 2013-07-13 00:37:28 +04:00
parent 288948edf7
commit 0a2de78da4
3 changed files with 23 additions and 6 deletions

@ -49,8 +49,12 @@ function success(r) {
h += '<tr class="mts_row">'; h += '<tr class="mts_row">';
h += '<td class="mts_address">' + e(s.address) + (s.port != 30000 ? (':' + e(s.port)) : '') + '</td>'; h += '<td class="mts_address">' + e(s.address) + (s.port != 30000 ? (':' + e(s.port)) : '') + '</td>';
h += '<td class="mts_clients">' + e(s.clients) + (s.clients_max ? '/' + e(s.clients_max) : '') + (s.clients_top ? ', ' + s.clients_top : '') + '</td>'; h += '<td class="mts_clients">' + e(s.clients) + (s.clients_max ? '/' + e(s.clients_max) : '') + (s.clients_top ? ', ' + s.clients_top : '') + '</td>';
h += '<td class="mts_version">' + e(s.version) + ' ' + e(s.gameid); var mods;
if (s.mods && jQuery.isArray(s.mods)) { if (s.mods && jQuery.isArray(s.mods)) {
mods = 1;
}
h += '<td class="mts_version' + (mods ? ' mts_ismods' : '') + '">' + e(s.version) + ' ' + e(s.gameid);
if (mods) {
h += '<div class="mts_mods">Mods:<br/>'; h += '<div class="mts_mods">Mods:<br/>';
for (m in s.mods) { for (m in s.mods) {
h += s.mods[m] + '<br/>'; h += s.mods[m] + '<br/>';

@ -152,7 +152,6 @@ sub float {
return ($_[0] < 8 and $_[0] - int($_[0])) return ($_[0] < 8 and $_[0] - int($_[0]))
? sprintf('%.' . ($_[0] < 1 ? 3 : ($_[0] < 3 ? 2 : 1)) . 'f', $_[0]) ? sprintf('%.' . ($_[0] < 1 ? 3 : ($_[0] < 3 ? 2 : 1)) . 'f', $_[0])
: int($_[0]); : int($_[0]);
} }
sub mineping ($$) { sub mineping ($$) {
@ -236,7 +235,7 @@ sub request (;$) {
$param->{first} ||= $old->{first} || $old->{time} || $param->{time}; $param->{first} ||= $old->{first} || $old->{time} || $param->{time};
$param->{clients_top} = $old->{clients_top} if $old->{clients_top} > $param->{clients}; $param->{clients_top} = $old->{clients_top} if $old->{clients_top} > $param->{clients};
$param->{clients_top} ||= $param->{clients} || 0; $param->{clients_top} ||= $param->{clients} || 0;
$param->{mods} ||= $old->{mods}; $param->{mods} ||= $old->{mods} unless $param->{action} ~~ 'start';
delete $param->{action}; delete $param->{action};
$listk->{$param->{key}} = $param; $listk->{$param->{key}} = $param;
#printlog Dumper $param; #printlog Dumper $param;

@ -13,6 +13,20 @@ div#table table {
width: 100%; width: 100%;
} }
.mts_mods {visibility: hidden; border:gray solid 1px; position:absolute; z-index:100; background-color:white; padding:.5em;} .mts_mods {
.mts_version:hover .mts_mods {visibility: visible;} visibility: hidden;
.mts_version {text-decoration:underline; text-decoration-style:dashed;} 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;
}