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('ntp', function() { | 5 cr.define('ntp', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 // We can't pass the currently dragging tile via dataTransfer because of | 8 // We can't pass the currently dragging tile via dataTransfer because of |
9 // http://crbug.com/31037 | 9 // http://crbug.com/31037 |
10 var currentlyDraggingTile = null; | 10 var currentlyDraggingTile = null; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // 'real' as opposed to doppleganger. | 53 // 'real' as opposed to doppleganger. |
54 this.className = 'tile real'; | 54 this.className = 'tile real'; |
55 this.appendChild(contents); | 55 this.appendChild(contents); |
56 contents.tile = this; | 56 contents.tile = this; |
57 | 57 |
58 this.addEventListener('dragstart', this.onDragStart_); | 58 this.addEventListener('dragstart', this.onDragStart_); |
59 this.addEventListener('drag', this.onDragMove_); | 59 this.addEventListener('drag', this.onDragMove_); |
60 this.addEventListener('dragend', this.onDragEnd_); | 60 this.addEventListener('dragend', this.onDragEnd_); |
61 | 61 |
62 this.firstChild.addEventListener( | 62 this.firstChild.addEventListener( |
63 'webkitAnimationEnd', this.onContentsAnimationEnd_.bind(this)); | 63 'animationend', this.onContentsAnimationEnd_.bind(this)); |
64 | 64 |
65 this.eventTracker = new EventTracker(); | 65 this.eventTracker = new EventTracker(); |
66 }, | 66 }, |
67 | 67 |
68 get index() { | 68 get index() { |
69 return Array.prototype.indexOf.call(this.tilePage.tileElements_, this); | 69 return Array.prototype.indexOf.call(this.tilePage.tileElements_, this); |
70 }, | 70 }, |
71 | 71 |
72 get tilePage() { | 72 get tilePage() { |
73 return findAncestorByClass(this, 'tile-page'); | 73 return findAncestorByClass(this, 'tile-page'); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 * @param {boolean=} opt_animate Whether the animation should be animated. | 297 * @param {boolean=} opt_animate Whether the animation should be animated. |
298 */ | 298 */ |
299 doRemove: function(opt_animate) { | 299 doRemove: function(opt_animate) { |
300 if (opt_animate) | 300 if (opt_animate) |
301 this.firstChild.classList.add('removing-tile-contents'); | 301 this.firstChild.classList.add('removing-tile-contents'); |
302 else | 302 else |
303 this.tilePage.removeTile(this, false); | 303 this.tilePage.removeTile(this, false); |
304 }, | 304 }, |
305 | 305 |
306 /** | 306 /** |
307 * Callback for the webkitAnimationEnd event on the tile's contents. | 307 * Callback for the animationend event on the tile's contents. |
308 * @param {Event} e The event object. | 308 * @param {Event} e The event object. |
309 */ | 309 */ |
310 onContentsAnimationEnd_: function(e) { | 310 onContentsAnimationEnd_: function(e) { |
311 if (this.firstChild.classList.contains('new-tile-contents')) | 311 if (this.firstChild.classList.contains('new-tile-contents')) |
312 this.firstChild.classList.remove('new-tile-contents'); | 312 this.firstChild.classList.remove('new-tile-contents'); |
313 if (this.firstChild.classList.contains('removing-tile-contents')) | 313 if (this.firstChild.classList.contains('removing-tile-contents')) |
314 this.tilePage.removeTile(this, true); | 314 this.tilePage.removeTile(this, true); |
315 }, | 315 }, |
316 }; | 316 }; |
317 | 317 |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 }; | 1315 }; |
1316 | 1316 |
1317 return { | 1317 return { |
1318 getCurrentlyDraggingTile: getCurrentlyDraggingTile, | 1318 getCurrentlyDraggingTile: getCurrentlyDraggingTile, |
1319 setCurrentDropEffect: setCurrentDropEffect, | 1319 setCurrentDropEffect: setCurrentDropEffect, |
1320 // Not used outside, just for usage in JSDoc inside this file. | 1320 // Not used outside, just for usage in JSDoc inside this file. |
1321 Tile: Tile, | 1321 Tile: Tile, |
1322 TilePage: TilePage, | 1322 TilePage: TilePage, |
1323 }; | 1323 }; |
1324 }); | 1324 }); |
OLD | NEW |