Chromium Code Reviews| 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++) { | |
| 16 var listItem = document.createElement('li'); | |
| 17 var link = document.createElement('a'); | |
| 18 var linkHref = document.createAttribute('href'); | |
|
Evan Stade
2013/09/11 01:44:01
setAttribute()
nyquist
2013/09/12 17:42:12
Done.
| |
| 19 var text = document.createTextNode(entries[i].title); | |
|
Evan Stade
2013/09/11 01:44:01
innerText =
nyquist
2013/09/12 17:42:12
Done.
| |
| 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. */ | |
| 31 function onLoadWork() { | |
| 32 chrome.send('requestEntries'); | |
| 33 } | |
| 34 | |
| 35 document.addEventListener('DOMContentLoaded', onLoadWork); | |
| OLD | NEW |