Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
aureliendavid committed Oct 29, 2018
1 parent a83dad4 commit 282ddf2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 194 deletions.
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"manifest_version": 2,
"name": "RSSPreview",
"version": "1.3",
"version": "2.0",
"author": "Aurelien David",
"homepage_url": "https://github.com/aureliendavid/rsspreview",

Expand All @@ -29,7 +29,7 @@
}
],

"web_accessible_resources": ["preview.html", "preview.js", "preview.css", "rss.xsl", "icons/*.png"],
"web_accessible_resources": ["preview.css", "rss.xsl", "icons/*.png"],

"permissions": ["<all_urls>", "webRequest", "webRequestBlocking"]

Expand Down
17 changes: 0 additions & 17 deletions preview.html

This file was deleted.

143 changes: 0 additions & 143 deletions preview.js

This file was deleted.

60 changes: 28 additions & 32 deletions rsspreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,34 @@
}


function extensionimages() {

var extimgs = document.getElementsByClassName("extImg");
for (var i = 0; i<extimgs.length; i++) {
extimgs[i].src = chrome.extension.getURL(extimgs[i].attributes['data-src'].nodeValue);
}

}

function makepreviewhtml() {

var doc = document.implementation.createHTMLDocument("");

var feedBody = doc.createElement("div");
feedBody.id = "feedBody";
doc.body.appendChild(feedBody);

var css = doc.createElement('link');
css.setAttribute('rel', 'stylesheet');
css.setAttribute('href', chrome.extension.getURL("preview.css"));
doc.head.appendChild(css);

return doc;


}


function detect() {

var rootNode = document.getRootNode().documentElement;
Expand Down Expand Up @@ -170,33 +198,6 @@
}


function extensionimages() {

var extimgs = document.getElementsByClassName("extImg");
for (var i = 0; i<extimgs.length; i++) {
extimgs[i].src = chrome.extension.getURL(extimgs[i].attributes['data-src'].nodeValue);
}

}

function makepreviewhtml() {

var doc = document.implementation.createHTMLDocument("");

var feedBody = doc.createElement("div");
feedBody.id = "feedBody";
doc.body.appendChild(feedBody);

var css = doc.createElement('link');
css.setAttribute('rel', 'stylesheet');
css.setAttribute('href', chrome.extension.getURL("preview.css"));
doc.head.appendChild(css);

return doc;


}

function main(feedNode) {

var feed_url = window.location.href;
Expand All @@ -209,11 +210,6 @@

// replace the content with the preview document
document.replaceChild(document.importNode(preview.documentElement, true), document.documentElement);
window.document = preview;

console.log(preview);
console.log(window.document);
console.log(document);

removeemptyenclosures();
formatdescriptions();
Expand Down

0 comments on commit 282ddf2

Please sign in to comment.