Files
rust-rcon/js/playerlist.js
T
alexfriesen 172ee95216 rconService.getUsers() will get and parse the userdata
PlayerInfo displays Info and provide a link to steam profile
Dropdown in the Playerlist offers more options the selected Player
2016-05-18 14:10:03 +02:00

50 lines
913 B
JavaScript

app.controller( 'PlayerListController', PlayerListController );
function PlayerListController( $scope, rconService, $interval )
{
$scope.Output = [];
$scope.OrderBy = '-ConnectedSeconds';
$scope.Refresh = function ()
{
rconService.getUsers($scope, function ( users )
{
$scope.Players = users;
});
}
$scope.Order = function( o )
{
if ( $scope.OrderBy == o )
{
o = '-' + o;
}
$scope.OrderBy = o;
}
$scope.SortClass = function( o )
{
if ( $scope.OrderBy == o ) return "active";
if ( $scope.OrderBy == "-" + o ) return "active descending";
return null;
}
$scope.KickPlayer = function ( id )
{
rconService.Command( 'kick ' + id );
$scope.Refresh();
}
rconService.InstallService( $scope, $scope.Refresh )
var timer = $interval( function ()
{
//$scope.Refresh();
}.bind( this ), 1000 );
$scope.$on( '$destroy', function () { $interval.cancel( timer ) } )
}