Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<html> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
function isXML(doc) { | ||
return !(doc instanceof HTMLDocument || doc instanceof SVGDocument); | ||
} | ||
|
||
function canTransform() { | ||
return document && isXML(document) && document.documentElement; | ||
} | ||
|
||
xv_dom.getByClass = function(class_name, context) { | ||
return _.filter((context || document).getElementsByTagName('*'), function(n) { | ||
return xv_dom.hasClass(n, class_name); | ||
}); | ||
}; | ||
|
||
if (canTransform()) { | ||
var html = xv_dom.fromHTML('<html><body>' + | ||
'<div class="xv-source-pane"><div class="xv-source-pane-inner"></div></div>' + | ||
'</body></html>'); | ||
|
||
var source_doc = document.documentElement; | ||
|
||
var pi = document.createProcessingInstruction('xml-stylesheet', 'type="text/css" href="' + chrome.extension.getURL('xv.css') + '"'); | ||
document.insertBefore(pi, document.firstChild); | ||
|
||
document.replaceChild(html, document.documentElement); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name" : "XV", | ||
"version" : "1.0", | ||
"description" : "View XML files in Google Chrome", | ||
"background_page": "background.html", | ||
"permissions" : [ | ||
"tabs", | ||
"http://*/*", | ||
"https://*/*" | ||
], | ||
"content_scripts": [{ | ||
"js": ["xv.js", "controller.js"], | ||
"matches": ["http://*/*", "https://*/*", "file://*/*"], | ||
"run_at": "document_end" | ||
}] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.