Skip to content

Commit da3dbeb

Browse files
committed
Use a forloop instead of $.each for loading the saved preference
1 parent 4ca8943 commit da3dbeb

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

options/js/options.js

+7-10
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,14 @@
3232
});
3333

3434
chrome.storage.local.get('yabpt', function (res) {
35-
// Need to adapt to the new system
36-
if (res.yabpt.currency.length == 3) {
37-
var prevOption = res.yabpt.currency;
38-
var selectedCountry = 'us';
39-
$.each(currencies, function (idx, c) {
40-
if (prevOption == c.currency) {
41-
selectedCountry = c.iso2;
42-
}
43-
});
44-
$('#currency').countrySelect('selectCountry', selectedCountry);
35+
var selectedCountry = 'us';
36+
for (var i = 0; i < currencies.length; i++) {
37+
var item = currencies[i];
38+
if (res.yabpt.currency == item.currency) {
39+
selectedCountry = item.iso2;
40+
}
4541
}
42+
$('#currency').countrySelect('selectCountry', selectedCountry);
4643
});
4744
}
4845

0 commit comments

Comments
 (0)