OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 /** | |
6 * Callback from the backend with the list of entries to display. | |
7 * This call will build the entries section of the DOM distiller page, or hide | |
8 * that section if there are none to display. | |
9 * @param {!Array.<string>} entries The entries. | |
10 */ | |
11 function onGotEntries(entries) { | |
12 $('entries-section').hidden = !entries.length; | |
13 if (entries.length > 0) { | |
14 var list = document.createElement('ul'); | |
15 for (var i=0; i < entries.length; i++) { | |
stuartmorgan
2013/09/12 05:25:24
Spaces around =
nyquist
2013/09/12 17:42:12
Done.
| |
16 var listItem = document.createElement('li'); | |
17 var link = document.createElement('a'); | |
18 var linkHref = document.createAttribute('href'); | |
19 var text = document.createTextNode(entries[i].title); | |
20 link.appendChild(text); | |
21 linkHref.nodeValue = entries[i].url; | |
22 link.setAttributeNode(linkHref); | |
23 listItem.appendChild(link); | |
24 list.appendChild(listItem); | |
25 } | |
26 $('entries-list').appendChild(list); | |
27 } | |
28 } | |
29 | |
30 /* All the work we do onload. */ | |
stuartmorgan
2013/09/12 05:25:24
on load
nyquist
2013/09/12 17:42:12
Done.
| |
31 function onLoadWork() { | |
32 chrome.send('requestEntries'); | |
33 } | |
34 | |
35 document.addEventListener('DOMContentLoaded', onLoadWork); | |
OLD | NEW |