OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** |
6 * Slide mode displays a single image and has a set of controls to navigate | 6 * Slide mode displays a single image and has a set of controls to navigate |
7 * between the images and to edit an image. | 7 * between the images and to edit an image. |
8 * | 8 * |
9 * @param {!HTMLElement} container Main container element. | 9 * @param {!HTMLElement} container Main container element. |
10 * @param {!HTMLElement} content Content container element. | 10 * @param {!HTMLElement} content Content container element. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 this.imageContainer_.addEventListener('click', this.onClick_.bind(this)); | 219 this.imageContainer_.addEventListener('click', this.onClick_.bind(this)); |
220 | 220 |
221 this.document_.addEventListener('click', this.onDocumentClick_.bind(this)); | 221 this.document_.addEventListener('click', this.onDocumentClick_.bind(this)); |
222 | 222 |
223 /** | 223 /** |
224 * Overwrite options and info bubble. | 224 * Overwrite options and info bubble. |
225 * @type {!HTMLElement} | 225 * @type {!HTMLElement} |
226 * @private | 226 * @private |
227 * @const | 227 * @const |
228 */ | 228 */ |
229 this.options_ = queryRequiredElement(this.bottomToolbar_, '.options'); | 229 this.options_ = util.createChild(queryRequiredElement( |
| 230 this.topToolbar_, '.filename-spacer'), 'options'); |
230 | 231 |
231 /** | 232 /** |
232 * @type {!HTMLElement} | 233 * @type {!HTMLElement} |
233 * @private | 234 * @private |
234 * @const | 235 * @const |
235 */ | 236 */ |
236 this.savedLabel_ = queryRequiredElement(this.options_, '.saved'); | 237 this.savedLabel_ = util.createChild(this.options_, 'saved'); |
| 238 this.savedLabel_.textContent = this.displayStringFunction_('GALLERY_SAVED'); |
237 | 239 |
238 /** | 240 /** |
239 * @type {!HTMLElement} | 241 * @type {!HTMLElement} |
240 * @private | 242 * @private |
241 * @const | 243 * @const |
242 */ | 244 */ |
243 this.overwriteOriginalBox_ = queryRequiredElement( | 245 this.overwriteOriginalBox_ = util.createChild( |
244 this.options_, '.overwrite-original'); | 246 this.options_, 'overwrite-original'); |
245 | 247 |
246 /** | 248 /** |
247 * @type {!HTMLElement} | 249 * @type {!HTMLElement} |
248 * @private | 250 * @private |
249 * @const | 251 * @const |
250 */ | 252 */ |
251 this.overwriteOriginal_ = queryRequiredElement( | 253 this.overwriteOriginal_ = util.createChild( |
252 this.overwriteOriginalBox_, '#overwrite-checkbox') | 254 this.overwriteOriginalBox_, '', 'input'); |
| 255 this.overwriteOriginal_.type = 'checkbox'; |
| 256 this.overwriteOriginal_.id = 'overwrite-checkbox'; |
253 chrome.storage.local.get(SlideMode.OVERWRITE_KEY, function(values) { | 257 chrome.storage.local.get(SlideMode.OVERWRITE_KEY, function(values) { |
254 var value = values[SlideMode.OVERWRITE_KEY]; | 258 var value = values[SlideMode.OVERWRITE_KEY]; |
255 // Out-of-the box default is 'true' | 259 // Out-of-the box default is 'true' |
256 this.overwriteOriginal_.checked = | 260 this.overwriteOriginal_.checked = |
257 (value === 'false' || value === false) ? false : true; | 261 (value === 'false' || value === false) ? false : true; |
258 }.bind(this)); | 262 }.bind(this)); |
259 this.overwriteOriginal_.addEventListener('click', | 263 this.overwriteOriginal_.addEventListener('click', |
260 this.onOverwriteOriginalClick_.bind(this)); | 264 this.onOverwriteOriginalClick_.bind(this)); |
261 | 265 |
262 /** | 266 /** |
263 * @type {!HTMLElement} | 267 * @type {!HTMLElement} |
| 268 * @const |
| 269 */ |
| 270 var overwriteLabel = util.createChild( |
| 271 this.overwriteOriginalBox_, '', 'label'); |
| 272 overwriteLabel.textContent = |
| 273 this.displayStringFunction_('GALLERY_OVERWRITE_ORIGINAL'); |
| 274 overwriteLabel.setAttribute('for', 'overwrite-checkbox'); |
| 275 |
| 276 /** |
| 277 * @type {!HTMLElement} |
264 * @private | 278 * @private |
265 * @const | 279 * @const |
266 */ | 280 */ |
267 this.bubble_ = util.createChild(this.bottomToolbar_, 'bubble'); | 281 this.bubble_ = util.createChild(this.bottomToolbar_, 'bubble'); |
268 this.bubble_.hidden = true; | 282 this.bubble_.hidden = true; |
269 | 283 |
270 /** | 284 /** |
271 * @type {!HTMLElement} | 285 * @type {!HTMLElement} |
272 * @const | 286 * @const |
273 */ | 287 */ |
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 var event = assertInstanceof(event, MouseEvent); | 1870 var event = assertInstanceof(event, MouseEvent); |
1857 var viewport = this.slideMode_.getViewport(); | 1871 var viewport = this.slideMode_.getViewport(); |
1858 if (!this.enabled_ || !viewport.isZoomed()) | 1872 if (!this.enabled_ || !viewport.isZoomed()) |
1859 return; | 1873 return; |
1860 this.stopOperation(); | 1874 this.stopOperation(); |
1861 viewport.setOffset( | 1875 viewport.setOffset( |
1862 viewport.getOffsetX() + event.wheelDeltaX, | 1876 viewport.getOffsetX() + event.wheelDeltaX, |
1863 viewport.getOffsetY() + event.wheelDeltaY); | 1877 viewport.getOffsetY() + event.wheelDeltaY); |
1864 this.slideMode_.applyViewportChange(); | 1878 this.slideMode_.applyViewportChange(); |
1865 }; | 1879 }; |
OLD | NEW |