Skip to content

Commit

Permalink
trying
Browse files Browse the repository at this point in the history
  • Loading branch information
Akihisa Yamada committed Feb 26, 2021
1 parent 11e8f66 commit ff7a82d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ function seconds2str(s) {
s = s%60;
return (d>0? d + 'd ' : '') + h + ':' + String(m).padStart(2,0) + ':' + String(s).padStart(2,0);
}
var dom_parser = new DOMParser();
function parseXML(text) {
dom_parser.parseFromString(text,"text/xml");
}
function newXMLHttp() {
return window.ActiveXObject ? new ActiveXObject("Msxml2.XMLHTTP") : new XMLHttpRequest();
}
Expand All @@ -34,7 +38,7 @@ function syncURL(url) {
return xhttp;
}
function XmlOfURL(url) {
return syncURL(url).responseXML;
return parseXML(syncURL(url).responseText);
}
function loadURL(url,handle) {
var xhttp = newXMLHttp();
Expand Down
3 changes: 1 addition & 2 deletions tpdb.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
<body>
<div id="main"></div>
<script>
var parser = new DOMParser();
var elm = document.getElementById("main");
if( "path" in get_args ) {
var path = get_args["path"];
var ver = "ver" in get_args ? get_args["ver"] : "master";
var base = "https://raw.githubusercontent.com/TermCOMP/TPDB/" + ver + "/";
loadURL(base + path,
function(xhttp) {
var xml = parser.parseFromString(xhttp.responseText,"text/xml");
var xml = parseXML(xhttp.responseText);
applyXSL(xml, base + "xml/xtcHTML.xsl", elm);
}
);
Expand Down

0 comments on commit ff7a82d

Please sign in to comment.