Allow custom Graph colors (#76)

This commit is contained in:
Hugo Manrique
2017-04-03 23:10:46 -04:00
committed by Cryptkeeper!
parent 42c744b9dd
commit 0955e8dbcd
6 changed files with 37 additions and 6 deletions

View File

@ -76,16 +76,30 @@ function getServersByCategory() {
return byCategory;
}
function getServerByIp(ip) {
function getServerByField(id, value) {
for (var i = 0; i < publicConfig.servers.length; i++) {
var entry = publicConfig.servers[i];
if (entry.ip === ip) {
if (entry[id] === value) {
return entry;
}
}
}
function getServerByIp(ip) {
return getServerByField('ip', ip);
}
function getServerByName(name) {
return getServerByField('name', name);
}
function getServerColor(name) {
var server = getServerByName(name);
return server ? server.color : stringToColor(name);
}
// Generate (and set) the HTML that displays Mojang status.
// If nothing is passed, re-render the last update.
// If something is passed, update and then re-render.