@@ -205,7 +205,11 @@ export class ActiveCode extends RunestoneBase {
205205 ) {
206206 // change events can come before any real changes for various reasons, some unknown
207207 // this avoids unneccsary log events and updates to the activity counter
208- if ( this . origText === editor . getValue ( ) ) {
208+ // offsetParent === null means that the element is not on the screen and so can't change
209+ // this.controlDiv.offsetParent
210+ if ( this . origText === editor . getValue ( ) ||
211+ this . addingScrubber ) {
212+ console . log ( "Fake change event, skipping the log" ) ;
209213 return ;
210214 }
211215 $ ( editor . getWrapperElement ( ) ) . css (
@@ -567,6 +571,7 @@ export class ActiveCode extends RunestoneBase {
567571 // add an initial load history button
568572 // if there is no edit then there is no append to_save (True/False)
569573 async addHistoryScrubber ( pos_last ) {
574+ this . addingScrubber = true ;
570575 let response ;
571576 var reqData = {
572577 acid : this . divid ,
@@ -612,6 +617,7 @@ export class ActiveCode extends RunestoneBase {
612617 }
613618 this . renderScrubber ( pos_last ) ;
614619 }
620+ this . addingScrubber = false ;
615621 return "success" ;
616622 }
617623
@@ -627,17 +633,19 @@ export class ActiveCode extends RunestoneBase {
627633 } ) ;
628634 var scrubber = document . createElement ( "div" ) ;
629635 this . timestampP = document . createElement ( "span" ) ;
630- this . slideit = function ( ) {
636+ this . slideit = function ( ev , el ) {
631637 this . editor . setValue ( this . history [ $ ( scrubber ) . slider ( "value" ) ] ) ;
632638 var curVal = this . timestamps [ $ ( scrubber ) . slider ( "value" ) ] ;
633639 let pos = $ ( scrubber ) . slider ( "value" ) ;
634640 let outOf = this . history . length ;
635641 $ ( this . timestampP ) . text ( `${ curVal } - ${ pos + 1 } of ${ outOf } ` ) ;
636- this . logBookEvent ( {
637- event : "activecode" ,
638- act : "slide:" + curVal ,
639- div_id : this . divid ,
640- } ) ;
642+ if ( ev !== null ) {
643+ this . logBookEvent ( {
644+ event : "activecode" ,
645+ act : "slide:" + curVal ,
646+ div_id : this . divid ,
647+ } ) ;
648+ }
641649 } ;
642650 $ ( scrubber ) . slider ( {
643651 max : this . history . length - 1 ,
@@ -1179,7 +1187,7 @@ Yet another is that there is an internal error. The internal error message is:
11791187 "value" ,
11801188 this . history . length - 1
11811189 ) ;
1182- this . slideit ( ) ;
1190+ this . slideit ( null ) ;
11831191 } else {
11841192 saveCode = "False" ;
11851193 }
0 commit comments