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_ = util.createChild(queryRequiredElement( | 229 this.options_ = queryRequiredElement(this.bottomToolbar_, '.options'); |
230 this.topToolbar_, '.filename-spacer'), 'options'); | |
231 | 230 |
232 /** | 231 /** |
233 * @type {!HTMLElement} | 232 * @type {!HTMLElement} |
234 * @private | 233 * @private |
235 * @const | 234 * @const |
236 */ | 235 */ |
237 this.savedLabel_ = util.createChild(this.options_, 'saved'); | 236 this.savedLabel_ = queryRequiredElement(this.options_, '.saved'); |
238 this.savedLabel_.textContent = this.displayStringFunction_('GALLERY_SAVED'); | |
239 | 237 |
240 /** | 238 /** |
241 * @type {!HTMLElement} | 239 * @type {!HTMLElement} |
242 * @private | 240 * @private |
243 * @const | 241 * @const |
244 */ | 242 */ |
245 this.overwriteOriginalBox_ = util.createChild( | 243 this.overwriteOriginalBox_ = queryRequiredElement( |
246 this.options_, 'overwrite-original'); | 244 this.options_, '.overwrite-original'); |
247 | 245 |
248 /** | 246 /** |
249 * @type {!HTMLElement} | 247 * @type {!HTMLElement} |
250 * @private | 248 * @private |
251 * @const | 249 * @const |
252 */ | 250 */ |
253 this.overwriteOriginal_ = util.createChild( | 251 this.overwriteOriginal_ = queryRequiredElement( |
254 this.overwriteOriginalBox_, '', 'input'); | 252 this.overwriteOriginalBox_, '#overwrite-checkbox') |
255 this.overwriteOriginal_.type = 'checkbox'; | |
256 this.overwriteOriginal_.id = 'overwrite-checkbox'; | |
257 chrome.storage.local.get(SlideMode.OVERWRITE_KEY, function(values) { | 253 chrome.storage.local.get(SlideMode.OVERWRITE_KEY, function(values) { |
258 var value = values[SlideMode.OVERWRITE_KEY]; | 254 var value = values[SlideMode.OVERWRITE_KEY]; |
259 // Out-of-the box default is 'true' | 255 // Out-of-the box default is 'true' |
260 this.overwriteOriginal_.checked = | 256 this.overwriteOriginal_.checked = |
261 (value === 'false' || value === false) ? false : true; | 257 (value === 'false' || value === false) ? false : true; |
262 }.bind(this)); | 258 }.bind(this)); |
263 this.overwriteOriginal_.addEventListener('click', | 259 this.overwriteOriginal_.addEventListener('click', |
264 this.onOverwriteOriginalClick_.bind(this)); | 260 this.onOverwriteOriginalClick_.bind(this)); |
265 | 261 |
266 /** | 262 /** |
267 * @type {!HTMLElement} | 263 * @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} | |
278 * @private | 264 * @private |
279 * @const | 265 * @const |
280 */ | 266 */ |
281 this.bubble_ = util.createChild(this.bottomToolbar_, 'bubble'); | 267 this.bubble_ = util.createChild(this.bottomToolbar_, 'bubble'); |
282 this.bubble_.hidden = true; | 268 this.bubble_.hidden = true; |
283 | 269 |
284 /** | 270 /** |
285 * @type {!HTMLElement} | 271 * @type {!HTMLElement} |
286 * @const | 272 * @const |
287 */ | 273 */ |
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 var event = assertInstanceof(event, MouseEvent); | 1856 var event = assertInstanceof(event, MouseEvent); |
1871 var viewport = this.slideMode_.getViewport(); | 1857 var viewport = this.slideMode_.getViewport(); |
1872 if (!this.enabled_ || !viewport.isZoomed()) | 1858 if (!this.enabled_ || !viewport.isZoomed()) |
1873 return; | 1859 return; |
1874 this.stopOperation(); | 1860 this.stopOperation(); |
1875 viewport.setOffset( | 1861 viewport.setOffset( |
1876 viewport.getOffsetX() + event.wheelDeltaX, | 1862 viewport.getOffsetX() + event.wheelDeltaX, |
1877 viewport.getOffsetY() + event.wheelDeltaY); | 1863 viewport.getOffsetY() + event.wheelDeltaY); |
1878 this.slideMode_.applyViewportChange(); | 1864 this.slideMode_.applyViewportChange(); |
1879 }; | 1865 }; |
OLD | NEW |