A
node js
cli program to add timer functionality to ascorm
archive 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
.env
in the repos folder root (same folder as thepackage.json
file) 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_PATH
or you can leave that blank and instead place courses in the courses directory. - execute the cli by pressing
F5
or executingnpm run start
- hit
enter
when promted for course idle time to use your specified default - hit
enter
when promted for course count down to use your specified default - hit
enter
when 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
working
directory. 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/lib
directory -
Reads contents of course
scormcontents/index.html
file and parses into aJSDOM
instance for manipulations- adds event handlers to
body
tag 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.html
file -
Reads contents of course
scormdriver/indexAPI.html
file and parses into aJSDOM
instance for manipulations- gets contents of existing
<script>
tag and applies following code mods- declare variable
getCourseCurrentTimeLMS
at begining of script - replace
LoadContent
function declaration block body
- declare variable
- gets contents of existing
-
Persist the manipulated
scormdriver/indexAPI.html
file -
Reads contents of course
scormdriver/scormdriver.js
file and apply following code mods- scorm2004GetCourseCurrentTimeFuncCodeMod
- scormGetCourseCurrentTimeFuncCodeMod
- aiccGetCourseCurrentTimeFuncCodeMod
- noneGetCourseCurrentTimeFuncCodeMod
- tcapiGetCourseCurrentTimeFuncCodeMod
- cmi5GetCourseCurrentTimeFuncCodeMod
- lmsStandardApiFuncCodeMod
- getCourseCurrentTimeFuncCodeMod
- concedeControlCodeMod
-
Persist the manipulated
scormdriver/scormdriver.js
file -
Archive (zip) the modified course and persist into the
modified-courses
directory 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_PATH
in environment file)