Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: html/static/js/IESettings.js

Issue 5427527162003456: Issue 1086 - Add acceptable ads checkbox to the settings page (Closed)
Patch Set: Created July 21, 2014, 11:42 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | html/templates/index.html » ('j') | html/templates/index.html » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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);
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 setCheckboxCheck(id, val)
29 {
30 var el = document.getElementById(id);
31 if (el)
32 {
33 el.checked = val;
34 }
35 }
36
37 function acceptableAdsChange(cb)
38 {
39 UserSettings().SetAcceptableAdsEnabled(cb.checked);
40 }
41
28 function initLanguageSettings() 42 function initLanguageSettings()
29 { 43 {
30 setElementText("title", "settings-title"); 44 setElementText("title", "settings-title");
31 45
32 setElementText("localeLanguageLabel", "settings-language-label"); 46 setElementText("localeLanguageLabel", "settings-language-label");
33 setElementText("localeLanguageDescription", "settings-language-description"); 47 setElementText("localeLanguageDescription", "settings-language-description");
34 48
35 setElementText("localeBlockingLabel", "settings-blocking-label"); 49 setElementText("localeBlockingLabel", "settings-blocking-label");
36 setElementText("localeBlockingDescription", "settings-blocking-description"); 50 setElementText("localeBlockingDescription", "settings-blocking-description");
37 51
38 setElementText("manageExceptions", "settings-exceptions-manage-label"); 52 setElementText("manageExceptions", "settings-exceptions-manage-label");
39 setElementText("addDomain", "settings-exceptions-add-label"); 53 setElementText("addDomain", "settings-exceptions-add-label");
40 setElementText("removeDomains", "settings-exceptions-remove-label"); 54 setElementText("removeDomains", "settings-exceptions-remove-label");
41 55
42 setElementText("localeWorthSharing", "settings-share-label"); 56 setElementText("localeWorthSharing", "settings-share-label");
57
58 setElementText("acceptableAdsLabel", "settings-acceptable-ads");
43 59
60 setCheckboxCheck("acceptableAdsCheckbox", UserSettings().IsAcceptableAdsEnable d());
61
44 var optionsLanguage = document.getElementById("language"); 62 var optionsLanguage = document.getElementById("language");
45 63
46 var languageCount = UserSettings().GetLanguageCount(); 64 var languageCount = UserSettings().GetLanguageCount();
47 for(var i = 0; i < languageCount; i++) 65 for(var i = 0; i < languageCount; i++)
48 { 66 {
49 var el = document.createElement("option"); 67 var el = document.createElement("option");
50 el.text = UserSettings().GetLanguageTitleByIndex(i); 68 el.text = UserSettings().GetLanguageTitleByIndex(i);
51 el.value = UserSettings().GetLanguageByIndex(i); 69 el.value = UserSettings().GetLanguageByIndex(i);
52 70
53 optionsLanguage.add(el, 0); 71 optionsLanguage.add(el, 0);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 { 159 {
142 optionsDomain.remove(removeOptions[i]); 160 optionsDomain.remove(removeOptions[i]);
143 } 161 }
144 }, false); 162 }, false);
145 } 163 }
146 164
147 window.UserSettings = function() 165 window.UserSettings = function()
148 { 166 {
149 return window.Settings; 167 return window.Settings;
150 } 168 }
OLDNEW
« no previous file with comments | « no previous file | html/templates/index.html » ('j') | html/templates/index.html » ('J')

Powered by Google App Engine
This is Rietveld