Left: | ||
Right: |
OLD | NEW |
---|---|
1 function init() | 1 function init() |
2 { | 2 { |
3 try | 3 try |
4 { | 4 { |
5 initLanguageSettings(); | 5 initLanguageSettings(); |
6 | 6 |
7 initDomainSettings(); | 7 initDomainSettings(); |
8 } | 8 } |
9 catch (err) | 9 catch (err) |
10 { | 10 { |
11 //alert("err: " + err); | 11 // alert("err: " + err); |
Felix Dahlke
2014/07/22 14:28:10
That change seems unrelated :D
| |
12 } | 12 } |
13 } | 13 } |
14 | 14 |
15 function setElementText(id, key) | 15 function setElementText(id, key) |
16 { | 16 { |
17 var el = document.getElementById(id); | 17 var el = document.getElementById(id); |
18 if (el) | 18 if (el) |
19 { | 19 { |
20 var text = UserSettings().GetMessage("settings", key); | 20 var text = UserSettings().GetMessage("settings", key); |
21 if (text) | 21 if (text) |
22 { | 22 { |
23 el.innerText = text; | 23 el.innerText = text; |
24 } | 24 } |
25 } | 25 } |
26 } | 26 } |
27 | 27 |
28 function acceptableAdsChange() | |
29 { | |
30 var aaCheckbox = document.getElementById("acceptableAdsCheckbox"); | |
31 UserSettings().SetAcceptableAdsEnabled(aaCheckbox.checked); | |
32 } | |
33 | |
28 function initLanguageSettings() | 34 function initLanguageSettings() |
29 { | 35 { |
30 setElementText("title", "settings-title"); | 36 setElementText("title", "settings-title"); |
31 | 37 |
32 setElementText("localeLanguageLabel", "settings-language-label"); | 38 setElementText("localeLanguageLabel", "settings-language-label"); |
33 setElementText("localeLanguageDescription", "settings-language-description"); | 39 setElementText("localeLanguageDescription", "settings-language-description"); |
34 | 40 |
35 setElementText("localeBlockingLabel", "settings-blocking-label"); | 41 setElementText("localeBlockingLabel", "settings-blocking-label"); |
36 setElementText("localeBlockingDescription", "settings-blocking-description"); | 42 setElementText("localeBlockingDescription", "settings-blocking-description"); |
37 | 43 |
38 setElementText("manageExceptions", "settings-exceptions-manage-label"); | 44 setElementText("manageExceptions", "settings-exceptions-manage-label"); |
39 setElementText("addDomain", "settings-exceptions-add-label"); | 45 setElementText("addDomain", "settings-exceptions-add-label"); |
40 setElementText("removeDomains", "settings-exceptions-remove-label"); | 46 setElementText("removeDomains", "settings-exceptions-remove-label"); |
41 | 47 |
42 setElementText("localeWorthSharing", "settings-share-label"); | 48 setElementText("localeWorthSharing", "settings-share-label"); |
49 | |
50 setElementText("acceptableAdsLabel", "settings-acceptable-ads"); | |
43 | 51 |
52 var aaCheckbox = document.getElementById("acceptableAdsCheckbox"); | |
53 if (aaCheckbox) | |
54 { | |
55 aaCheckbox.checked = UserSettings().IsAcceptableAdsEnabled(); | |
56 addListener(aaCheckbox, "change", acceptableAdsChange, false); | |
57 } | |
58 | |
44 var optionsLanguage = document.getElementById("language"); | 59 var optionsLanguage = document.getElementById("language"); |
45 | 60 |
46 var languageCount = UserSettings().GetLanguageCount(); | 61 var languageCount = UserSettings().GetLanguageCount(); |
47 for(var i = 0; i < languageCount; i++) | 62 for(var i = 0; i < languageCount; i++) |
48 { | 63 { |
49 var el = document.createElement("option"); | 64 var el = document.createElement("option"); |
50 el.text = UserSettings().GetLanguageTitleByIndex(i); | 65 el.text = UserSettings().GetLanguageTitleByIndex(i); |
51 el.value = UserSettings().GetLanguageByIndex(i); | 66 el.value = UserSettings().GetLanguageByIndex(i); |
52 | 67 |
53 optionsLanguage.add(el, 0); | 68 optionsLanguage.add(el, 0); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 for (var i = removeOptions.length; i--;) | 155 for (var i = removeOptions.length; i--;) |
141 { | 156 { |
142 optionsDomain.remove(removeOptions[i]); | 157 optionsDomain.remove(removeOptions[i]); |
143 } | 158 } |
144 }, false); | 159 }, false); |
145 } | 160 } |
146 | 161 |
147 window.UserSettings = function() | 162 window.UserSettings = function() |
148 { | 163 { |
149 return window.Settings; | 164 return window.Settings; |
150 } | 165 } |
Felix Dahlke
2014/07/22 14:28:10
Was this a missing EOF? If so let's keep it.
| |
OLD | NEW |