Skip to content

Commit

Permalink
Feed Detection Improved with all known content types and base_url app…
Browse files Browse the repository at this point in the history
…end if needed

Release 1.0.12
  • Loading branch information
DEKHTIARJonathan committed Sep 27, 2017
1 parent bec4093 commit a3e2b25
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
39 changes: 34 additions & 5 deletions app/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,40 @@ function checkRSSFeeds() {
chrome.tabs.executeScript(
tabs[0].id,
{
code: 'var rss_tag = document.querySelector("[type=\'application/rss+xml\']"); \
if (rss_tag == null){rss_tag = document.querySelector("[type=\'application/atom+xml\']");} \
if (rss_tag == null) {\
if (["application/xhtml+xml","application/xml"].indexOf(document.contentType) > -1){document.documentURI;} else{null;} \
} else { rss_tag.getAttribute("href");}'
code: `
var RSS_CONTENT_TYPES = [
"application/xhtml+xml",
"application/xml",
"application/atom+xml",
"application/rss+xml",
"application/rdf+xml",
"text/xml"
]
var rss_tag = null;
for (x in RSS_CONTENT_TYPES){
rss_tag = document.querySelector("[type=\'"+RSS_CONTENT_TYPES [x]+"\']");
if (rss_tag != null){
feed_url = rss_tag.getAttribute("href");
break;
}
}
if (rss_tag == null) {
if (RSS_CONTENT_TYPES.indexOf(document.contentType) > -1){
feed_url = document.documentURI;
} else {
null;
}
}
if (feed_url[0] == "/" && feed_url.substring(0, 2) != "//"){
feed_url = window.location.origin + feed_url;
}
feed_url
`
},
function(rss_href){
if(chrome.runtime.lastError == undefined){
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"short_name": "Feedcrunch",
"author": "Jonathan DEKHTIAR",
"manifest_version": 2,
"version": "1.0.11",
"version": "1.0.12",

"description": "Feedcrunch.IO - Chrome Extension",
"icons": {
Expand Down

0 comments on commit a3e2b25

Please sign in to comment.