aboutsummaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-02-16 14:10:00 +0100
committerClifford Wolf <clifford@clifford.at>2015-02-16 14:10:00 +0100
commit4c22195c38753265c91d2406ba5d8c39e84a0749 (patch)
tree492dc21a7ff066bdbcd33104b5291d9701b666be /misc
parent3e5e9a38895b0ce45c185916fa946dec38ffbab3 (diff)
downloadyosys-4c22195c38753265c91d2406ba5d8c39e84a0749.tar.gz
yosys-4c22195c38753265c91d2406ba5d8c39e84a0749.tar.bz2
yosys-4c22195c38753265c91d2406ba5d8c39e84a0749.zip
YosysJS fixes for firefox
Diffstat (limited to 'misc')
-rw-r--r--misc/yosysjs/demo01.html4
-rw-r--r--misc/yosysjs/yosysjs.js60
2 files changed, 41 insertions, 23 deletions
diff --git a/misc/yosysjs/demo01.html b/misc/yosysjs/demo01.html
index 1bcd99e6b..3f9f737e9 100644
--- a/misc/yosysjs/demo01.html
+++ b/misc/yosysjs/demo01.html
@@ -4,8 +4,8 @@
</head><body onload="document.getElementById('command').focus()">
<h1>YosysJS Example Application #01</h1>
<table width="100%"><tr><td><div id="tabs"></div></td><td align="right"><tt>[ <span onclick="load_example()">load example</span> ]</tt></td></tr></table>
- <svg id="svg" style="display: none; position: absolute; padding: 10px; width: calc(100% - 40px);"></svg>
- <div><textarea id="output" style="width: 100%" rows="30" cols="100"></textarea></div>
+ <svg id="svg" style="display: none; position: absolute; padding: 10px; width: calc(100% - 40px); height: 480px;"></svg>
+ <div><textarea id="output" style="width: 100%; height: 500px"></textarea></div>
<div id="wait" style="display: block"><br/><b><span id="waitmsg">Loading...</span></b></div>
<div id="input" style="display: none"><form onsubmit="window.setTimeout(run_command); return false"><br/><tt><span id="prompt">
</span></tt><input id="command" type="text" onkeydown="history(event)" style="font-family: monospace; font-weight: bold;" size="100"></form></div>
diff --git a/misc/yosysjs/yosysjs.js b/misc/yosysjs/yosysjs.js
index 7c41078eb..87c951183 100644
--- a/misc/yosysjs/yosysjs.js
+++ b/misc/yosysjs/yosysjs.js
@@ -22,7 +22,7 @@ var YosysJS = new function() {
}
this.dot_into_svg = function(dot_text, svg_element) {
- if (typeof(svg_element) == 'string')
+ if (typeof(svg_element) == 'string' && svg_element != "")
svg_element = document.getElementById(svg_element);
svg_element.innerHTML = this.dot_to_svg(dot_text);
c = svg_element.firstChild;
@@ -43,9 +43,10 @@ var YosysJS = new function() {
ys.init_script = "";
ys.ready = false;
ys.verbose = false;
+ ys.logprint = false;
ys.echo = false;
- if (typeof(reference_element) == 'string')
+ if (typeof(reference_element) == 'string' && reference_element != "")
reference_element = document.getElementById(reference_element);
if (reference_element) {
@@ -80,33 +81,51 @@ var YosysJS = new function() {
return;
ys.print_buffer += text + "\n";
ys.got_normal_log_message = true;
+ if (ys.logprint)
+ console.log(text);
if (ys.verbose) {
ys.last_line_empty = text == "";
- span = doc.createElement('span');
- span.textContent = text + "\n";
- span.style.fontFamily = 'monospace';
- span.style.whiteSpace = 'pre';
- doc.body.appendChild(span);
- ys.window.scrollTo(0, doc.body.scrollHeight)
+ if (text == "") {
+ span = doc.createElement('br');
+ } else {
+ span = doc.createElement('span');
+ span.textContent = text + "\n";
+ span.style.fontFamily = 'monospace';
+ span.style.whiteSpace = 'pre';
+ }
+ doc.firstChild.appendChild(span);
+ if (doc.body)
+ ys.window.scrollTo(0, doc.body.scrollHeight);
+ else
+ ys.window.scrollBy(0, 100);
}
ys.ready = true;
},
printErr: function(text) {
if (typeof(text) == 'number')
return;
+ if (ys.logprint)
+ console.log(text);
if (ys.got_normal_log_message) {
ys.print_buffer += text + "\n";
ys.last_line_empty = text == "";
- span = doc.createElement('span');
- span.textContent = text + "\n";
- span.style.fontFamily = 'monospace';
- span.style.whiteSpace = 'pre';
- span.style.color = 'red';
- doc.body.appendChild(span);
- ys.window.scrollTo(0, doc.body.scrollHeight)
- } else {
+ if (text == "") {
+ span = doc.createElement('br');
+ } else {
+ span = doc.createElement('span');
+ span.textContent = text + "\n";
+ span.style.fontFamily = 'monospace';
+ span.style.whiteSpace = 'pre';
+ span.style.color = 'red';
+ }
+ doc.firstChild.appendChild(span);
+ if (doc.body)
+ ys.window.scrollTo(0, doc.body.scrollHeight);
+ else
+ ys.window.scrollBy(0, 100);
+ } else
+ if (!ys.logprint)
console.log(text);
- }
},
};
@@ -148,10 +167,9 @@ var YosysJS = new function() {
return ys.window.FS.readdir(dirname);
}
- el = doc.createElement('script');
- el.type = 'text/javascript';
- el.src = this.url_prefix + 'yosys.js';
- doc.head.appendChild(el);
+ doc.open()
+ doc.write('<script type="text/javascript" src="' + this.url_prefix + 'yosys.js"></' + 'script>');
+ doc.close()
if (on_ready || ys.init_script) {
function check_ready() {