User:Quarl/___location canonicalize.js: Difference between revisions

Content deleted Content added
〈"this" → "d"〉
〈48 words changed〉 new CountryData class - bf
Line 78:
this.init = true;
 
var initRegexpCountryData = function(states, link_country, regexp_country) {
dthis.states = new Object()states;
dthis.link_country = link_country.match(/\[/) ? link_country : '[['+link_country+']]';
d.states = states;
d.link_country = link_country.match(/\[/) ? link_country : '[['+link_country+']]';
var regexp_country = regexp_country || '\\[\\['+link_country+'\\]\\]';
dthis.regexp_country = new RegExp(regexp_country);
dthis.regexp_country_sq = new RegExp(', '+regexp_country);
dthis.regexp_substate = (
new RegExp('^([^,]+), (' + dthis.states.join('|') + ')$'));
dthis.regexp_state = (
new RegExp('^(?:' + dthis.states.join('|') + ')$'));
}
 
this.countries = [
initRegexpnew CountryData( // USA
['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado',
'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho',
Line 105 ⟶ 104:
'\\[\\[(?:United[ _]States(?:[ _][^|\\\]]+?)?|USA)(?:\|[^|\\\]]+?)?\\]\\]'),
 
initRegexpnew CountryData( // Canada
['British Columbia', 'Alberta', 'Saskatchewan', 'Manitoba',
'Ontario', 'Quebec', 'New Brunswick', 'Nova Scotia',