Skip to content

Commit

Permalink
Can now add RSS feed if you are visiting one directly.
Browse files Browse the repository at this point in the history
Release 1.0.11
  • Loading branch information
DEKHTIARJonathan committed Sep 27, 2017
1 parent a335dc4 commit bec4093
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 30 deletions.
50 changes: 29 additions & 21 deletions app/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,32 +82,40 @@ function OpenExtensionIFrame(){

function checkRSSFeeds() {
//query the information on the active tab
chrome.tabs.query({active: true, currentWindow: true}, function(tab){

chrome.tabs.executeScript(
tab[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) {null} else {rss_tag.href}'
},
function(rss_href){
if(chrome.runtime.lastError == undefined){
current_rssfedd = rss_href[0];
if (current_rssfedd != null){
chrome.browserAction.setIcon({path: icon_dict.with_rss});
chrome.tabs.query({active: true, currentWindow: true}, function(tabs){

if (tabs.length > 0 && tabs[0].id != undefined){
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");}'
},
function(rss_href){
if(chrome.runtime.lastError == undefined){
current_rssfedd = rss_href[0];
if (current_rssfedd != null){
chrome.browserAction.setIcon({path: icon_dict.with_rss});
}
else {
chrome.browserAction.setIcon({path: icon_dict.no_rss});
}
}
else {
current_rssfedd = null;
chrome.browserAction.setIcon({path: icon_dict.no_rss});
}
}
else {
current_rssfedd = null;
chrome.browserAction.setIcon({path: icon_dict.no_rss});
}

}
);
}
);
}
else{
current_rssfedd = null;
chrome.browserAction.setIcon({path: icon_dict.no_rss});
}
});
}

Expand Down
15 changes: 7 additions & 8 deletions app/content_scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse){

if (iframe_elem === null) {

var iframe = document.createElement('iframe');

var target_webpage = null;
//var iframe = document.createElement('iframe');
var iframe = document.createElementNS('http://www.w3.org/1999/xhtml', 'iframe');

chrome.storage.local.get(['loginToken', 'username'], function(result) {
target_webpage = "templates/";

var target_webpage = "templates/";

if (!(result.loginToken) || !(result.username))
target_webpage += "login.html";
Expand All @@ -24,9 +24,9 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse){
iframe.id = iframe_id;

iframe.style.cssText = 'border: none !important; height: 100% !important; width: 100% !important;' +
'position: fixed !important; z-index: 2147483647 !important; top: 0px !important;' +
'left: 0px !important; display: block !important; max-width: 100% !important;' +
'max-height: 100% !important; padding: 0px !important ;background: rgba(39, 39, 39, 0.74) !important';
'position: fixed !important; z-index: 2147483647 !important; top: 0px !important;' +
'left: 0px !important; display: block !important; max-width: 100% !important;' +
'max-height: 100% !important; padding: 0px !important ;background: rgba(39, 39, 39, 0.74) !important';

document.body.appendChild(iframe);
});
Expand All @@ -42,5 +42,4 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse){
sendResponse({result: "error: command unknown: " + request.command});
}


});
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.10",
"version": "1.0.11",

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

0 comments on commit bec4093

Please sign in to comment.