| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 243 |
| 244 // Only fade in the new tiles if there were tiles before. | 244 // Only fade in the new tiles if there were tiles before. |
| 245 var fadeIn = false; | 245 var fadeIn = false; |
| 246 var old = parent.querySelector('#mv-tiles'); | 246 var old = parent.querySelector('#mv-tiles'); |
| 247 if (old) { | 247 if (old) { |
| 248 fadeIn = true; | 248 fadeIn = true; |
| 249 // Mark old tile DIV for removal after the transition animation is done. | 249 // Mark old tile DIV for removal after the transition animation is done. |
| 250 old.removeAttribute('id'); | 250 old.removeAttribute('id'); |
| 251 old.classList.add('mv-tiles-old'); | 251 old.classList.add('mv-tiles-old'); |
| 252 old.style.opacity = 0.0; | 252 old.style.opacity = 0.0; |
| 253 cur.addEventListener('webkitTransitionEnd', function(ev) { | 253 cur.addEventListener('transitionend', function(ev) { |
| 254 if (ev.target === cur) { | 254 if (ev.target === cur) { |
| 255 removeAllOldTiles(); | 255 removeAllOldTiles(); |
| 256 } | 256 } |
| 257 }); | 257 }); |
| 258 } | 258 } |
| 259 | 259 |
| 260 // Add new tileset. | 260 // Add new tileset. |
| 261 cur.id = 'mv-tiles'; | 261 cur.id = 'mv-tiles'; |
| 262 parent.appendChild(cur); | 262 parent.appendChild(cur); |
| 263 // getComputedStyle causes the initial style (opacity 0) to be applied, so | 263 // getComputedStyle causes the initial style (opacity 0) to be applied, so |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 }; | 306 }; |
| 307 | 307 |
| 308 /** | 308 /** |
| 309 * Called when the user decided to add a tile to the blacklist. | 309 * Called when the user decided to add a tile to the blacklist. |
| 310 * It sets off the animation for the blacklist and sends the blacklisted id | 310 * It sets off the animation for the blacklist and sends the blacklisted id |
| 311 * to the host page. | 311 * to the host page. |
| 312 * @param {Element} tile DOM node of the tile we want to remove. | 312 * @param {Element} tile DOM node of the tile we want to remove. |
| 313 */ | 313 */ |
| 314 var blacklistTile = function(tile) { | 314 var blacklistTile = function(tile) { |
| 315 tile.classList.add('blacklisted'); | 315 tile.classList.add('blacklisted'); |
| 316 tile.addEventListener('webkitTransitionEnd', function(ev) { | 316 tile.addEventListener('transitionend', function(ev) { |
| 317 if (ev.propertyName != 'width') return; | 317 if (ev.propertyName != 'width') return; |
| 318 | 318 |
| 319 window.parent.postMessage({cmd: 'tileBlacklisted', | 319 window.parent.postMessage({cmd: 'tileBlacklisted', |
| 320 tid: Number(tile.getAttribute('data-tid'))}, | 320 tid: Number(tile.getAttribute('data-tid'))}, |
| 321 DOMAIN_ORIGIN); | 321 DOMAIN_ORIGIN); |
| 322 }); | 322 }); |
| 323 }; | 323 }; |
| 324 | 324 |
| 325 | 325 |
| 326 /** | 326 /** |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 var html = document.querySelector('html'); | 559 var html = document.querySelector('html'); |
| 560 html.dir = 'rtl'; | 560 html.dir = 'rtl'; |
| 561 } | 561 } |
| 562 | 562 |
| 563 window.addEventListener('message', handlePostMessage); | 563 window.addEventListener('message', handlePostMessage); |
| 564 }; | 564 }; |
| 565 | 565 |
| 566 | 566 |
| 567 window.addEventListener('DOMContentLoaded', init); | 567 window.addEventListener('DOMContentLoaded', init); |
| 568 })(); | 568 })(); |
| OLD | NEW |