| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <div id="button" class="toolstrip-button"> | 2 <div id="button" class="toolstrip-button"> |
| 3 <img id="icon" src="icon_disabled.png"><span>Subscribe</span> | 3 <img id="icon" src="icon_disabled.png"><span>Subscribe</span> |
| 4 </div> | 4 </div> |
| 5 | 5 |
| 6 <script> | 6 <script> |
| 7 var icon = document.getElementById("icon"); | 7 var icon = document.getElementById("icon"); |
| 8 var button = document.getElementById("button"); | 8 var button = document.getElementById("button"); |
| 9 var enabled = false; | 9 var enabled = false; |
| 10 var feedUrl, req; | 10 var feedUrl, req; |
| 11 | 11 |
| 12 button.onclick = handleClick; | 12 button.onclick = handleClick; |
| 13 | 13 |
| 14 chrome.self.onConnect.addListener(function(port) { | 14 chrome.extension.onConnect.addListener(function(port) { |
| 15 port.onMessage.addListener(function(feedUrls) { | 15 port.onMessage.addListener(function(feedUrls) { |
| 16 // TODO(aa): When we have the ability to display drop downs, we should let | 16 // TODO(aa): When we have the ability to display drop downs, we should let |
| 17 // the user pick which feed to subscribe. Right now, we just pick the | 17 // the user pick which feed to subscribe. Right now, we just pick the |
| 18 // first. | 18 // first. |
| 19 feedUrl = feedUrls[0]; | 19 feedUrl = feedUrls[0]; |
| 20 if (!feedUrl) { | 20 if (!feedUrl) { |
| 21 icon.src = "icon_disabled.png"; | 21 icon.src = "icon_disabled.png"; |
| 22 enabled = false; | 22 enabled = false; |
| 23 } else { | 23 } else { |
| 24 icon.src = "icon.png"; | 24 icon.src = "icon.png"; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 function handleClick() { | 45 function handleClick() { |
| 46 if (enabled) { | 46 if (enabled) { |
| 47 var url = "http://www.google.com/reader/view/feed/" + feedUrl; | 47 var url = "http://www.google.com/reader/view/feed/" + feedUrl; |
| 48 chrome.tabs.create({url: url}); | 48 chrome.tabs.create({url: url}); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 </script> | 51 </script> |
| 52 </html> | 52 </html> |
| OLD | NEW |