Changed OS's names to icons in server status
That fixes a problem with long translation names pushing the labels with long version and OS name. For example: "3.0.12.4 on Linux" will work fine while "3.0.12.4 on Windows" will be pushed to the new line due to a long text in label
This commit is contained in:
parent
27cfeb54e8
commit
95a802b56f
|
@ -36,7 +36,7 @@ p, a {
|
|||
/* STATUS */
|
||||
/* ****** */
|
||||
|
||||
.serverstatus p {
|
||||
.serverstatus p, .serverstatus .label .fa {
|
||||
margin: 0
|
||||
}
|
||||
|
||||
|
|
22
js/status.js
22
js/status.js
|
@ -1,11 +1,10 @@
|
|||
$(document).ready(function () {
|
||||
|
||||
checkStatus();
|
||||
|
||||
var intervalid = setInterval(function () {
|
||||
checkStatus();
|
||||
}, 10 * 1000);
|
||||
})
|
||||
});
|
||||
|
||||
function checkStatus() {
|
||||
|
||||
|
@ -27,10 +26,27 @@ function checkStatus() {
|
|||
var averagePacketloss = Math.round(json.averagePacketloss * 100) / 100;
|
||||
var averagePing = Math.round(json.averagePing * 100) / 100;
|
||||
|
||||
var platformIcon = '<i class="fa %s fa-fw" title="' + platform + '" aria-hidden="true"></i>';
|
||||
|
||||
switch (platform.toLowerCase()) {
|
||||
case "windows":
|
||||
platformIcon = platformIcon.replace(/%s/, 'fa-windows');
|
||||
break;
|
||||
case "linux":
|
||||
platformIcon = platformIcon.replace(/%s/, 'fa-linux');
|
||||
break;
|
||||
case "os x":
|
||||
case "macos":
|
||||
platformIcon = platformIcon.replace(/%s/, 'fa-apple');
|
||||
break;
|
||||
default:
|
||||
platformIcon = platform;
|
||||
}
|
||||
|
||||
result =
|
||||
'<p><i class="fa fa-power-off fa-fw" aria-hidden="true"></i> ' + statusOnline + ': <span class="label label-success">' + clientsonline + ' / ' + maxclients + ' (' + clientsprecent + '%)</span></p>' +
|
||||
'<p><i class="fa fa-clock-o fa-fw" aria-hidden="true"></i> ' + statusUptime + ': <span class="label label-success">' + uptime + '</span></p>' +
|
||||
'<p><i class="fa fa-info-circle fa-fw" aria-hidden="true"></i> ' + statusVersion + ': <span class="label label-success">' + version + ' @ ' + platform + '</span></p>' +
|
||||
'<p><i class="fa fa-info-circle fa-fw" aria-hidden="true"></i> ' + statusVersion + ': <span class="label label-success">' + version + ' on ' + platformIcon + '</span></p>' +
|
||||
'<p><i class="fa fa-signal fa-fw" aria-hidden="true"></i> ' + statusAvgping + ': <span class="label label-success">' + averagePing + ' ms</span></p>' +
|
||||
'<p><i class="fa fa-bolt fa-fw" aria-hidden="true"></i> ' + statusAvgpl + ': <span class="label label-success">' + averagePacketloss + '%</span></p>';
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue