From 31533bcb62d9658f8ceb6014e57743032dbb6be4 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 27 Oct 2012 19:28:47 +0200 Subject: [PATCH] fix a bug in statistics dialog --- static/js/pandora/statisticsDialog.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/static/js/pandora/statisticsDialog.js b/static/js/pandora/statisticsDialog.js index b720577b..f272226a 100644 --- a/static/js/pandora/statisticsDialog.js +++ b/static/js/pandora/statisticsDialog.js @@ -34,7 +34,6 @@ pandora.ui.statisticsDialog = function() { }, dialogHeight = Math.round((window.innerHeight - 48) * 0.9), dialogWidth = Math.round(window.innerWidth * 0.9), - names = Object.keys(colors.system).concat(Object.keys(colors.browser)), tabs = [ {id: 'seen', title: 'First Seen & Last Seen', selected: true}, {id: 'locations', title: 'Locations'}, @@ -446,7 +445,7 @@ pandora.ui.statisticsDialog = function() { ['system', 'browser'].forEach(function(key) { Ox.Chart({ color: function(value) { - var name = version ? getName(value) : value, + var name = version ? getName(key, value) : value, color = colors[key][name]; if (pandora.user.ui.theme == 'classic') { color = getColor(color); @@ -455,7 +454,7 @@ pandora.ui.statisticsDialog = function() { }, data: data[mode][key + version], formatKey: function(value) { - var name = version ? getName(value) : value, + var name = version ? getName(key, value) : value, $element = $('
'); $element.append( $('
') @@ -510,7 +509,7 @@ pandora.ui.statisticsDialog = function() { Ox.Chart({ color: function(value) { var color = Ox.zip(value.split(' / ').map(function(v, i) { - v = version ? getName(v) : v; + v = version ? getName(key, v) : v; return colors[i == 0 ? 'system' : 'browser'][v]; })).map(function(c) { return Math.round(Ox.sum(c) / 2); @@ -548,7 +547,7 @@ pandora.ui.statisticsDialog = function() { ) ); value.split(' / ').forEach(function(value, i) { - value = version ? getName(value) : value; + value = version ? getName(key, value) : value; $element.append( $('') .attr({ @@ -609,9 +608,9 @@ pandora.ui.statisticsDialog = function() { return Ox.rgb(hsl); } - function getName(version) { + function getName(key, version) { var name = ''; - Ox.forEach(names, function(v) { + Ox.forEach(Object.keys(colors[key]), function(v) { if (new RegExp('^' + v).test(version)) { name = v; return false;