A
node jscli program to add timer functionality to ascormarchive file
- clone the source code by executing
git clone https://github.com/simpert/heathers-course-modifier.git - open the repo in VS Code
- install the packages by executing
npm install - build the javascript by executing
npm run build - create a file called
.envin the repos folder root (same folder as thepackage.jsonfile) and place the defaults you would like to use in the fileCOURSE_DIR_PATH=C:\my-courses-directory DEFAULT_IDLE_TIME=600000 DEFAULT_COUNTDOWN_TIME=10 DEFAULT_COURSE_TOTAL_TIME=10800 - place any courses you would like to modify (course zip files) either in the directory you specified above in
COURSE_DIR_PATHor you can leave that blank and instead place courses in the courses directory. - execute the cli by pressing
F5or executingnpm run start - hit
enterwhen promted for course idle time to use your specified default - hit
enterwhen promted for course count down to use your specified default - hit
enterwhen promted for ourse duration to use your specified default - use the arrow keys to select the course you want to modify (the list will be all the contents of the courses directory) then press
enter - wait for the course to be modified and archived back up. the terminal will tell you where it placed the modified zip.
-
Prompts for the arguments.
each argument has a default value specified in parenthesis and to use it just hit
enter. the defaults can be set in the environment file- course idle time used to determine reset function calls in
index.html body event handlers - course count down used to display text in the popups
- course duration used to display in the text in the popups
- course to modify the name of teh course file/archive
- course idle time used to determine reset function calls in
-
Ensures
workingdirectory. Create directory to extract course archive to if needed and ensures that the directory is empty -
Extracts the course archive to the working directory.
-
Writes custom javascript code and styles css file to the courses
scormcontent/libdirectory -
Reads contents of course
scormcontents/index.htmlfile and parses into aJSDOMinstance for manipulations- adds event handlers to
bodytag with arguments from prompted times - inserts contents of popups html file after updating time text
- inserts
<script>tag which points to custom javascript code - inserts
<style>tag which points to styles css file - gets contents of existing
<script>tag and applies following code mods- currentTimeArrayCodeMod
- isTimeCompletedCodeMod
- completeOutCodeMod
- exitFunctionCodeMod
- finishFunctionCodeMod
- rootCodeMod
- adds event handlers to
-
Persist the manipulated
scormcontents/index.htmlfile -
Reads contents of course
scormdriver/indexAPI.htmlfile and parses into aJSDOMinstance for manipulations- gets contents of existing
<script>tag and applies following code mods- declare variable
getCourseCurrentTimeLMSat begining of script - replace
LoadContentfunction declaration block body
- declare variable
- gets contents of existing
-
Persist the manipulated
scormdriver/indexAPI.htmlfile -
Reads contents of course
scormdriver/scormdriver.jsfile and apply following code mods- scorm2004GetCourseCurrentTimeFuncCodeMod
- scormGetCourseCurrentTimeFuncCodeMod
- aiccGetCourseCurrentTimeFuncCodeMod
- noneGetCourseCurrentTimeFuncCodeMod
- tcapiGetCourseCurrentTimeFuncCodeMod
- cmi5GetCourseCurrentTimeFuncCodeMod
- lmsStandardApiFuncCodeMod
- getCourseCurrentTimeFuncCodeMod
- concedeControlCodeMod
-
Persist the manipulated
scormdriver/scormdriver.jsfile -
Archive (zip) the modified course and persist into the
modified-coursesdirectory within the determined course folder (determined course folder is the folder the original course was found in. Either courses or a directory determined by settingCOURSE_DIR_PATHin environment file)