55"use strict" ;
66
77import RunestoneBase from "../../common/js/runestonebase.js" ;
8+ import AudioTour from "./audiotour" ;
89import "./activecode-i18n.en" ;
910import CodeMirror from "codemirror" ;
1011import "codemirror/mode/python/python.js" ;
@@ -77,7 +78,7 @@ export class ActiveCode extends RunestoneBase {
7778 socket = new WebSocket ( "wss://" + chatcodesServer ) ;
7879 }
7980 if ( ! connection ) {
80- connection = new sharedb . Connection ( socket ) ;
81+ connection = new window . sharedb . Connection ( socket ) ;
8182 }
8283 if ( ! doc ) {
8384 doc = connection . get ( "chatcodes" , "channels" ) ;
@@ -209,18 +210,19 @@ export class ActiveCode extends RunestoneBase {
209210 }
210211 createControls ( ) {
211212 var ctrlDiv = document . createElement ( "div" ) ;
213+ var butt ;
212214 $ ( ctrlDiv ) . addClass ( "ac_actions" ) ;
213215 $ ( ctrlDiv ) . addClass ( "col-md-12" ) ;
214216 // Run
215- var butt = document . createElement ( "button" ) ;
217+ butt = document . createElement ( "button" ) ;
216218 $ ( butt ) . text ( $ . i18n ( "msg_activecode_run_code" ) ) ;
217219 $ ( butt ) . addClass ( "btn btn-success run-button" ) ;
218220 ctrlDiv . appendChild ( butt ) ;
219221 this . runButton = butt ;
220222 $ ( butt ) . click ( this . runProg . bind ( this ) ) ;
221223 $ ( butt ) . attr ( "type" , "button" ) ;
222224 if ( this . enabledownload || eBookConfig . downloadsEnabled ) {
223- var butt = document . createElement ( "button" ) ;
225+ butt = document . createElement ( "button" ) ;
224226 $ ( butt ) . text ( "Download" ) ;
225227 $ ( butt ) . addClass ( "btn save-button" ) ;
226228 ctrlDiv . appendChild ( butt ) ;
@@ -229,7 +231,7 @@ export class ActiveCode extends RunestoneBase {
229231 $ ( butt ) . attr ( "type" , "button" ) ;
230232 }
231233 if ( ! this . hidecode && ! this . hidehistory ) {
232- var butt = document . createElement ( "button" ) ;
234+ butt = document . createElement ( "button" ) ;
233235 $ ( butt ) . text ( $ . i18n ( "msg_activecode_load_history" ) ) ;
234236 $ ( butt ) . addClass ( "btn btn-default" ) ;
235237 $ ( butt ) . attr ( "type" , "button" ) ;
@@ -625,7 +627,7 @@ export class ActiveCode extends RunestoneBase {
625627 $ ( coachDiv ) . css ( "display" , "none" ) ;
626628 this . codecoach = coachDiv ;
627629 this . outerDiv . appendChild ( coachDiv ) ;
628- var clearDiv = document . createElement ( "div" ) ;
630+ clearDiv = document . createElement ( "div" ) ;
629631 $ ( clearDiv ) . css ( "clear" , "both" ) ; // needed to make parent div resize properly
630632 this . outerDiv . appendChild ( clearDiv ) ;
631633 }
@@ -728,11 +730,12 @@ export class ActiveCode extends RunestoneBase {
728730 // display grades in modal window
729731 var showGradeSummary = function ( data , status , whatever ) {
730732 var report = eval ( data ) [ 0 ] ;
733+ var body ;
731734 // check for report['message']
732735 if ( report ) {
733736 if ( report [ "version" ] == 2 ) {
734737 // new version; would be better to embed this in HTML for the activecode
735- var body =
738+ body =
736739 "<h4>Grade Report</h4>" +
737740 "<p>This question: " +
738741 report [ "grade" ] +
@@ -743,7 +746,7 @@ export class ActiveCode extends RunestoneBase {
743746 report [ "comment" ] +
744747 "</p>" ;
745748 } else {
746- var body =
749+ body =
747750 "<h4>Grade Report</h4>" +
748751 "<p>This assignment: " +
749752 report [ "grade" ] +
@@ -762,20 +765,19 @@ export class ActiveCode extends RunestoneBase {
762765 body =
763766 "<h4>The server did not return any grade information</h4>" ;
764767 }
765- var html =
766- '<div class="modal fade">' +
767- ' <div class="modal-dialog compare-modal">' +
768- ' <div class="modal-content">' +
769- ' <div class="modal-header">' +
770- ' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>' +
771- ' <h4 class="modal-title">Assignment Feedback</h4>' +
772- " </div>" +
773- ' <div class="modal-body">' +
774- body +
775- " </div>" +
776- " </div>" +
777- " </div>" +
778- "</div>" ;
768+ var html = `<div class="modal fade">
769+ <div class="modal-dialog compare-modal">
770+ <div class="modal-content">
771+ <div class="modal-header">
772+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
773+ <h4 class="modal-title">Assignment Feedback</h4>
774+ </div>
775+ <div class="modal-body">
776+ ${ body }
777+ </div>
778+ </div>
779+ </div>
780+ </div>` ;
779781 var el = $ ( html ) ;
780782 el . modal ( ) ;
781783 } ;
@@ -885,7 +887,7 @@ export class ActiveCode extends RunestoneBase {
885887 var ifm = document . createElement ( "iframe" ) ;
886888 $ ( ifm ) . addClass ( "tie-frame" ) ;
887889 ifm . src = `https://tech-interview-exercises.appspot.com/client/question.html?qid=${ this . tie } ` ;
888- setIframeDimensions = function ( ) {
890+ var setIframeDimensions = function ( ) {
889891 $ ( ".tie-container" ) . css (
890892 "width" ,
891893 $ ( ".tie-container" )
0 commit comments