Difference between revisions of "Template:IONIS Paris/JS"

Line 49: Line 49:
 
});
 
});
 
//NB
 
//NB
 +
function findFeedLinks() {
 +
// Find all the RSS link elements.
 +
var result = document.evaluate(
 +
'//*[local-name()="link"][contains(@rel, "alternate")] ' +
 +
'[contains(@type, "rss") or contains(@type, "atom") or ' +
 +
'contains(@type, "rdf")]', document, null, 0, null
 +
);
 +
 +
var feeds = [];
 +
var item;
 +
while (item = result.iterateNext()) {
 +
feeds.push({"href": item.href, "title": item.title});
 +
}
 +
 +
if (feeds.length == 0)
 +
return false;
 +
 +
// Notify the extension needs to show the RSS page action icon.
 +
sendMessage({type: "feedsFound", feeds: feeds});
 +
return true;
 +
};
 +
  
 
// NOTEBOOK
 
// NOTEBOOK

Revision as of 21:01, 11 September 2015