oxjs/source/Ox.Geo/Ox.Geo.js

33 lines
784 B
JavaScript
Raw Normal View History

Ox.load.Geo = function(options, callback) {
Ox.getJSON(Ox.PATH + 'Ox.Geo/json/Ox.Geo.json', function(data) {
Ox.COUNTRIES = data;
Ox.getCountryByCode = function(code) {
var country;
Ox.forEach(Ox.COUNTRIES, function(c) {
if (c.code == code) {
country = c;
return false;
}
});
return country;
};
Ox.getCountryByName = function(name) {
var country;
Ox.forEach(Ox.COUNTRIES, function(c) {
if (c.name == name) {
country = c;
return false;
}
});
return country;
};
callback(true);
});
}