OLD | NEW |
1 /* Copyright 2015 The Chromium Authors. All rights reserved. | 1 /* Copyright 2015 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 // Single iframe for NTP tiles. | 5 // Single iframe for NTP tiles. |
6 (function() { | 6 (function() { |
7 'use strict'; | 7 'use strict'; |
8 | 8 |
9 | 9 |
10 /** | 10 /** |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 // Only fade in the new tiles if there were tiles before. | 254 // Only fade in the new tiles if there were tiles before. |
255 var fadeIn = false; | 255 var fadeIn = false; |
256 var old = parent.querySelector('#mv-tiles'); | 256 var old = parent.querySelector('#mv-tiles'); |
257 if (old) { | 257 if (old) { |
258 fadeIn = true; | 258 fadeIn = true; |
259 // Mark old tile DIV for removal after the transition animation is done. | 259 // Mark old tile DIV for removal after the transition animation is done. |
260 old.removeAttribute('id'); | 260 old.removeAttribute('id'); |
261 old.classList.add('mv-tiles-old'); | 261 old.classList.add('mv-tiles-old'); |
262 old.style.opacity = 0.0; | 262 old.style.opacity = 0.0; |
263 cur.addEventListener('webkitTransitionEnd', function(ev) { | 263 cur.addEventListener('transitionend', function(ev) { |
264 if (ev.target === cur) { | 264 if (ev.target === cur) { |
265 removeAllOldTiles(); | 265 removeAllOldTiles(); |
266 } | 266 } |
267 }); | 267 }); |
268 } | 268 } |
269 | 269 |
270 // Add new tileset. | 270 // Add new tileset. |
271 cur.id = 'mv-tiles'; | 271 cur.id = 'mv-tiles'; |
272 parent.appendChild(cur); | 272 parent.appendChild(cur); |
273 // getComputedStyle causes the initial style (opacity 0) to be applied, so | 273 // getComputedStyle causes the initial style (opacity 0) to be applied, so |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 }; | 322 }; |
323 | 323 |
324 /** | 324 /** |
325 * Called when the user decided to add a tile to the blacklist. | 325 * Called when the user decided to add a tile to the blacklist. |
326 * It sets of the animation for the blacklist and sends the blacklisted id | 326 * It sets of the animation for the blacklist and sends the blacklisted id |
327 * to the host page. | 327 * to the host page. |
328 * @param {Element} tile DOM node of the tile we want to remove. | 328 * @param {Element} tile DOM node of the tile we want to remove. |
329 */ | 329 */ |
330 var blacklistTile = function(tile) { | 330 var blacklistTile = function(tile) { |
331 tile.classList.add('blacklisted'); | 331 tile.classList.add('blacklisted'); |
332 tile.addEventListener('webkitTransitionEnd', function(ev) { | 332 tile.addEventListener('transitionend', function(ev) { |
333 if (ev.propertyName != 'width') return; | 333 if (ev.propertyName != 'width') return; |
334 | 334 |
335 window.parent.postMessage({cmd: 'tileBlacklisted', | 335 window.parent.postMessage({cmd: 'tileBlacklisted', |
336 tid: Number(tile.getAttribute('data-tid'))}, | 336 tid: Number(tile.getAttribute('data-tid'))}, |
337 DOMAIN_ORIGIN); | 337 DOMAIN_ORIGIN); |
338 }); | 338 }); |
339 }; | 339 }; |
340 | 340 |
341 | 341 |
342 /** | 342 /** |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 var html = document.querySelector('html'); | 606 var html = document.querySelector('html'); |
607 html.dir = 'rtl'; | 607 html.dir = 'rtl'; |
608 } | 608 } |
609 | 609 |
610 window.addEventListener('message', handlePostMessage); | 610 window.addEventListener('message', handlePostMessage); |
611 }; | 611 }; |
612 | 612 |
613 | 613 |
614 window.addEventListener('DOMContentLoaded', init); | 614 window.addEventListener('DOMContentLoaded', init); |
615 })(); | 615 })(); |
OLD | NEW |