Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
Akihisa Yamada committed Feb 26, 2021
1 parent 20e1a18 commit 30ec26c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
32 changes: 30 additions & 2 deletions definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,44 @@ function seconds2str(s) {
s = s%60;
return (d>0? d + 'd ' : '') + h + ':' + String(m).padStart(2,0) + ':' + String(s).padStart(2,0);
}
function newXMLHttp() {
return window.ActiveXObject ? ActiveXObject("Msxml2.XMLHTTP") : XMLHttpRequest();
}
function syncURL(url) {
xhttp = newHTTP();
xhttp.open("GET", url, false);
try {xhttp.responseType = "msxml-document"} catch(err) {} // Helping IE11
xhttp.send("");
return xhttp;
}
function XmlOfURL(url) {
return syncURL(url).responseXML;
}
function loadURL(url,handle) {
var xhttp = new XMLHttpRequest();
var xhttp = newXMLHttp();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
handle(this);
}
};
xhttp.open("GET", encodeURI(url));
xhttp.open("GET", url);
xhttp.send();
}
function applyXSL(xml,xslUrl,elm) {
xsl = XmlOfURL(xslUrl);
// code for IE
if (window.ActiveXObject || xhttp.responseType == "msxml-document") {
ex = xml.transformNode(xsl);
elm.innerHTML = ex;
}
// code for Chrome, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument) {
xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml, document);
elm.appendChild(resultDocument);
}
}
function FilteredTable(table) {
var ret = {};
ret.table = table;
Expand Down
8 changes: 5 additions & 3 deletions tpdb.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
<body>
<div id="main"></div>
<script>

var path = get_args["path"];
var ver = "ver" in get_args ? get_args["ver"] : "master";
loadURL( "https://raw.githubusercontent.com/TermCOMP/TPDB/" + ver + "/" + path,
function (http) {
document.getElementById("main").innerHTML = http.responseText;
var base = "https://raw.githubusercontent.com/TermCOMP/TPDB/" + ver + "/";
loadURL( base + path,
function (xhttp) {
applyXSL(xhttp.responseText, base + "xml/xtcHTML.xsl", document.getElementById("main").innerHTML);
}
);
</script>
Expand Down

0 comments on commit 30ec26c

Please sign in to comment.