OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('options', function() { | 5 cr.define('options', function() { |
6 | 6 |
7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
8 var Page = cr.ui.pageManager.Page; | 8 var Page = cr.ui.pageManager.Page; |
9 var PageManager = cr.ui.pageManager.PageManager; | 9 var PageManager = cr.ui.pageManager.PageManager; |
10 | 10 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 Preferences.setIntegerPref( | 148 Preferences.setIntegerPref( |
149 'webkit.webprefs.minimum_logical_font_size', size, true); | 149 'webkit.webprefs.minimum_logical_font_size', size, true); |
150 return false; | 150 return false; |
151 }, | 151 }, |
152 | 152 |
153 /** | 153 /** |
154 * Sets the text, font size and font family of the sample text. | 154 * Sets the text, font size and font family of the sample text. |
155 * @param {Element} el The div containing the sample text. | 155 * @param {Element} el The div containing the sample text. |
156 * @param {number} size The font size of the sample text. | 156 * @param {number} size The font size of the sample text. |
157 * @param {string} font The font family of the sample text. | 157 * @param {string} font The font family of the sample text. |
158 * @param {bool} showSize True if the font size should appear in the sample. | 158 * @param {boolean} showSize True if the font size should appear in the |
159 * sample. | |
159 * @private | 160 * @private |
160 */ | 161 */ |
161 setUpFontSample_: function(el, size, font, showSize) { | 162 setUpFontSample_: function(el, size, font, showSize) { |
162 var prefix = showSize ? (size + ': ') : ''; | 163 var prefix = showSize ? (size + ': ') : ''; |
163 el.textContent = prefix + | 164 el.textContent = prefix + |
164 loadTimeData.getString('fontSettingsLoremIpsum'); | 165 loadTimeData.getString('fontSettingsLoremIpsum'); |
165 el.style.fontSize = size + 'px'; | 166 el.style.fontSize = size + 'px'; |
166 if (font) | 167 if (font) |
167 el.style.fontFamily = font; | 168 el.style.fontFamily = font; |
168 }, | 169 }, |
169 | 170 |
170 /** | 171 /** |
171 * Populates a select list and selects the specified item. | 172 * Populates a select list and selects the specified item. |
172 * @param {Element} element The select element to populate. | 173 * @param {Element} element The select element to populate. |
173 * @param {Array} items The array of items from which to populate. | 174 * @param {Array} items The array of items from which to populate. |
174 * @param {string} selectedValue The selected item. | 175 * @param {string} selectedValue The selected item. |
175 * @private | 176 * @private |
176 */ | 177 */ |
177 populateSelect_: function(element, items, selectedValue) { | 178 populateSelect_: function(element, items, selectedValue) { |
178 // Remove any existing content. | 179 // Remove any existing content. |
179 element.textContent = ''; | 180 element.textContent = ''; |
180 | 181 |
181 // Insert new child nodes into select element. | 182 // Insert new child nodes into select element. |
182 var value, text, selected, option; | 183 var value, text, dir, selected, option; |
183 for (var i = 0; i < items.length; i++) { | 184 for (var i = 0; i < items.length; i++) { |
184 value = items[i][0]; | 185 value = items[i][0]; |
Dan Beam
2014/09/06 02:22:36
nit: I'd say just put var instead here, i.e.
va
Vitaly Pavlenko
2014/09/06 22:54:08
Done.
| |
185 text = items[i][1]; | 186 text = items[i][1]; |
186 dir = items[i][2]; | 187 dir = items[i][2]; |
187 if (text) { | 188 if (text) { |
188 selected = value == selectedValue; | 189 selected = value == selectedValue; |
189 var option = new Option(text, value, false, selected); | 190 var option = new Option(text, value, false, selected); |
190 option.dir = dir; | 191 option.dir = dir; |
191 element.appendChild(option); | 192 element.appendChild(option); |
192 } else { | 193 } else { |
193 element.appendChild(document.createElement('hr')); | 194 element.appendChild(document.createElement('hr')); |
194 } | 195 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 $('advanced-font-settings-install').hidden = available; | 250 $('advanced-font-settings-install').hidden = available; |
250 $('advanced-font-settings-options').hidden = !available; | 251 $('advanced-font-settings-options').hidden = !available; |
251 }; | 252 }; |
252 | 253 |
253 // Export | 254 // Export |
254 return { | 255 return { |
255 FontSettings: FontSettings | 256 FontSettings: FontSettings |
256 }; | 257 }; |
257 }); | 258 }); |
258 | 259 |
OLD | NEW |