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

Unified Diff: components/dom_distiller/webui/resources/about_dom_distiller.js

Issue 23503042: Initial WebUI for DOM Distiller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added dependency for dom_distiller_resources Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/webui/resources/about_dom_distiller.js
diff --git a/components/dom_distiller/webui/resources/about_dom_distiller.js b/components/dom_distiller/webui/resources/about_dom_distiller.js
new file mode 100644
index 0000000000000000000000000000000000000000..f558d7fa9fb1c0bfd1961ee9a31844dfaaa309cb
--- /dev/null
+++ b/components/dom_distiller/webui/resources/about_dom_distiller.js
@@ -0,0 +1,32 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * Callback from the backend with the list of entries to display.
+ * This call will build the entries section of the DOM distiller page, or hide
+ * that section if there are none to display.
+ * @param {!Array.<string>} entries The entries.
+ */
+function onGotEntries(entries) {
+ $('entries-section').hidden = !entries.length;
+ if (entries.length > 0) {
+ var list = document.createElement('ul');
+ for (var i = 0; i < entries.length; i++) {
+ var listItem = document.createElement('li');
+ var link = document.createElement('a');
+ link.innerText = entries[i].title;
+ link.setAttribute('href', entries[i].url);
+ listItem.appendChild(link);
+ list.appendChild(listItem);
+ }
+ $('entries-list').appendChild(list);
+ }
+}
+
+/* All the work we do on load. */
+function onLoadWork() {
+ chrome.send('requestEntries');
+}
+
+document.addEventListener('DOMContentLoaded', onLoadWork);
« no previous file with comments | « components/dom_distiller/webui/resources/about_dom_distiller.html ('k') | components/dom_distiller_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698