in Geo module, actually use image symlinks; add Ox.getFlagByCountryCode method

This commit is contained in:
rolux 2012-04-01 23:08:35 +02:00
parent fbc15dcadf
commit 241f0bc064

View file

@ -125,7 +125,6 @@ Ox.load.Geo = function(options, callback) {
> Ox.getCountryByCode('US').name
'United States'
@*/
Ox.getCountryByCode = function(code) {
var country;
code = code.toUpperCase();
@ -147,7 +146,6 @@ Ox.load.Geo = function(options, callback) {
> Ox.getCountryByGeoname('The Bottom, Saba, Bonaire, Sint Eustatius and Saba').code
'BQ'
@*/
Ox.getCountryByGeoname = function(geoname) {
// fixme: UAE correction doesn't belong here, fix in map
geoname = (geoname || '').replace(' - United Arab Emirates', ', United Arab Emirates')
@ -167,7 +165,6 @@ Ox.load.Geo = function(options, callback) {
> Ox.getCountryByName('USA').code
'US'
@*/
Ox.getCountryByName = function(name) {
var country;
Ox.forEach(Ox.COUNTRIES, function(c) {
@ -179,6 +176,10 @@ Ox.load.Geo = function(options, callback) {
return country;
};
Ox.getFlagByCountryCode = function(code, size) {
return Ox.PATH + 'Ox.Geo/png/flags/' + size + '/' + code + '.png';
};
/*@
Ox.getImageByGeoname <f> Returns an image URL for a given geoname
(type, size, geoname) -> <s> Image URL
@ -186,10 +187,9 @@ Ox.load.Geo = function(options, callback) {
size <n> Image width (32, 256, 2048 (flag), 16, 256, 1024 (icon))
geoname <s> Geoname
@*/
Ox.getFlagByGeoname = function(geoname, size) {
var country = Ox.getCountryByGeoname(geoname),
code = country ? country.flag || country.code : 'NTHH';
code = country ? country.code : 'NTHH';
return Ox.PATH + 'Ox.Geo/png/flags/' + size + '/' + code + '.png';
};
@ -200,7 +200,6 @@ Ox.load.Geo = function(options, callback) {
size <n> Image width (32, 256, 2048 (flag), 16, 256, 1024 (icon))
language <s> Language
@*/
Ox.getFlagByLanguage = function(language, size) {
language = language
.replace(' languages', '')