This repository was archived by the owner on Jun 7, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -649,10 +649,15 @@ ActiveCode.createScratchActivecode = function() {
649649 // Remove everything from the URL but the course and page name
650650 // todo: this could probably be eliminated and simply moved to the template file
651651 var divid = document . URL . split ( '#' ) [ 0 ] ;
652- divid = divid . split ( 'static' ) [ 1 ] ;
652+ if ( divid . indexOf ( 'static' ) > - 1 ) {
653+ divid = divid . split ( 'static' ) [ 1 ] ;
654+ } else {
655+ divid = divid . split ( '/' ) ;
656+ divid = divid . slice ( - 2 ) . join ( "" ) ;
657+ }
653658 divid = divid . split ( '?' ) [ 0 ] ; // remove any query string (e.g ?lastPosition)
654659 divid = divid . replaceAll ( '/' , '' ) . replace ( '.html' , '' ) ;
655-
660+ eBookConfig . scratchDiv = divid ;
656661 // generate the HTML
657662 var html = '<div id="ac_modal_' + divid + '" class="modal fade">' +
658663 ' <div class="modal-dialog scratch-ac-modal">' +
@@ -689,7 +694,7 @@ ActiveCode.createScratchActivecode = function() {
689694
690695
691696ActiveCode . toggleScratchActivecode = function ( ) {
692- var divid = "ac_modal_" + document . URL . split ( '#' ) [ 0 ] . split ( 'static' ) [ 1 ] . split ( '?' ) [ 0 ] . replaceAll ( '/' , '' ) . replace ( '.html' , '' ) ;
697+ var divid = "ac_modal_" + eBookConfig . scratchDiv ;
693698 var div = $ ( "#" + divid ) ;
694699
695700 div . modal ( 'toggle' ) ;
You can’t perform that action at this time.
0 commit comments