Permalink
Browse files

Show number of entries for each language

  • Loading branch information...
1 parent 32f5365 commit 99ab410d727b226a3991be57f4943b34f04f512a Per Thulin committed Aug 13, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 static/main.js
View
14 static/main.js
@@ -20,6 +20,16 @@ $country.onchange = function() {
run();
};
+function getLengthOfMap(map) {
+ var ret = 0;
+ for (key in map) {
+ if (map.hasOwnProperty(key)) {
+ ret += 1;
+ }
+ }
+ return ret;
+}
+
function extractWords(map) {
var i;
var entry;
@@ -48,14 +58,14 @@ function setupCountryChooser() {
$country.innerHTML = '';
$option = document.createElement('option');
$option.setAttribute('value', 'global');
- $option.innerHTML = 'Global';
+ $option.innerHTML = 'Global (' + getLengthOfMap(global) + ')';
$country.appendChild($option);
for (key in countries) {
if (countries.hasOwnProperty(key)) {
$option = document.createElement('option');
$option.setAttribute('value', key);
- $option.innerHTML = key;
+ $option.innerHTML = key + ' (' + getLengthOfMap(countries[key]) + ')';
if (selectedCountry === key) {
$option.setAttribute('selected', 'selected');
}

0 comments on commit 99ab410

Please sign in to comment.