@@ -70,6 +70,7 @@ export class ActiveCode extends RunestoneBase {
7070 this . runButton = null ;
7171 this . enabledownload = $ ( orig ) . data ( "enabledownload" ) ;
7272 this . downloadButton = null ;
73+ this . resetButton = null ;
7374 this . saveButton = null ;
7475 this . loadButton = null ;
7576 this . outerDiv = null ;
@@ -278,6 +279,8 @@ export class ActiveCode extends RunestoneBase {
278279 this . runButton . onclick = this . runButtonHandler . bind ( this ) ;
279280 $ ( butt ) . attr ( "type" , "button" ) ;
280281
282+ this . addResetButton ( ctrlDiv ) ;
283+
281284 if ( this . enabledownload || eBookConfig . downloadsEnabled ) {
282285 this . addDownloadButton ( ctrlDiv ) ;
283286 }
@@ -354,6 +357,16 @@ export class ActiveCode extends RunestoneBase {
354357 $ ( butt ) . attr ( "type" , "button" ) ;
355358 }
356359
360+ addResetButton ( ctrlDiv ) {
361+ let butt = document . createElement ( "button" ) ;
362+ $ ( butt ) . text ( "Reset" ) ;
363+ $ ( butt ) . addClass ( "btn btn-default" ) ;
364+ $ ( butt ) . attr ( "type" , "button" ) ;
365+ ctrlDiv . appendChild ( butt ) ;
366+ this . resetButton = butt ;
367+ $ ( butt ) . click ( this . resetCode . bind ( this ) ) ;
368+ }
369+
357370 enableHideShow ( ctrlDiv ) {
358371 $ ( this . runButton ) . attr ( "disabled" , "disabled" ) ;
359372 let butt = document . createElement ( "button" ) ;
@@ -763,6 +776,11 @@ export class ActiveCode extends RunestoneBase {
763776 }
764777 }
765778
779+ resetCode ( ) {
780+ localStorage . removeItem ( this . divid ) ;
781+ window . location . reload ( ) ;
782+ }
783+
766784 async createGradeSummary ( ) {
767785 // get grade and comments for this assignment
768786 // get summary of all grades for this student
0 commit comments