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

Commit dcf3b8b

Browse files
committed
Bug fix: adjust visibility for other languages. Add new function to support server generated activecode pages.
1 parent a909794 commit dcf3b8b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

runestone/activecode/js/activecode.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,21 @@ ActiveCode.prototype.runProg = function() {
656656

657657
};
658658

659+
ActiveCode.addActiveCodeToDiv = function(outerdiv, acdiv, sid, initialcode, language) {
660+
var acdiv, thepre, newac;
661+
thepre = document.createElement("pre");
662+
thepre['data-component'] = "activecode";
663+
thepre.id = acdiv;
664+
thepre['data-lang'] = language;
665+
$("#"+acdiv).append(thepre);
666+
var opts = {'orig' : thepre, 'useRunestoneServices': true };
667+
newac = new ActiveCode(opts)
668+
savediv = newac.divid;
669+
newac.divid = outerdiv;
670+
newac.loadEditor();
671+
newac.divid = savediv;
672+
673+
};
659674

660675
ActiveCode.createScratchActivecode = function() {
661676
/* set up the scratch Activecode editor in the search menu */
@@ -729,6 +744,7 @@ JSActiveCode.prototype.init = function(opts) {
729744
}
730745

731746
JSActiveCode.prototype.outputfun = function (a) {
747+
$(this.output).css("visibility","visible");
732748
var str = "[";
733749
if (typeof(a) == "object" && a.length) {
734750
for (var i = 0; i < a.length; i++)
@@ -1393,6 +1409,7 @@ LiveCode.prototype.runProg = function() {
13931409
$(this.codeDiv).switchClass("col-md-12","col-md-6",{duration:500,queue:false});
13941410
$(this.outDiv).show({duration:700,queue:false});
13951411
$(this.errDiv).remove();
1412+
$(this.output).css("visibility","visible");
13961413

13971414
xhr.open("POST", host, true);
13981415
xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8');

0 commit comments

Comments
 (0)