Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit b439673

Browse files
author
Brad Miller
committed
One scratch /student for the whole book
1 parent e08dfe2 commit b439673

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

runestone/activecode/js/activecode.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2415,15 +2415,8 @@ ACFactory.createScratchActivecode = function() {
24152415
// use the URL to assign a divid - each page should have a unique Activecode block id.
24162416
// Remove everything from the URL but the course and page name
24172417
// todo: this could probably be eliminated and simply moved to the template file
2418-
var divid = document.URL.split('#')[0];
2419-
if (divid.indexOf('static') > -1) {
2420-
divid = divid.split('static')[1];
2421-
} else {
2422-
divid = divid.split('/');
2423-
divid = divid.slice(-2).join("");
2424-
}
2425-
divid = divid.split('?')[0]; // remove any query string (e.g ?lastPosition)
2426-
divid = divid.replaceAll('/', '').replace('.html', '').replace(':', '');
2418+
var divid = eBookConfig.course + "_scratch_ac";
2419+
divid = divid.replace(/[#.]/g,''); // in case book title has characters that will mess up our selectors
24272420
eBookConfig.scratchDiv = divid;
24282421
var lang = eBookConfig.acDefaultLanguage ? eBookConfig.acDefaultLanguage : 'python'
24292422
// generate the HTML

0 commit comments

Comments
 (0)