15 if (typeof
Cc ==
'undefined')
16 var
Cc = Components.classes;
17 if (typeof
Ci ==
'undefined')
18 var
Ci = Components.interfaces;
20 #ifdef METRICS_ENABLED
21 if (typeof(gMetrics) ==
"undefined")
22 var gMetrics = Cc[
"@songbirdnest.com/Songbird/Metrics;1"]
23 .createInstance(Ci.sbIMetrics);
34 Application.prefs.getValue(
"extensions.newreleases.country", 1);
35 var countryDropdown = document.getElementById(
"menulist-country");
38 this.nrSvc = Cc[
"@songbirdnest.com/newreleases;1"]
39 .getService(Ci.nsIClassInfo).wrappedJSObject;
40 this.json = Cc[
"@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON);
42 if (!this.nrSvc.gotLocationInfo()) {
43 this.nrSvc.refreshLocations();
44 NewReleaseAlbum.showTimeoutError();
57 this._populateCountries(this.pCountry);
60 _populateCountries :
function(selectedCountry) {
61 var countries = this.json.decode(this.nrSvc.getLocationCountries());
62 var countryDropdown = document.getElementById(
"menulist-country");
63 countryDropdown.removeAllItems();
65 for (var
i=0;
i<countries.length;
i++) {
66 var country = countries[
i].name;
67 countryDropdown.appendItem(country, countries[
i].
id);
68 if (countries[
i].
id == selectedCountry)
71 countryDropdown.selectedIndex = idx;
74 changeCountry :
function(list) {
75 var countryId = list.selectedItem.value;
79 var deck = document.getElementById(
"newReleases-deck");
81 if (deck.hasAttribute(
"previous-selected-deck"))
82 prev = deck.getAttribute(
"previous-selected-deck");
83 deck.setAttribute(
"selectedIndex", prev);
87 var countryDropdown = document.getElementById(
"menulist-country");
88 var country = countryDropdown.selectedItem.value;
92 Application.prefs.setValue(
"extensions.newreleases.country", country);
94 #ifdef METRICS_ENABLED
95 gMetrics.metricsInc(
"newReleases",
"change.location",
"");
144 NewReleaseAlbum.loadNewReleaseData();
_getSelectedPageStyle s i