Testing ground works in Firefox

This commit is contained in:
Felix Krause 2016-01-13 23:11:03 +01:00
parent bbd2e297e4
commit f543bc231a
4 changed files with 17 additions and 12 deletions

View File

@ -30,7 +30,7 @@
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small>Made with Nim. Generated: 2016-01-13 22:41:14 UTC</small>
<small>Made with Nim. Generated: 2016-01-13 23:09:48 UTC</small>
</div>
</div>
</div>

View File

@ -311,7 +311,7 @@ contains all local tags that are used for type serialization. Does not contain a
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small>Made with Nim. Generated: 2016-01-13 22:41:14 UTC</small>
<small>Made with Nim. Generated: 2016-01-13 23:09:48 UTC</small>
</div>
</div>
</div>

View File

@ -82,6 +82,12 @@
</div>
</article>
<script type="text/javascript">
function setTextContent(element, text) {
while (element.firstChild!==null) {
element.removeChild(element.firstChild); // remove all existing content
}
element.appendChild(document.createTextNode(text));
}
function parse() {
var r = new XMLHttpRequest();
var params = "style=" + encodeURIComponent(document.querySelector(
@ -96,28 +102,27 @@
var result = JSON.parse(r.responseText);
switch(result.code) {
case 0:
output.innerText = result.output;
setTextContent(output, result.output);
output.style.color = "black";
break;
case 1:
output.innerText = "Parser error at line " + result.line +
setTextContent(output, "Parser error at line " + result.line +
", column " + result.column + ":\n" + result.message +
"\n\n" + result.detail;
"\n\n" + result.detail);
output.style.color = "orange";
break;
case 2:
output.innerText = "Presenter error:\n" + result.message;
setTextContent(output, "Presenter error:\n" + result.message);
output.style.color = "orange";
break;
}
} else if (r.status == 0) {
output.innerText =
"YAML parser server does not seem to be available.";
setTextContent(output,
"YAML parser server does not seem to be available.");
output.style.color = "red";
} else {
output.innerText = "Status: " + r.status +
"\nException occurred on server:\n\n" +
r.responseText;
setTextContent(output, "Status: " + r.status +
"\nException occurred on server:\n\n" + r.responseText);
output.style.color = "red";
}
}

View File

@ -726,7 +726,7 @@ Parser <tt class="docutils literal"><span class="pre">input</span></tt> as YAML
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small>Made with Nim. Generated: 2016-01-13 22:41:13 UTC</small>
<small>Made with Nim. Generated: 2016-01-13 23:09:47 UTC</small>
</div>
</div>
</div>