Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: components/physical_web/webui/resources/physical_web.js

Issue 2698503004: Add empty list indicator for Physical Web WebUI (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 clearScanNotification() {
cco3 2017/02/23 20:07:31 I think the language of "notification" is a bit co
Ran 2017/02/23 20:59:46 Done.
25 var scanningContainer = $('scan-container');
cco3 2017/02/23 20:07:31 This selector isn't going to work. You need the
Ran 2017/02/23 20:59:46 I was referring the "body-container". If I add the
26 scanningContainer.style.visibility = 'hidden';
27 }
28
24 function returnNearbyURLs(nearbyUrlsData) { 29 function returnNearbyURLs(nearbyUrlsData) {
25 var bodyContainer = $('body-container'); 30 var bodyContainer = $('body-container');
26 renderTemplate(nearbyUrlsData); 31 renderTemplate(nearbyUrlsData);
32 bodyContainer.style.visibility = 'visible';
27 33
28 bodyContainer.style.visibility = 'visible'; 34 clearScanNotification();
mattreynolds 2017/02/23 20:18:42 How long does it normally take to receive the URLs
Ran 2017/02/23 20:59:46 It's very fast, when I am doing test, I did't see
mattreynolds 2017/02/23 22:58:19 With the current behavior it should always be inst
35 if (nearbyUrlsData['metadata'].length == 0) {
36 var emptyMessage = $('empty-container');
37 emptyMessage.style.visibility = 'visible';
38 }
29 } 39 }
30 40
31 document.addEventListener('DOMContentLoaded', requestNearbyURLs); 41 document.addEventListener('DOMContentLoaded', requestNearbyURLs);
42 document.addEventListener('DOMContentLoaded', function() {
43 setTimeout(clearScanNotification, 6000);
cco3 2017/02/23 20:07:31 Since we always return nearbyurls right away, this
Ran 2017/02/23 20:59:46 Removed. when I test, it gives the nearbyurls righ
44 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698