From 82ce29d1820a00c8e23098a59f0d863e30f00f20 Mon Sep 17 00:00:00 2001 From: alexfriesen Date: Wed, 8 Jun 2016 18:54:02 +0200 Subject: [PATCH 1/6] chat scroll to bottom like the console --- html/chat.html | 10 +++++++++- js/chat.js | 47 ++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/html/chat.html b/html/chat.html index 0cc09e6..d90b7ca 100644 --- a/html/chat.html +++ b/html/chat.html @@ -1,6 +1,14 @@
-
{{line.Username}}: {{line.Message}}
+
+
+ + + {{line.Username}} + : + {{line.Message}} +
+
diff --git a/js/chat.js b/js/chat.js index 86ceeca..3f60d1e 100644 --- a/js/chat.js +++ b/js/chat.js @@ -3,7 +3,7 @@ app.controller( 'ChatController', ChatController ); function ChatController( $scope, rconService, $timeout ) { - $scope.Output = new Array(); + $scope.Output = []; $scope.SubmitCommand = function () { @@ -13,21 +13,48 @@ function ChatController( $scope, rconService, $timeout ) $scope.$on( "OnMessage", function ( event, msg ) { - if ( msg.Type != "Chat" ) return; + if ( msg.Type !== "Chat" ) return; $scope.OnMessage( JSON.parse( msg.Message ) ); - } ); + }); $scope.OnMessage = function( msg ) { $scope.Output.push( msg ); - $timeout( $scope.ScrollToBottom, 50 ); + + if($scope.isOnBottom()) { + $scope.ScrollToBottom(); + } } $scope.ScrollToBottom = function() { - // TODO - don't scroll if we're not at the bottom ! - $( "#ChatController .Output" ).scrollTop( $( "#ChatController .Output" )[0].scrollHeight ); + var element = $( "#ChatController .Output" ); + + $timeout( function() { + element.scrollTop( element.prop('scrollHeight') ); + }, 50 ); + } + + $scope.isOnBottom = function() + { + // get jquery element + var element = $( "#ChatController .Output" ); + + // height of the element + var height = element.height(); + + // scroll position from top position + var scrollTop = element.scrollTop(); + + // full height of the element + var scrollHeight = element.prop('scrollHeight'); + + if((scrollTop + height) > (scrollHeight - 10)) { + return true; + } + + return false; } // @@ -36,13 +63,15 @@ function ChatController( $scope, rconService, $timeout ) // $scope.GetHistory = function () { - console.log( "GetHistory" ); - rconService.Request( "chat.tail 512", $scope, function ( msg ) { var messages = JSON.parse( msg.Message ); - messages.forEach( function ( x ) { $scope.OnMessage( x ); } ); + messages.forEach( function ( message ) { + $scope.OnMessage( message ); + }); + + $scope.ScrollToBottom(); } ); } From 66098b02bf0a4aca61439aabb689f4b521fe6b9b Mon Sep 17 00:00:00 2001 From: alexfriesen Date: Wed, 8 Jun 2016 19:18:22 +0200 Subject: [PATCH 2/6] remove md parts --- html/connect.html | 21 ++++++++++++--------- html/console.html | 4 ++-- html/playerInfo.html | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/html/connect.html b/html/connect.html index c9cdbd8..fd812f8 100644 --- a/html/connect.html +++ b/html/connect.html @@ -4,24 +4,25 @@

Connect

-
{{LastErrorMessage}}
+
+ {{LastErrorMessage}} +

Enter the address (including rcon port) and the rcon password below to connect.

-
-
+
-
+
-
+
@@ -29,8 +30,6 @@ -
-
@@ -39,10 +38,14 @@

Saved Connections

- +
diff --git a/html/console.html b/html/console.html index acb194b..e5ed7e6 100644 --- a/html/console.html +++ b/html/console.html @@ -1,10 +1,10 @@
-
+
{{line.Message}}
-
+
diff --git a/html/playerInfo.html b/html/playerInfo.html index d44223e..d9a31a7 100644 --- a/html/playerInfo.html +++ b/html/playerInfo.html @@ -1,5 +1,5 @@ -
+
From e2f08d52cec65c138597a8dd383ceb5717585b15 Mon Sep 17 00:00:00 2001 From: alexfriesen Date: Wed, 8 Jun 2016 19:22:58 +0200 Subject: [PATCH 3/6] responsive playerlist use bootstrap table-class --- html/playerlist.html | 155 ++++++++++++++++++++++--------------------- js/playerlist.js | 24 +++---- rcon.css | 45 +------------ 3 files changed, 95 insertions(+), 129 deletions(-) diff --git a/html/playerlist.html b/html/playerlist.html index db35f53..d80d469 100644 --- a/html/playerlist.html +++ b/html/playerlist.html @@ -1,95 +1,100 @@ -
+
-
-
- +
+
+
-
- +
+
- - - - +
+
+
Actions
+ + + - - - - - - - - - - - + + + + + + + + + + + - + - + - + - + - + - + - + - + - - - - -
ActionsUsernameSteamidVoilationLevelXPAddressPingDuration
UsernameSteamidVoilationLevelXPAddressPingDuration
- - + + - {{line.DisplayName}} - + {{line.DisplayName}} + - {{line.SteamID}} - + {{line.SteamID}} + - {{line.VoiationLevel}} - + {{line.VoiationLevel}} + - {{line.CurrentLevel}} - + {{line.CurrentLevel}} + - {{line.UnspentXp}} - + {{line.UnspentXp}} + - {{line.Address}} - + {{line.Address}} + {{line.Ping}} + {{line.Ping}} + - {{line.ConnectedSeconds | SecondsToDuration}} -
+ + {{line.ConnectedSeconds | SecondsToDuration}} + + + + +
+
\ No newline at end of file diff --git a/js/playerlist.js b/js/playerlist.js index 820faea..013dfcb 100644 --- a/js/playerlist.js +++ b/js/playerlist.js @@ -14,20 +14,20 @@ function PlayerListController( $scope, rconService, $interval ) }); } - $scope.Order = function( o ) + $scope.Order = function( field ) { - if ( $scope.OrderBy == o ) + if ( $scope.OrderBy === field ) { - o = '-' + o; + field = '-' + field; } - $scope.OrderBy = o; + $scope.OrderBy = field; } - $scope.SortClass = function( o ) + $scope.SortClass = function( field ) { - if ( $scope.OrderBy == o ) return "active"; - if ( $scope.OrderBy == "-" + o ) return "active descending"; + if ( $scope.OrderBy === field ) return "sorting"; + if ( $scope.OrderBy === "-" + field ) return "sorting descending"; return null; } @@ -41,10 +41,10 @@ function PlayerListController( $scope, rconService, $interval ) rconService.InstallService( $scope, $scope.Refresh ) - var timer = $interval( function () - { - //$scope.Refresh(); - }.bind( this ), 1000 ); + // var timer = $interval( function () + // { + // //$scope.Refresh(); + // }.bind( this ), 1000 ); - $scope.$on( '$destroy', function () { $interval.cancel( timer ) } ) + //$scope.$on( '$destroy', function () { $interval.cancel( timer ) } ) } \ No newline at end of file diff --git a/rcon.css b/rcon.css index fa4be39..eb15691 100644 --- a/rcon.css +++ b/rcon.css @@ -21,19 +21,11 @@ a:hover text-decoration: none; } -.right -{ - text-align: right; -} - .center { text-align: center; } - -.float-left { float: left; } - #ConsoleController .Output { font-family: monospace; @@ -68,53 +60,22 @@ a:hover background-color: #428bca; } -table -{ - border-collapse: collapse; - border-spacing: 0; - width: 100%; -} - .fade { opacity: 0.5; } -th, td +.table > tbody > tr:hover { - padding: 5px 8px; - border-bottom: 1px solid #414758; + background-color: rgba( 255, 255, 255, 0.3 ); } -th.active +.table > thead > tr > th.sorting { color: #1bc98e; border-color: #1bc98e; } -th -{ - border-bottom: 2px solid #414758; - border-radius: 10px; -} - -th:first-child -{ - border-radius: 6px; -} - -th:last-child -{ - border-radius: 0 6px 0 0; -} - -th:only-child -{ - border-radius: 6px 6px 0 0; -} - - - .btn-default, .btn-default:active, .form-control { background: rgba( 255, 255, 255, 0.3 ); From d700aff8e74284ab977ed4dd493150aef088bdfd Mon Sep 17 00:00:00 2001 From: alexfriesen Date: Wed, 8 Jun 2016 19:35:20 +0200 Subject: [PATCH 4/6] serverinfo cleanup --- html/serverInfo.html | 11 +++++++++-- js/serverInfo.js | 10 +++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/html/serverInfo.html b/html/serverInfo.html index 9c3a95a..d161e31 100644 --- a/html/serverInfo.html +++ b/html/serverInfo.html @@ -3,15 +3,20 @@
-
+

{{info.Hostname}}
- +

+
+

{{key}}: {{value}}

+
+ + +
diff --git a/js/serverInfo.js b/js/serverInfo.js index afe5143..07b9489 100644 --- a/js/serverInfo.js +++ b/js/serverInfo.js @@ -5,16 +5,12 @@ function ServerInfoController( $scope, rconService, $routeParams ) { $scope.info = {}; - $scope.Refresh = function () + $scope.refresh = function () { - rconService.Request( 'serverinfo', $scope, function ( msg ) - { + rconService.Request( 'serverinfo', $scope, function ( msg ) { $scope.info = JSON.parse( msg.Message ); - // $scope.Players = JSON.parse( msg.Message ); - - console.log($scope.info); }); } - rconService.InstallService( $scope, $scope.Refresh ); + rconService.InstallService( $scope, $scope.refresh ); } From b7e2f720dff416db98ddc1f1df0cef2757b03913 Mon Sep 17 00:00:00 2001 From: alexfriesen Date: Wed, 8 Jun 2016 20:14:35 +0200 Subject: [PATCH 5/6] cleanup player xp site --- html/playerXp.html | 89 ++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 55 deletions(-) diff --git a/html/playerXp.html b/html/playerXp.html index 1d599c3..53bb2d4 100644 --- a/html/playerXp.html +++ b/html/playerXp.html @@ -1,63 +1,42 @@ -
- - - -

Statistics for player {{userid}}

- -
- -
- - - - Xp Income Sources - Where has this user got their Xp from - - - - - - - - -
- -
- - - - Xp Outgoing Sources - Where has this user spent their Xp - - - - - - - - -
+
+
+
+

+ Statistics for player: {{userid}} +

+
-
- - - - Xp Over Time - How much XP has this user got over time - - - - - - - - +
+
+

Xp Income Sources

+
Where has this user got their Xp from
+
+ +
+
- - +
+
+

Xp Outgoing Sources

+
Where has this user spent their Xp
+
+ +
+
+
+ +
+
+

Xp Over Time

+
How much XP has this user got over time
+
+ +
+
+
\ No newline at end of file From 1ad8e9ffc65fb3f9243423037685f25ef09095c3 Mon Sep 17 00:00:00 2001 From: alexfriesen Date: Wed, 8 Jun 2016 20:16:04 +0200 Subject: [PATCH 6/6] chat with time --- html/chat.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/html/chat.html b/html/chat.html index d90b7ca..2ea4465 100644 --- a/html/chat.html +++ b/html/chat.html @@ -2,10 +2,11 @@
- + + {{(line.Time * 1000) | date:'shortTime'}} {{line.Username}} - : + {{line.Message}}