| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Slide mode displays a single image and has a set of controls to navigate | 8 * Slide mode displays a single image and has a set of controls to navigate |
| 9 * between the images and to edit an image. | 9 * between the images and to edit an image. |
| 10 * | 10 * |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 util.createChild(this.arrowLeft_); | 159 util.createChild(this.arrowLeft_); |
| 160 | 160 |
| 161 util.createChild(this.arrowBox_, 'arrow-spacer'); | 161 util.createChild(this.arrowBox_, 'arrow-spacer'); |
| 162 | 162 |
| 163 this.arrowRight_ = | 163 this.arrowRight_ = |
| 164 util.createChild(this.arrowBox_, 'arrow right tool dimmable'); | 164 util.createChild(this.arrowBox_, 'arrow right tool dimmable'); |
| 165 this.arrowRight_.addEventListener('click', | 165 this.arrowRight_.addEventListener('click', |
| 166 this.advanceManually.bind(this, 1)); | 166 this.advanceManually.bind(this, 1)); |
| 167 util.createChild(this.arrowRight_); | 167 util.createChild(this.arrowRight_); |
| 168 | 168 |
| 169 this.ribbonSpacer_ = util.createChild(this.toolbar_, 'ribbon-spacer'); | 169 this.ribbonSpacer_ = this.toolbar_.querySelector('.ribbon-spacer'); |
| 170 this.ribbon_ = new Ribbon( | 170 this.ribbon_ = new Ribbon( |
| 171 this.document_, this.dataModel_, this.selectionModel_); | 171 this.document_, this.dataModel_, this.selectionModel_); |
| 172 this.ribbonSpacer_.appendChild(this.ribbon_); | 172 this.ribbonSpacer_.appendChild(this.ribbon_); |
| 173 | 173 |
| 174 // Error indicator. | 174 // Error indicator. |
| 175 var errorWrapper = util.createChild(this.container_, 'prompt-wrapper'); | 175 var errorWrapper = util.createChild(this.container_, 'prompt-wrapper'); |
| 176 errorWrapper.setAttribute('pos', 'center'); | 176 errorWrapper.setAttribute('pos', 'center'); |
| 177 | 177 |
| 178 this.errorBanner_ = util.createChild(errorWrapper, 'error-banner'); | 178 this.errorBanner_ = util.createChild(errorWrapper, 'error-banner'); |
| 179 | 179 |
| 180 util.createChild(this.container_, 'spinner'); | 180 util.createChild(this.container_, 'spinner'); |
| 181 | 181 |
| 182 var slideShowButton = util.createChild(this.toolbar_, | 182 var slideShowButton = this.toolbar_.querySelector('button.slideshow'); |
| 183 'button slideshow', 'button'); | |
| 184 slideShowButton.title = this.displayStringFunction_('GALLERY_SLIDESHOW'); | 183 slideShowButton.title = this.displayStringFunction_('GALLERY_SLIDESHOW'); |
| 185 slideShowButton.addEventListener('click', | 184 slideShowButton.addEventListener('click', |
| 186 this.startSlideshow.bind(this, SlideMode.SLIDESHOW_INTERVAL_FIRST)); | 185 this.startSlideshow.bind(this, SlideMode.SLIDESHOW_INTERVAL_FIRST)); |
| 187 | 186 |
| 188 var slideShowToolbar = | 187 var slideShowToolbar = |
| 189 util.createChild(this.container_, 'tool slideshow-toolbar'); | 188 util.createChild(this.container_, 'tool slideshow-toolbar'); |
| 190 util.createChild(slideShowToolbar, 'slideshow-play'). | 189 util.createChild(slideShowToolbar, 'slideshow-play'). |
| 191 addEventListener('click', this.toggleSlideshowPause_.bind(this)); | 190 addEventListener('click', this.toggleSlideshowPause_.bind(this)); |
| 192 util.createChild(slideShowToolbar, 'slideshow-end'). | 191 util.createChild(slideShowToolbar, 'slideshow-end'). |
| 193 addEventListener('click', this.stopSlideshow_.bind(this)); | 192 addEventListener('click', this.stopSlideshow_.bind(this)); |
| 194 | 193 |
| 195 // Editor. | 194 // Editor. |
| 196 | 195 |
| 197 this.editButton_ = util.createChild(this.toolbar_, 'button edit', 'button'); | 196 this.editButton_ = this.toolbar_.querySelector('button.edit'); |
| 198 this.editButton_.title = this.displayStringFunction_('GALLERY_EDIT'); | 197 this.editButton_.title = this.displayStringFunction_('GALLERY_EDIT'); |
| 199 this.editButton_.setAttribute('disabled', ''); // Disabled by default. | 198 this.editButton_.setAttribute('disabled', ''); // Disabled by default. |
| 200 this.editButton_.addEventListener('click', this.toggleEditor.bind(this)); | 199 this.editButton_.addEventListener('click', this.toggleEditor.bind(this)); |
| 201 | 200 |
| 202 this.printButton_ = util.createChild(this.toolbar_, 'button print', 'button'); | 201 this.printButton_ = this.toolbar_.querySelector('button.print'); |
| 203 this.printButton_.title = this.displayStringFunction_('GALLERY_PRINT'); | 202 this.printButton_.title = this.displayStringFunction_('GALLERY_PRINT'); |
| 204 this.printButton_.setAttribute('disabled', ''); // Disabled by default. | 203 this.printButton_.setAttribute('disabled', ''); // Disabled by default. |
| 205 this.printButton_.addEventListener('click', this.print_.bind(this)); | 204 this.printButton_.addEventListener('click', this.print_.bind(this)); |
| 206 | 205 |
| 207 this.editBarSpacer_ = util.createChild(this.toolbar_, 'edit-bar-spacer'); | 206 this.editBarSpacer_ = this.toolbar_.querySelector('.edit-bar-spacer'); |
| 208 this.editBarMain_ = util.createChild(this.editBarSpacer_, 'edit-main'); | 207 this.editBarMain_ = util.createChild(this.editBarSpacer_, 'edit-main'); |
| 209 | 208 |
| 210 this.editBarMode_ = util.createChild(this.container_, 'edit-modal'); | 209 this.editBarMode_ = util.createChild(this.container_, 'edit-modal'); |
| 211 this.editBarModeWrapper_ = util.createChild( | 210 this.editBarModeWrapper_ = util.createChild( |
| 212 this.editBarMode_, 'edit-modal-wrapper'); | 211 this.editBarMode_, 'edit-modal-wrapper'); |
| 213 this.editBarModeWrapper_.hidden = true; | 212 this.editBarModeWrapper_.hidden = true; |
| 214 | 213 |
| 215 // Objects supporting image display and editing. | 214 // Objects supporting image display and editing. |
| 216 this.viewport_ = new Viewport(); | 215 this.viewport_ = new Viewport(); |
| 217 | 216 |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 done = true; | 1329 done = true; |
| 1331 } | 1330 } |
| 1332 }.bind(this); | 1331 }.bind(this); |
| 1333 }; | 1332 }; |
| 1334 | 1333 |
| 1335 /** | 1334 /** |
| 1336 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD | 1335 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD |
| 1337 * horizontally it's considered as a swipe gesture (change the current image). | 1336 * horizontally it's considered as a swipe gesture (change the current image). |
| 1338 */ | 1337 */ |
| 1339 SwipeOverlay.SWIPE_THRESHOLD = 100; | 1338 SwipeOverlay.SWIPE_THRESHOLD = 100; |
| OLD | NEW |