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

Side by Side Diff: chrome/test/data/extensions/samples/subscribe/toolstrip.html

Issue 99172: Part 1 of sample sprucing. (Closed)
Patch Set: Added buildbot.crx, since that seems like something people might want to install. Created 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 <html>
2 <link rel="stylesheet" type="text/css" href="extensions_toolstrip.css">
3 <div id="button" class="toolstrip-button">
4 <img id="icon" src="icon_disabled.png"><span>Subscribe</span>
5 </div>
6
7 <script>
8 var icon = document.getElementById("icon");
9 var button = document.getElementById("button");
10 var enabled = false;
11 var feedUrl, req;
12
13 button.onclick = handleClick;
14
15 chromium.self.onConnect.addListener(function(port) {
16 port.onMessage.addListener(function(feedUrls) {
17 // TODO(aa): When we have the ability to display drop downs, we should let
18 // the user pick which feed to subscribe. Right now, we just pick the
19 // first.
20 feedUrl = feedUrls[0];
21 if (!feedUrl) {
22 icon.src = "icon_disabled.png";
23 enabled = false;
24 } else {
25 icon.src = "icon.png";
26 enabled = true;
27
28 feedUrl = encodeURIComponent(feedUrl);
29 req = new XMLHttpRequest();
30 req.onload = handleResponse;
31 req.open("GET",
32 "http://www.google.com/reader/api/0/subscribed?s=feed%2F" + fee dUrl,
33 false);
34 req.send(null);
35 }
36 });
37 });
38
39 function handleResponse() {
40 if (req.responseText == "true") {
41 icon.src = "icon_subscribed.png";
42 enabled = false;
43 }
44 }
45
46 function handleClick() {
47 if (enabled) {
48 var url = "http://www.google.com/reader/view/feed/" + feedUrl;
49 chromium.tabs.createTab({url: url});
50 }
51 }
52 </script>
53 </html>
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/samples/subscribe/manifest.json ('k') | chrome/test/data/extensions/test/Resizer/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698