| 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 link.innerText = entries[i].title; | |
| 19 link.setAttribute('href', entries[i].url); | |
| 20 listItem.appendChild(link); | |
| 21 list.appendChild(listItem); | |
| 22 } | |
| 23 $('entries-list').appendChild(list); | |
| 24 } | |
| 25 } | |
| 26 | |
| 27 /* All the work we do on load. */ | |
| 28 function onLoadWork() { | |
| 29 chrome.send('requestEntries'); | |
| 30 } | |
| 31 | |
| 32 document.addEventListener('DOMContentLoaded', onLoadWork); | |
| OLD | NEW |