Skip to content

Commit

Permalink
resolve #15
Browse files Browse the repository at this point in the history
- 0.10.0 fix for Safari
  • Loading branch information
ejci committed Nov 16, 2014
1 parent f10f5f4 commit 7fb809d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Binary file added releases/nepi-jano_0.10.0.xpi
Binary file not shown.
Binary file modified releases/nepi_jano_0.10.0.safariextz
Binary file not shown.
1 change: 0 additions & 1 deletion safari/nepi_jano.safariextension/global.html
Expand Up @@ -10,7 +10,6 @@
xhr.send();
function handleStateChange() {
if (xhr.readyState === 4) {
console.log('responseText', xhr.responseText);
var data = xhr.responseText;
event.target.page.dispatchMessage("article", data);
}
Expand Down
11 changes: 6 additions & 5 deletions safari/nepi_jano.safariextension/nepijano.js
@@ -1,5 +1,5 @@
/**
* @fileOverview Nepi Jano Google Chrome extension
* @fileOverview Nepi Jano Safari extension
* @author Miroslav Magda, http://blog.ejci.net
* @version 0.10.0
*/
Expand Down Expand Up @@ -106,14 +106,15 @@ if (/sme.sk\/c\//i.test(document.location)) {
}
}

safari.self.addEventListener("message", function(responseText) {
var doc = (new DOMParser()).parseFromString(responseText, "text/html");
safari.self.addEventListener("message", function(event) {
console.log(event.message);
var doc = (new DOMParser()).parseFromString(event.message, "text/html");
doc = utils.removeSelector(doc, 'script');
doc = utils.removeSelector(doc, 'link');
doc = utils.removeSelector(doc, 'style');
doc = utils.removeSelector(doc, '.button-bar');
doc = utils.fixAnchors(doc);
doc = utils.fixVideos(doc);
cb(doc.querySelector('.articlewrap'));
document.querySelector('#article-box #itext_content').innerHTML = html.innerHTML;
console.log(doc);
document.querySelector('#article-box #itext_content').innerHTML = doc.querySelector('.articlewrap').innerHTML;
}, false);

0 comments on commit 7fb809d

Please sign in to comment.