From ac0ea0d5d7951a16f41cd025588d36eebeb0301a Mon Sep 17 00:00:00 2001 From: Cryptkeeper! Date: Tue, 14 Mar 2017 17:07:58 -0500 Subject: [PATCH] 3.1.0 (#69) --- app.js | 25 ++++++++++--- assets/css/main.css | 82 +++++++++++++++++++++--------------------- assets/html/index.html | 31 +++++++++------- assets/js/site.js | 45 ++++++++++++----------- assets/js/util.js | 57 +++++++++++++---------------- docs/CHANGELOG.md | 5 +++ lib/database.js | 12 ++++++- lib/mojang_services.js | 2 +- lib/server.js | 2 +- lib/util.js | 9 +---- package.json | 2 +- 11 files changed, 146 insertions(+), 126 deletions(-) diff --git a/app.js b/app.js index 1212a21..05dae4b 100644 --- a/app.js +++ b/app.js @@ -15,6 +15,7 @@ var currentVersionIndex = { 'PC': 0, 'PE': 0 }; + var networkVersions = []; var graphData = []; @@ -245,6 +246,8 @@ function startServices() { client.emit('add', [networkHistory[networkHistoryKeys[i]]]); } } + + client.emit('syncComplete'); }); }); @@ -260,14 +263,26 @@ if (config.logToDatabase) { var timestamp = util.getCurrentTimeMs(); db.queryPings(config.graphDuration, function(data) { - var result = util.convertServerHistory(data); - - graphData = result.graphData; - highestPlayerCount = result.highestPlayerCount; + graphData = util.convertServerHistory(data); + completedQueries = 0; logger.log('info', 'Queried and parsed ping history in %sms', util.getCurrentTimeMs() - timestamp); - startServices(); + for (var i = 0; i < servers.length; i++) { + (function(server) { + db.getTotalRecord(server.ip, function(record) { + logger.log('info', 'Completed query for %s', server.ip); + + highestPlayerCount[server.ip] = record; + + completedQueries += 1; + + if (completedQueries === servers.length) { + startServices(); + } + }); + })(servers[i]); + } }); } else { logger.log('warn', 'Database logging is not enabled. You can enable it by setting "logToDatabase" to true in config.json. This requires sqlite3 to be installed.'); diff --git a/assets/css/main.css b/assets/css/main.css index 28f0d48..73f78fb 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -29,8 +29,7 @@ a { /* Constants */ #header, #footer, #tagline { - width: 1540px; - margin: 0 auto; + } /* Header */ @@ -40,6 +39,11 @@ a { overflow: auto; } +#header-wrapper { + overflow: auto; + min-width: 850px; +} + #header .column { display: inline-block; float: left; @@ -62,8 +66,8 @@ a { #header a, #footer a { text-decoration: none; color: inherit; - border-bottom: 1px dashed #3B3738; - } + border-bottom: 1px dashed #3B3738; +} #header a:hover, #footer a:hover { border-bottom: 1px dashed transparent; @@ -81,57 +85,42 @@ a { /* Footer */ #footer { - font-size: 16px; + font-size: 14px; text-transform: uppercase; background: #EBEBEB; color: #3B3738; padding: 15px 0; - border-top-right-radius: 2px; - border-top-left-radius: 2px; + min-width: 950px; + margin-top: 15px; } /* Tagline */ -#tagline { - padding: 10px 0; +#tagline-text { + padding-top: 20px; text-align: center; - border-bottom-right-radius: 2px; - border-bottom-left-radius: 2px; -} - -/* Colors used by the Mojang service's status bar */ -.status-online { - background: #87D37C; - color: #3B3738; -} - -.status-unstable { - background: #E9E581; - color: #3B3738; -} - -.status-offline { - background: #e74c3c; -} - -.status-connecting { - background: #3498db; } /* Server listing */ .server-container { - width: 1540px; - margin: 10px auto; overflow: auto; + display: flex; flex-wrap: wrap; justify-content: center; } .server { - overflow: auto; padding: 5px 10px; margin: 0 5px; - width: 740px; + width: 738px; + border: 1px solid transparent; display: inline-block; } +/*.server:hover { + background: #282828; + border: 1px solid #444; + cursor: pointer; + border-radius: 2px; +}*/ + .server > .column > img { border-radius: 2px; margin-top: 5px; @@ -180,7 +169,7 @@ a { padding: 5px; border-radius: 3px; background: rgba(0, 0, 0, 0.65); - z-index: 999; + z-index: 10000; } /* Existing elements */ @@ -254,9 +243,7 @@ h3 { /* Percentage bar */ #perc-bar { - margin-top: 6px; - width: 650px; - height: 50px; + height: 35px; position: relative; } @@ -264,10 +251,25 @@ h3 { height: 100%; display: inline-block; position: absolute; + transition: 0.1s all; } #perc-bar > .perc-bar-part:hover { opacity: 0.75; - margin-top: -5px; - transition: 0.2s all; +} + +/* Mojang Status */ +.mojang-status { + width: 60px; + height: 60px; + display: inline-block; + border-radius: 2px; + text-align: center; + line-height: 20px; + font-size: 12px; +} + +.mojang-status > i { + margin-top: 8px; + font-size: 22px; } diff --git a/assets/html/index.html b/assets/html/index.html index 7e0fbe8..2323412 100644 --- a/assets/html/index.html +++ b/assets/html/index.html @@ -5,6 +5,7 @@ + @@ -20,28 +21,32 @@