| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 var position = tiles.children.length; | 372 var position = tiles.children.length; |
| 373 logMostVisitedImpression(position, data.tileSource); | 373 logMostVisitedImpression(position, data.tileSource); |
| 374 | 374 |
| 375 tile.className = 'mv-tile'; | 375 tile.className = 'mv-tile'; |
| 376 tile.setAttribute('data-tid', data.tid); | 376 tile.setAttribute('data-tid', data.tid); |
| 377 var html = []; | 377 var html = []; |
| 378 if (!USE_ICONS) { | 378 if (!USE_ICONS) { |
| 379 html.push('<div class="mv-favicon"></div>'); | 379 html.push('<div class="mv-favicon"></div>'); |
| 380 } | 380 } |
| 381 html.push('<div class="mv-title"></div><div class="mv-thumb"></div>'); | 381 html.push('<div class="mv-title"></div><div class="mv-thumb"></div>'); |
| 382 html.push('<div class="mv-x"></div>'); | 382 html.push('<div class="mv-x" role="button"></div>'); |
| 383 tile.innerHTML = html.join(''); | 383 tile.innerHTML = html.join(''); |
| 384 tile.lastElementChild.title = queryArgs['removeTooltip'] || ''; | 384 tile.lastElementChild.title = queryArgs['removeTooltip'] || ''; |
| 385 | 385 |
| 386 if (isSchemeAllowed(data.url)) { | 386 if (isSchemeAllowed(data.url)) { |
| 387 tile.href = data.url; | 387 tile.href = data.url; |
| 388 } | 388 } |
| 389 tile.setAttribute('aria-label', data.title); |
| 389 tile.title = data.title; | 390 tile.title = data.title; |
| 390 if (data.impressionUrl) { | 391 if (data.impressionUrl) { |
| 391 impressionUrl = data.impressionUrl; | 392 impressionUrl = data.impressionUrl; |
| 392 } | 393 } |
| 393 if (data.pingUrl) { | 394 if (data.pingUrl) { |
| 394 tile.addEventListener('click', function(ev) { | 395 tile.addEventListener('click', function(ev) { |
| 395 navigator.sendBeacon(data.pingUrl); | 396 navigator.sendBeacon(data.pingUrl); |
| 396 }); | 397 }); |
| 397 } | 398 } |
| 398 | 399 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 var html = document.querySelector('html'); | 611 var html = document.querySelector('html'); |
| 611 html.dir = 'rtl'; | 612 html.dir = 'rtl'; |
| 612 } | 613 } |
| 613 | 614 |
| 614 window.addEventListener('message', handlePostMessage); | 615 window.addEventListener('message', handlePostMessage); |
| 615 }; | 616 }; |
| 616 | 617 |
| 617 | 618 |
| 618 window.addEventListener('DOMContentLoaded', init); | 619 window.addEventListener('DOMContentLoaded', init); |
| 619 })(); | 620 })(); |
| OLD | NEW |