Nice header with server status, better chat layout

This commit is contained in:
Garry Newman
2016-07-11 09:57:17 +01:00
parent 569f5d0535
commit 2da3351935
6 changed files with 70 additions and 17 deletions
+2 -4
View File
@@ -88,14 +88,12 @@ function SecondsToDuration()
var out = "";
var hours = Math.floor( input / 3600 );
if ( input > 3600 ) out += hours + "h ";
if ( input > 3600 ) out += hours + "h";
var minutes = Math.floor( input / 60 ) % 60;
if ( input > 60 ) out += minutes + "m ";
if ( input > 60 ) out += minutes + "m";
var seconds = input % 60;
if ( input < 3600 )
out += seconds + "s";
return out;
+5 -2
View File
@@ -1,7 +1,7 @@
app.controller( 'ServerInfoController', ServerInfoController );
function ServerInfoController( $scope, rconService, $routeParams )
function ServerInfoController( $scope, rconService, $routeParams, $interval )
{
$scope.info = {};
@@ -9,8 +9,11 @@ function ServerInfoController( $scope, rconService, $routeParams )
{
rconService.Request( 'serverinfo', $scope, function ( msg ) {
$scope.info = JSON.parse( msg.Message );
});
} );
}
rconService.InstallService( $scope, $scope.refresh );
var timer = $interval( $scope.refresh, 500 );
$scope.$on( "$destroy", function () { $interval.cancel( timer ); } );
}