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

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

Issue 6353703170736128: Issue 1112 - Properly use polyfills in firstrun and settings pages (Closed)
Patch Set: Keeping the 'false' parameter Created July 23, 2014, 12:47 p.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/static/js/firstRun.js » ('j') | no next file with comments »
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 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 setElementText("removeDomains", "settings-exceptions-remove-label"); 46 setElementText("removeDomains", "settings-exceptions-remove-label");
47 47
48 setElementText("localeWorthSharing", "settings-share-label"); 48 setElementText("localeWorthSharing", "settings-share-label");
49 49
50 setElementText("acceptableAdsLabel", "settings-acceptable-ads"); 50 setElementText("acceptableAdsLabel", "settings-acceptable-ads");
51 51
52 var aaCheckbox = document.getElementById("acceptableAdsCheckbox"); 52 var aaCheckbox = document.getElementById("acceptableAdsCheckbox");
53 if (aaCheckbox) 53 if (aaCheckbox)
54 { 54 {
55 aaCheckbox.checked = UserSettings().IsAcceptableAdsEnabled(); 55 aaCheckbox.checked = UserSettings().IsAcceptableAdsEnabled();
56 addListener(aaCheckbox, "change", acceptableAdsChange, false); 56 aaCheckbox.addEventListener("change", acceptableAdsChange, false);
57 } 57 }
58 58
59 var optionsLanguage = document.getElementById("language"); 59 var optionsLanguage = document.getElementById("language");
60 60
61 var languageCount = UserSettings().GetLanguageCount(); 61 var languageCount = UserSettings().GetLanguageCount();
62 for(var i = 0; i < languageCount; i++) 62 for(var i = 0; i < languageCount; i++)
63 { 63 {
64 var el = document.createElement("option"); 64 var el = document.createElement("option");
65 el.text = UserSettings().GetLanguageTitleByIndex(i); 65 el.text = UserSettings().GetLanguageTitleByIndex(i);
66 el.value = UserSettings().GetLanguageByIndex(i); 66 el.value = UserSettings().GetLanguageByIndex(i);
67 67
68 optionsLanguage.add(el, 0); 68 optionsLanguage.add(el, 0);
69 } 69 }
70 70
71 addListener(optionsLanguage, "change", function () 71 optionsLanguage.addEventListener("change", function ()
72 { 72 {
73 UserSettings().SetLanguage(optionsLanguage[optionsLanguage.selectedIndex].va lue); 73 UserSettings().SetLanguage(optionsLanguage[optionsLanguage.selectedIndex].va lue);
74 }, false); 74 }, false);
75 75
76 var language = UserSettings().GetLanguage(); 76 var language = UserSettings().GetLanguage();
77 77
78 var options = optionsLanguage.options; 78 var options = optionsLanguage.options;
79 for (var i = 0; i < options.length; i++) 79 for (var i = 0; i < options.length; i++)
80 { 80 {
81 if (options[i].value == language) 81 if (options[i].value == language)
(...skipping 13 matching lines...) Expand all
95 for(var i = 0; i < domains.length; i++) 95 for(var i = 0; i < domains.length; i++)
96 { 96 {
97 var domain = domains[i]; 97 var domain = domains[i];
98 98
99 var el = document.createElement("option"); 99 var el = document.createElement("option");
100 el.text = domain; 100 el.text = domain;
101 optionsDomain.add(el, 0); 101 optionsDomain.add(el, 0);
102 } 102 }
103 103
104 var addDomain = document.getElementById("addDomain"); 104 var addDomain = document.getElementById("addDomain");
105 addListener(addDomain, "click", function() 105 addDomain.addEventListener("click", function()
106 { 106 {
107 var newDomain = document.getElementById("newDomain"); 107 var newDomain = document.getElementById("newDomain");
108 108
109 // Trim whitespaces 109 // Trim whitespaces
110 var value = newDomain.value.replace(/^\s+|\s+$/, ""); 110 var value = newDomain.value.replace(/^\s+|\s+$/, "");
111 111
112 if (value.length) 112 if (value.length)
113 { 113 {
114 var alreadyExist = false; 114 var alreadyExist = false;
115 for(var i = 0; i < optionsDomain.length; i++) 115 for(var i = 0; i < optionsDomain.length; i++)
(...skipping 16 matching lines...) Expand all
132 132
133 var el = document.createElement("option"); 133 var el = document.createElement("option");
134 el.text = value; 134 el.text = value;
135 optionsDomain.add(el, 0); 135 optionsDomain.add(el, 0);
136 136
137 newDomain.value = ""; 137 newDomain.value = "";
138 } 138 }
139 }, false); 139 }, false);
140 140
141 var removeDomains = document.getElementById("removeDomains"); 141 var removeDomains = document.getElementById("removeDomains");
142 addListener(removeDomains, "click", function() 142 removeDomains.addEventListener("click", function()
143 { 143 {
144 var removeOptions = []; 144 var removeOptions = [];
145 var domains = optionsDomain.options; 145 var domains = optionsDomain.options;
146 for (var i = 0; i < domains.length; i++) 146 for (var i = 0; i < domains.length; i++)
147 { 147 {
148 if (domains[i].selected) 148 if (domains[i].selected)
149 { 149 {
150 UserSettings().RemoveWhitelistDomain(domains[i].text); 150 UserSettings().RemoveWhitelistDomain(domains[i].text);
151 removeOptions.push(domains[i].index); 151 removeOptions.push(domains[i].index);
152 } 152 }
153 } 153 }
154 154
155 for (var i = removeOptions.length; i--;) 155 for (var i = removeOptions.length; i--;)
156 { 156 {
157 optionsDomain.remove(removeOptions[i]); 157 optionsDomain.remove(removeOptions[i]);
158 } 158 }
159 }, false); 159 }, false);
160 } 160 }
161 161
162 window.UserSettings = function() 162 window.UserSettings = function()
163 { 163 {
164 return window.Settings; 164 return window.Settings;
165 } 165 }
OLDNEW
« no previous file with comments | « no previous file | html/static/js/firstRun.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld