| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 if (window == top) { | 5 findFeeds(); |
| 6 findFeeds(); | 6 window.addEventListener("focus", findFeeds); |
| 7 window.addEventListener("focus", findFeeds); | |
| 8 } | |
| 9 | 7 |
| 10 function findFeeds() { | 8 function findFeeds() { |
| 11 // Find all the RSS link elements. | 9 // Find all the RSS link elements. |
| 12 var result = document.evaluate( | 10 var result = document.evaluate( |
| 13 '//link[@rel="alternate"][contains(@type, "rss") or ' + | 11 '//link[@rel="alternate"][contains(@type, "rss") or ' + |
| 14 'contains(@type, "atom") or contains(@type, "rdf")]', | 12 'contains(@type, "atom") or contains(@type, "rdf")]', |
| 15 document, null, 0, null); | 13 document, null, 0, null); |
| 16 | 14 |
| 17 var feeds = []; | 15 var feeds = []; |
| 18 var item; | 16 var item; |
| 19 while (item = result.iterateNext()) | 17 while (item = result.iterateNext()) |
| 20 feeds.push(item.href); | 18 feeds.push(item.href); |
| 21 | 19 |
| 22 // Notify the extension of the feed URLs we found. | 20 // Notify the extension of the feed URLs we found. |
| 23 chrome.extension.connect().postMessage(feeds); | 21 chrome.extension.connect().postMessage(feeds); |
| 24 } | 22 } |
| OLD | NEW |