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 */ |
11 function renderTemplate(nearbyUrlsData) { | 11 function renderTemplate(nearbyUrlsData) { |
12 // This is the javascript code that processes the template: | 12 // This is the javascript code that processes the template: |
13 jstProcess(new JsEvalContext(nearbyUrlsData), $('physicalWebTemplate')); | 13 jstProcess(new JsEvalContext(nearbyUrlsData), $('physicalWebTemplate')); |
14 } | 14 } |
15 | 15 |
16 function requestNearbyURLs() { | 16 function requestNearbyURLs() { |
17 chrome.send('requestNearbyURLs'); | 17 chrome.send('requestNearbyURLs'); |
18 } | 18 } |
19 | 19 |
20 function physicalWebItemClicked(index) { | 20 function physicalWebItemClicked(index) { |
21 chrome.send('physicalWebItemClicked', [index]); | 21 chrome.send('physicalWebItemClicked', [index]); |
22 } | 22 } |
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.style.visibility = 'visible'; | |
cco3
2017/02/23 23:36:54
Just use the appropriate jquery method:
$('#body-c
cco3
2017/02/23 23:39:33
I saw your other comment. This is definitely usin
Ran
2017/02/24 18:52:59
The show and hide() function is not available, I g
| |
27 | 28 |
28 bodyContainer.style.visibility = 'visible'; | 29 if (nearbyUrlsData['metadata'].length == 0) { |
30 var emptyMessage = $('empty-container'); | |
31 emptyMessage.style.visibility = 'visible'; | |
32 } | |
29 } | 33 } |
30 | 34 |
31 document.addEventListener('DOMContentLoaded', requestNearbyURLs); | 35 document.addEventListener('DOMContentLoaded', requestNearbyURLs); |
OLD | NEW |