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 UserImagesGrid = options.UserImagesGrid; | 8 var UserImagesGrid = options.UserImagesGrid; |
9 | 9 |
10 /** @const */ var CUSTOM_WALLPAPER_PREFIX = | 10 /** @const */ var CUSTOM_WALLPAPER_PREFIX = |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 }, | 92 }, |
93 | 93 |
94 /** | 94 /** |
95 * Set attributions of wallpaper with given URL. | 95 * Set attributions of wallpaper with given URL. |
96 * @param {string} url URL of the selected wallpaper. | 96 * @param {string} url URL of the selected wallpaper. |
97 * @private | 97 * @private |
98 */ | 98 */ |
99 setWallpaperAttribution_: function(url) { | 99 setWallpaperAttribution_: function(url) { |
100 for (var i = 0; i < this.wallpapers_.length; i++) { | 100 for (var i = 0; i < this.wallpapers_.length; i++) { |
101 if (this.wallpapers_[i].url == url) { | 101 if (this.wallpapers_[i].url == url) { |
102 $('author-name').textContent = this.wallpapers_[i].author; | 102 $('wallpaper-author-name').textContent = this.wallpapers_[i].author; |
103 $('author-website').textContent = this.wallpapers_[i].website; | 103 $('wallpaper-author-website').textContent = |
| 104 this.wallpapers_[i].website; |
104 return; | 105 return; |
105 } | 106 } |
106 } | 107 } |
107 $('author-name').textContent = ''; | 108 $('wallpaper-author-name').textContent = ''; |
108 $('author-website').textContent = ''; | 109 $('wallpaper-author-website').textContent = ''; |
109 }, | 110 }, |
110 | 111 |
111 /** | 112 /** |
112 * Populates the drop down box for custom wallpaper layouts. | 113 * Populates the drop down box for custom wallpaper layouts. |
113 * param {string} layouts Available wallpaper layouts. | 114 * param {string} layouts Available wallpaper layouts. |
114 * param {number} selectedLayout The value of selected/default layout. | 115 * param {number} selectedLayout The value of selected/default layout. |
115 * @private | 116 * @private |
116 */ | 117 */ |
117 populateWallpaperLayouts_: function(layouts, selectedLayout) { | 118 populateWallpaperLayouts_: function(layouts, selectedLayout) { |
118 var wallpaperLayout = $('set-wallpaper-layout'); | 119 var wallpaperLayout = $('set-wallpaper-layout'); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 }, | 184 }, |
184 | 185 |
185 /** | 186 /** |
186 * Handles click on the "I'm feeling lucky" checkbox. | 187 * Handles click on the "I'm feeling lucky" checkbox. |
187 * @private | 188 * @private |
188 */ | 189 */ |
189 handleCheckboxClick_: function() { | 190 handleCheckboxClick_: function() { |
190 var wallpaperGrid = $('wallpaper-grid'); | 191 var wallpaperGrid = $('wallpaper-grid'); |
191 if ($('use-daily-wallpaper').checked) { | 192 if ($('use-daily-wallpaper').checked) { |
192 wallpaperGrid.disabled = true; | 193 wallpaperGrid.disabled = true; |
193 $('attribution-label').hidden = false; | 194 $('wallpaper-attribution-label').hidden = false; |
194 chrome.send('selectDailyWallpaper'); | 195 chrome.send('selectDailyWallpaper'); |
195 wallpaperGrid.classList.add('grayout'); | 196 wallpaperGrid.classList.add('grayout'); |
196 $('set-wallpaper-layout').hidden = true; | 197 $('set-wallpaper-layout').hidden = true; |
197 } else { | 198 } else { |
198 wallpaperGrid.disabled = false; | 199 wallpaperGrid.disabled = false; |
199 wallpaperGrid.classList.remove('grayout'); | 200 wallpaperGrid.classList.remove('grayout'); |
200 // Set the wallpaper type to User::DEFAULT. | 201 // Set the wallpaper type to User::DEFAULT. |
201 this.handleImageSelected_(); | 202 this.handleImageSelected_(); |
202 } | 203 } |
203 }, | 204 }, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 '?id=' + (new Date()).getTime(); | 264 '?id=' + (new Date()).getTime(); |
264 }, | 265 }, |
265 | 266 |
266 /** | 267 /** |
267 * Updates the visibility of attribution-label and set-wallpaper-layout. | 268 * Updates the visibility of attribution-label and set-wallpaper-layout. |
268 * @param {boolean} isCustom True if users select custom wallpaper. | 269 * @param {boolean} isCustom True if users select custom wallpaper. |
269 */ | 270 */ |
270 set isCustom(isCustom) { | 271 set isCustom(isCustom) { |
271 if (isCustom) { | 272 if (isCustom) { |
272 // Clear attributions for custom wallpaper. | 273 // Clear attributions for custom wallpaper. |
273 $('attribution-label').hidden = true; | 274 $('wallpaper-attribution-label').hidden = true; |
274 // Enable the layout drop down box when custom wallpaper is selected. | 275 // Enable the layout drop down box when custom wallpaper is selected. |
275 $('set-wallpaper-layout').hidden = false; | 276 $('set-wallpaper-layout').hidden = false; |
276 } else { | 277 } else { |
277 $('attribution-label').hidden = false; | 278 $('wallpaper-attribution-label').hidden = false; |
278 $('set-wallpaper-layout').hidden = true; | 279 $('set-wallpaper-layout').hidden = true; |
279 } | 280 } |
280 }, | 281 }, |
281 | 282 |
282 /** | 283 /** |
283 * Adds or updates custom user wallpaper thumbnail from file. | 284 * Adds or updates custom user wallpaper thumbnail from file. |
284 * @private | 285 * @private |
285 */ | 286 */ |
286 setCustomImage_: function() { | 287 setCustomImage_: function() { |
287 var wallpaperGrid = $('wallpaper-grid'); | 288 var wallpaperGrid = $('wallpaper-grid'); |
(...skipping 26 matching lines...) Expand all Loading... |
314 }; | 315 }; |
315 }); | 316 }); |
316 | 317 |
317 // Export | 318 // Export |
318 return { | 319 return { |
319 SetWallpaperOptions: SetWallpaperOptions | 320 SetWallpaperOptions: SetWallpaperOptions |
320 }; | 321 }; |
321 | 322 |
322 }); | 323 }); |
323 | 324 |
OLD | NEW |