Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 /** | 5 /** |
| 6 * Takes the |nearbyUrlsData| input argument which holds metadata for web pages | 6 * Takes the |nearbyUrlsData| input argument which holds metadata for web pages |
| 7 * broadcast by nearby devices. | 7 * broadcast by nearby devices. |
| 8 * @param {Object} nearbyUrlsData Information about web pages broadcast by | 8 * @param {Object} nearbyUrlsData Information about web pages broadcast by |
| 9 * nearby devices | 9 * nearby devices |
| 10 */ | 10 */ |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 | 23 |
| 24 function returnNearbyURLs(nearbyUrlsData) { | 24 function returnNearbyURLs(nearbyUrlsData) { |
| 25 var bodyContainer = $('body-container'); | 25 var bodyContainer = $('body-container'); |
| 26 renderTemplate(nearbyUrlsData); | 26 renderTemplate(nearbyUrlsData); |
| 27 bodyContainer.hidden = false; | 27 bodyContainer.hidden = false; |
| 28 | 28 |
| 29 if (nearbyUrlsData['metadata'].length == 0) { | 29 if (nearbyUrlsData['metadata'].length == 0) { |
| 30 var emptyMessage = $('empty-list-container'); | 30 var emptyMessage = $('empty-list-container'); |
| 31 emptyMessage.hidden = false; | 31 emptyMessage.hidden = false; |
| 32 } | 32 } |
| 33 assignImageLoadErrorHandlers(); | |
| 34 } | |
| 35 | |
| 36 function assignImageLoadErrorHandlers() { | |
| 37 var pwIcons = document.querySelectorAll('.physicalWebIcon'); | |
| 38 pwIcons.forEach(function(e) { | |
| 39 let img = e.getElementsByTagName('img')[0]; | |
|
mmocny
2017/03/23 20:58:39
Could we just change the querySelectorAll to do th
Ran
2017/03/24 17:48:29
Done.
| |
| 40 img.addEventListener('error', function() { | |
| 41 img.src = | |
| 42 'chrome://physical-web/ic_link_grey600_36dp.png'; | |
| 43 }); | |
| 44 }); | |
| 33 } | 45 } |
| 34 | 46 |
| 35 document.addEventListener('DOMContentLoaded', requestNearbyURLs); | 47 document.addEventListener('DOMContentLoaded', requestNearbyURLs); |
| OLD | NEW |