Commit d4b0b607 authored by Christopher Guess's avatar Christopher Guess
Browse files

added some alphabatizing

parent 45c995dc
......@@ -31,7 +31,7 @@ function Marka(target) {
var currencies = this.currencies_supported()
lightbox += '<option value="">Show original currency</option>'
for (var cur in currencies) {
lightbox += '<option value="' + currencies[cur].code + '">' + currencies[cur].name_plural + '</option>'
lightbox += '<option value="' + currencies[cur].code + '">' + currencies[cur].name_plural + ' (' + currencies[cur].code + ')</option>'
}
lightbox += '</select></div></div></div>'
$(this.target).append($(lightbox))
......@@ -241,16 +241,24 @@ Marka.prototype.retreiveExchangeRates = function(currency_one, currency_two, cal
}
Marka.prototype.currencies_supported = function(){
var currencies = {};
for(var index = 1; index < currencies_available.length; index++){
var val = currencies_available[index];
var symbol = val.resource.fields.symbol.substring(0, 3);
var info = currency_info[symbol];
if(info){
currencies[symbol] = info;
}
}
return currencies;
var currencies = {};
for(var index = 1; index < currencies_available.length; index++){
var val = currencies_available[index];
var symbol = val.resource.fields.symbol.substring(0, 3);
var info = currency_info[symbol];
if(info){
currencies[symbol] = info;
}
}
//adopted from http://stackoverflow.com/a/33124465/604031
Object.keys(currencies).sort().forEach(function(key) {
var value = currencies[key];
delete currencies[key];
currencies[key] = value;
});
return currencies;
}
// Taken from http://www.w3schools.com/js/js_cookies.asp
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment