@@ -1449,13 +1449,13 @@ ACFactory = {};
14491449ACFactory . createActiveCode = function ( orig , lang ) {
14501450 var opts = { 'orig' : orig , 'useRunestoneServices' : eBookConfig . useRunestoneServices , 'python3' : eBookConfig . python3 } ;
14511451 if ( lang === "javascript" ) {
1452- edList [ orig . id ] = new JSActiveCode ( opts ) ;
1452+ return new JSActiveCode ( opts ) ;
14531453 } else if ( lang === 'htmlmixed' ) {
1454- edList [ orig . id ] = new HTMLActiveCode ( opts ) ;
1454+ return new HTMLActiveCode ( opts ) ;
14551455 } else if ( [ 'java' , 'cpp' , 'c' , 'python3' , 'python2' ] . indexOf ( lang ) > - 1 ) {
1456- edList [ orig . id ] = new LiveCode ( opts ) ;
1456+ return new LiveCode ( opts ) ;
14571457 } else { // default is python
1458- edList [ orig . id ] = new ActiveCode ( opts ) ;
1458+ return new ActiveCode ( opts ) ;
14591459 }
14601460
14611461}
@@ -1467,10 +1467,10 @@ ACFactory.addActiveCodeToDiv = function(outerdiv, acdiv, sid, initialcode, langu
14671467 thepre = document . createElement ( "pre" ) ;
14681468 thepre [ 'data-component' ] = "activecode" ;
14691469 thepre . id = acdiv ;
1470- thepre [ ' data- lang'] = language ;
1470+ $ ( thepre ) . data ( ' lang', language ) ;
14711471 $ ( "#" + acdiv ) . append ( thepre ) ;
14721472 var opts = { 'orig' : thepre , 'useRunestoneServices' : true } ;
1473- // todo: look at lang to decide what kind of ActiveCode to make
1473+
14741474 newac = ACFactory . createActiveCode ( thepre , language ) ;
14751475 savediv = newac . divid ;
14761476 newac . divid = outerdiv ;
@@ -1522,10 +1522,10 @@ ACFactory.createScratchActivecode = function() {
15221522 } ) ;
15231523 } ) ;
15241524
1525- $ ( document ) . bind ( 'keypress' , '\\' , function ( evt ) {
1526- ACFactory . toggleScratchActivecode ( ) ;
1527- return false ;
1528- } ) ;
1525+ // $(document).bind('keypress', '\\', function(evt) {
1526+ // ACFactory.toggleScratchActivecode();
1527+ // return false;
1528+ // });
15291529} ;
15301530
15311531
@@ -1540,7 +1540,7 @@ ACFactory.toggleScratchActivecode = function () {
15401540$ ( document ) . ready ( function ( ) {
15411541 ACFactory . createScratchActivecode ( ) ;
15421542 $ ( '[data-component=activecode]' ) . each ( function ( index ) {
1543- ACFactory . createActiveCode ( this , $ ( this ) . data ( 'lang' ) ) ;
1543+ edList [ this . id ] = ACFactory . createActiveCode ( this , $ ( this ) . data ( 'lang' ) ) ;
15441544 } ) ;
15451545 if ( loggedout ) {
15461546 for ( k in edList ) {
0 commit comments