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: '
\ + html: '
\ \
\

\ @@ -234,6 +241,8 @@ $(document).ready(function() { $('#favicon_' + safeName(info.name)).attr('src', favicon); + $('#quick-jump-container').append(''); + graphs[lastEntry.info.name] = { listing: listing, plot: $.plot('#chart_' + safeName(info.name), [listing], smallChartOptions) @@ -264,6 +273,7 @@ $(document).ready(function() { // We have a new favicon, update the old one. if (update.result && update.result.favicon) { $('#favicon_' + safeName(update.info.name)).attr('src', update.result.favicon); + $('#quick-jump-' + safeName(update.info.name)).attr('src', update.result.favicon); } var graph = graphs[update.info.name]; @@ -296,7 +306,17 @@ $(document).ready(function() { updateMojangServices(); }, 1000); - setInterval(function() { + sortServersTask = setInterval(function() { sortServers(); }, 30 * 1000); + + // Our super fancy scrolly thing! + $(document).on('click', '.quick-jump-icon', function(e) { + var serverName = $(this).attr('data-target-network'); + var target = $('#server-' + serverName); + + $('html, body').animate({ + scrollTop: target.offset().top + }, 100); + }); }); \ No newline at end of file diff --git a/config.json b/config.json index cac0425..949a281 100644 --- a/config.json +++ b/config.json @@ -91,8 +91,8 @@ "type": "PC" }, { - "name": "MCBrawl", - "ip": "mcbrawl.com", + "name": "Brawl", + "ip": "brawl.com", "type": "PC" }, { @@ -111,8 +111,8 @@ "type": "PC" }, { - "name": "DestinyMC", - "ip": "play.thedestinymc.com", + "name": "MCLegends", + "ip": "play.mc-legends.com", "type": "PC" }, { @@ -121,14 +121,34 @@ "type": "PC" }, { - "name": "Minetime", - "ip": "minetime.com", + "name": "Arkham", + "ip": "mc.arkhamnetwork.org", "type": "PC" }, { "name": "VikkCraft", "ip": "hub.vikkcraft.com", "type": "PC" + }, + { + "name": "GommeHD", + "ip": "gommehd.net", + "type": "PC" + }, + { + "name": "Jerry and Harry", + "ip": "play.itsjerryandharry.com", + "type": "PC" + }, + { + "name": "Rewinside", + "ip": "mc.rewinside.tv", + "type": "PC" + }, + { + "name": "Playminity", + "ip": "mc.playminity.com", + "type": "PC" } ], "routes": {