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

Unified Diff: chrome/test/data/extensions/subscribe_page_action/popup.html

Issue 10407017: Convert RSS extension to use manifest version 2 (with CSP protection). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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: chrome/test/data/extensions/subscribe_page_action/popup.html
===================================================================
--- chrome/test/data/extensions/subscribe_page_action/popup.html (revision 137495)
+++ chrome/test/data/extensions/subscribe_page_action/popup.html (working copy)
@@ -23,79 +23,9 @@
vertical-align: bottom;
}
</style>
-<script>
-function feedLink(url) {
- var feed_link = document.createElement('a');
- feed_link.href = url;
- feed_link.addEventListener("click", onClick);
- return feed_link;
-}
-
-function main() {
- chrome.tabs.getSelected(null, function(tab) {
- var feeds = chrome.extension.getBackgroundPage().feedData[tab.id];
- if (feeds.length == 1) {
- // Only one feed, no need for a bubble; go straight to the subscribe page.
- preview(feeds[0].href);
- } else {
- var content = document.getElementById('content');
- var heading = document.getElementById('heading');
- heading.innerText =
- chrome.i18n.getMessage("rss_subscription_action_title");
- content.appendChild(document.createElement('br'));
-
- var feed_list = document.createElement('table');
- feed_list.style.width = "400";
- for (var i = 0; i < feeds.length; ++i) {
- // Create an RSS image and the anhor encapsulating it.
- var img_link = feedLink(feeds[i].href);
- var img = document.createElement('img');
- img.src = "feed-icon-16x16.png";
- img_link.appendChild(img);
-
- // Create a text node and the anchor encapsulating it.
- var text_link = feedLink(feeds[i].href);
- text_link.appendChild(document.createTextNode(feeds[i].title));
-
- // Add the data to a row in the table.
- var tr = document.createElement('tr');
- tr.className = "feedList";
- var td = document.createElement('td');
- td.width = "16";
- td.appendChild(img_link);
- var td2 = document.createElement('td');
- td2.appendChild(text_link);
- tr.appendChild(td);
- tr.appendChild(td2);
- feed_list.appendChild(tr);
- }
-
- content.appendChild(feed_list);
- }
- });
-}
-
-function onClick(event) {
- var a = event.currentTarget;
- preview(a.href);
-}
-
-function preview(feed_url) {
- // See if we need to skip the preview page and subscribe directly.
- var url = "";
- if (window.localStorage && window.localStorage.showPreviewPage == "No") {
- // Skip the preview.
- url = window.localStorage.defaultReader.replace("%s", escape(feed_url));
- } else {
- // Show the preview page.
- url = "subscribe.html?" + encodeURIComponent(feed_url);
- }
- chrome.tabs.create({ url: url });
- window.close();
-}
-</script>
+<script type="text/javascript" src="popup.js"></script>
</head>
-<body onload="javascript:main()">
+<body>
<div id="content">
<span id="heading" class="heading">Loading...</span>
</div>

Powered by Google App Engine
This is Rietveld 408576698