diff --git a/app.js b/app.js index 07d1cc3..6d00261 100644 --- a/app.js +++ b/app.js @@ -42,11 +42,11 @@ function pingAll() { server.io.sockets.emit('update', networkSnapshot); // Log our response. - if (!networkHistory[network.ip]) { - networkHistory[network.ip] = []; + if (!networkHistory[network.name]) { + networkHistory[network.name] = []; } - var _networkHistory = networkHistory[network.ip]; + var _networkHistory = networkHistory[network.name]; // Remove our previous data that we don't need anymore. for (var i = 0; i < _networkHistory.length; i++) { @@ -111,6 +111,8 @@ server.start(function() { // Remap our associative array into just an array. var networkHistoryKeys = Object.keys(networkHistory); + networkHistoryKeys.sort(); + // Send each individually, this should look cleaner than waiting for one big array to transfer. for (var i = 0; i < networkHistoryKeys.length; i++) { client.emit('add', [networkHistory[networkHistoryKeys[i]]]); diff --git a/assets/css/main.css b/assets/css/main.css index ab730ee..149ddd4 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -139,4 +139,24 @@ h3 { .text-center-align { text-align: center; +} + +/* Icon Quick jump */ +#quick-jump-container { + position: fixed; + top: 10px; + left: 10px; + overflow: auto; +} + +.quick-jump-icon { + height: 24px; + width: 24px; + display: block; + margin-bottom: 2px; + border-radius: 2px; +} + +.quick-jump-icon:hover { + cursor: pointer; } \ No newline at end of file diff --git a/assets/html/index.html b/assets/html/index.html index 6c32f3a..5ecf80b 100644 --- a/assets/html/index.html +++ b/assets/html/index.html @@ -32,6 +32,8 @@
+ + diff --git a/assets/js/site.js b/assets/js/site.js index 8e2beac..9e733ea 100644 --- a/assets/js/site.js +++ b/assets/js/site.js @@ -1,5 +1,3 @@ -var lastMojangServiceUpdate; - var smallChartOptions = { series: { shadowSize: 0 @@ -32,6 +30,8 @@ var smallChartOptions = { ] }; +var lastMojangServiceUpdate; + var graphs = {}; var lastLatencyEntries = {}; var lastPlayerEntries = {}; @@ -156,12 +156,14 @@ function sortServers() { } function safeName(name) { - return name.replace(' ', ''); + return name.replace(/ /g, ''); } $(document).ready(function() { var socket = io.connect(); + var mojangServicesUpdater; + var sortServersTask; socket.on('connect', function() { $('#tagline-text').text('Loading...'); @@ -172,6 +174,10 @@ $(document).ready(function() { clearInterval(mojangServicesUpdater); } + if (sortServersTask) { + clearInterval(sortServersTask); + } + $('#tagline').attr('class', 'status-offline'); $('#tagline-text').text('Disconnected! Refresh?'); @@ -180,6 +186,7 @@ $(document).ready(function() { graphs = {}; $('#server-container').html(''); + $('#quick-jump-container').html(''); }); socket.on('add', function(servers) { @@ -211,7 +218,7 @@ $(document).ready(function() { $('', { id: safeName(info.name), class: 'server', - html: '