Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 1fa9084

Browse files
committed
Keep the stdout output area hidden until needed.
1 parent b700d3c commit 1fa9084

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

runestone/activecode/js/activecode.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ ActiveCode.prototype.createOutput = function () {
205205
$(outDiv).addClass("ac_output col-md-6");
206206
this.outDiv = outDiv;
207207
this.output = document.createElement('pre');
208+
$(this.output).css("visibility","hidden");
208209

209210
this.graphics = document.createElement('div');
210211
$(this.graphics).addClass("ac-canvas");
@@ -567,17 +568,28 @@ ActiveCode.prototype.builtinRead = function (x) {
567568

568569
ActiveCode.prototype.outputfun = function(text) {
569570
// bnm python 3
570-
var x = text;
571-
if (x.charAt(0) == '(') {
572-
x = x.slice(1, -1);
573-
x = '[' + x + ']';
574-
try {
575-
var xl = eval(x);
576-
xl = xl.map(pyStr);
577-
x = xl.join(' ');
578-
} catch (err) {
571+
pyStr = function(x) {
572+
if (x instanceof Array) {
573+
return '[' + x.join(", ") + ']';
574+
} else {
575+
return x
576+
}
577+
}
578+
579+
var x = text;
580+
if (! this.python3 ) {
581+
if (x.charAt(0) == '(') {
582+
x = x.slice(1, -1);
583+
x = '[' + x + ']';
584+
try {
585+
var xl = eval(x);
586+
xl = xl.map(pyStr);
587+
x = xl.join(' ');
588+
} catch (err) {
589+
}
579590
}
580591
}
592+
$(this.output).css("visibility","visible");
581593
text = x;
582594
text = text.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br/>");
583595
$(this.output).append(text);

0 commit comments

Comments
 (0)