1
1
/*global $, SCOBotUtil, scorm, window */
2
- /*jslint browser: true, devel: true, indent: 4 regexp: true*/
2
+ /*jslint browser: true, devel: true, indent: 4, regexp: true*/
3
3
/**
4
4
* SCOBot
5
5
* This only works with the SCOBotBase and will not work standalone. It will not work standalone (without a LMS)
37
37
* behaves after Terminate is fired. The default behavior is _none_, however if you seek more information about the
38
38
* other possibilities you can locate a SCORM_SeqNav.pdf from ADL in Table 5.6.6a for more detailed info.
39
39
*
40
- * @event exception, load, unload, message, continue, comments_lms
40
+ * @event exception, load, unload, message, continue, comments_lms, resume
41
41
*
42
42
* @author Cybercussion Interactive, LLC <info@cybercussion.com>
43
- * @license Copyright (c) 2009-2016 , Cybercussion Interactive LLC
43
+ * @license Copyright (c) 2009-2017 , Cybercussion Interactive LLC
44
44
* As of 3.0.0 this code is under a Creative Commons Attribution-ShareAlike 4.0 International License.
45
45
* @requires SCOBotBase, SCOBotUtil
46
- * @version 4.1.5
46
+ * @version 4.1.6
47
47
* @param options {Object} override default values
48
48
* @constructor
49
49
*/
50
50
/*!
51
- * SCOBot , Updated Jan 1st, 2016
52
- * Copyright (c) 2009-2016 , Cybercussion Interactive LLC. All rights reserved.
51
+ * SCOBotBase , Updated Jan 1st, 2016
52
+ * Copyright (c) 2009-2017 , Cybercussion Interactive LLC. All rights reserved.
53
53
* As of 3.0.0 this code is under a Creative Commons Attribution-ShareAlike 4.0 International License.
54
54
*/
55
55
function SCOBot ( options ) {
@@ -58,9 +58,9 @@ function SCOBot(options) {
58
58
/** @default version, createDate, modifiedDate, prefix, launch_data, interaction_mode, success_status, location, completion_status, suspend_data, mode, scaled_passing_score, totalInteractions, totalObjectives, startTime */
59
59
var Utl = SCOBotUtil , // Hook for jQuery 'like' functionality
60
60
defaults = {
61
- version : "4.1.5 " ,
61
+ version : "4.1.6 " ,
62
62
createDate : "04/07/2011 09:33AM" ,
63
- modifiedDate : "03/04/2016 12:23AM " ,
63
+ modifiedDate : "05/10/2017 05:03PM " ,
64
64
prefix : "SCOBot" ,
65
65
// SCOBot default parameters
66
66
launch_data : { } ,
@@ -84,7 +84,7 @@ function SCOBot(options) {
84
84
mode : "" , // will be replaced by LMS value
85
85
scaled_passing_score : 0.7 , // Override for default unless imsmanifest (LMS) has value
86
86
completion_threshold : 0 , // Override for default unless imsmanifest (LMS) has value
87
- max_time_allowed : '' , // will be replaced by LMS value
87
+ max_time_allowed : "" , // will be replaced by LMS value
88
88
totalInteractions : 0 , // See setTotals below
89
89
totalObjectives : 0 ,
90
90
startTime : 0
@@ -93,25 +93,25 @@ function SCOBot(options) {
93
93
settings = Utl . extend ( defaults , options ) ,
94
94
// 4.0.4 Status/State Buffer Private now to prevent direct tampering
95
95
buffer = {
96
- success_status : '' ,
97
- completion_status : '' ,
96
+ success_status : "" ,
97
+ completion_status : "" ,
98
98
completion_threshold : settings . completion_threshold , // cache
99
- progress_measure : '0' ,
99
+ progress_measure : "0" ,
100
100
scaled_passing_score : settings . scaled_passing_score , // cache
101
101
score : {
102
- scaled : '0' ,
103
- raw : '0' ,
104
- min : '0' ,
105
- max : '0'
102
+ scaled : "0" ,
103
+ raw : "0" ,
104
+ min : "0" ,
105
+ max : "0"
106
106
}
107
107
} ,
108
- lmsconnected = ' false' ,
108
+ lmsconnected = " false" ,
109
109
isError = false ,
110
110
isStarted = false ,
111
111
happyEndingRequest = false , // if you enable happyEnding, and call it, it will take precedence.
112
112
SCOBotManagedStatus = false , // if you setTotals, SCOBot will manage the status.
113
- badValues = ' |null|undefined|false|NaN|| |' ,
114
- error = scorm . get ( ' error' ) , // no sense retyping this
113
+ badValues = " |null|undefined|false|NaN|| |" ,
114
+ error = scorm . get ( " error" ) , // no sense retyping this
115
115
self = this ; // Hook
116
116
// End Constructor ////////
117
117
///////////////////////////
@@ -125,14 +125,13 @@ function SCOBot(options) {
125
125
scorm . debug ( error [ n ] , 2 ) ;
126
126
return true ;
127
127
}
128
-
129
128
/**
130
129
* Trigger Exception
131
130
* Throws an event the player can listen to in order to handle an exception.
132
131
* This would be common to a non-compliance in an LMS and loss of student data.
133
132
*/
134
133
function triggerException ( msg ) {
135
- Utl . triggerEvent ( self , ' exception' , { error : msg } ) ;
134
+ Utl . triggerEvent ( self , " exception" , { error : msg } ) ;
136
135
}
137
136
/**
138
137
* Initialize SCO
@@ -144,7 +143,7 @@ function SCOBot(options) {
144
143
function initSCO ( ) {
145
144
lmsconnected = scorm . initialize ( ) ; // returns string
146
145
scorm . debug ( settings . prefix + ": SCO Loaded from window.onload " + lmsconnected , 4 ) ;
147
- if ( lmsconnected === ' true' ) {
146
+ if ( lmsconnected === " true" ) {
148
147
self . start ( ) ; // Things you'd do like getting mode, suspend data
149
148
Utl . triggerEvent ( self , "load" ) ;
150
149
} else {
@@ -166,7 +165,7 @@ function SCOBot(options) {
166
165
scorm . debug ( settings . prefix + ": SCO is being unloaded, forcing exit ..." , 3 ) ;
167
166
if ( scorm . isConnectionActive ( ) ) {
168
167
Utl . triggerEvent ( self , "unload" ) ;
169
- switch ( scorm . get ( ' exit_type' ) ) {
168
+ switch ( scorm . get ( " exit_type" ) ) {
170
169
case "finish" :
171
170
self . finish ( ) ;
172
171
break ;
@@ -216,7 +215,7 @@ function SCOBot(options) {
216
215
*/
217
216
function isISO8601 ( v ) {
218
217
var iso8601Exp ;
219
- switch ( scorm . get ( ' time_type' ) ) {
218
+ switch ( scorm . get ( " time_type" ) ) {
220
219
case "UTC" : // AT GMT
221
220
iso8601Exp = / ^ ( \d { 4 } ) - 0 ? ( \d + ) - 0 ? ( \d + ) [ T ] 0 ? ( \d + ) : 0 ? ( \d + ) : 0 ? ( \d + ) (?: \. ( \d + ) ) ( | Z ) $ / ;
222
221
break ;
@@ -248,7 +247,7 @@ function SCOBot(options) {
248
247
*/
249
248
function notStartedYet ( ) {
250
249
scorm . debug ( settings . prefix + ": You didn't call 'start()' yet, or you already terminated, ignoring." , 2 ) ;
251
- return ' false' ;
250
+ return " false" ;
252
251
}
253
252
254
253
/**
@@ -588,7 +587,7 @@ function SCOBot(options) {
588
587
*/
589
588
case 'numeric' :
590
589
if ( typeof value === "number" ) {
591
- str = '' + value ;
590
+ str = '' + value ;
592
591
} else if ( Utl . isPlainObject ( value ) ) {
593
592
arr = [ trueRound ( value . min , 7 ) , trueRound ( value . max , 7 ) ] ;
594
593
str = arr . join ( "[:]" ) ;
@@ -1089,7 +1088,9 @@ function SCOBot(options) {
1089
1088
scorm . debug ( settings . prefix + ": Returning suspend data object from a prior session" , 4 ) ;
1090
1089
/* you may not be using JSON suspend data, and managing that yourself. */
1091
1090
settings . suspend_data = settings . useJSONSuspendData ? JSON . parse ( settings . suspend_data ) : settings . suspend_data ; // Turn this back into a object.
1091
+ // 5/10/17 - event to trigger option for handling prior suspend data (Yes/No)
1092
1092
scorm . debug ( settings . suspend_data , 4 ) ;
1093
+ Utl . triggerEvent ( self , 'resume' , { suspend_data : settings . suspend_data } ) ; // You would need to pop a modal dialog if you want to reset suspend data if the user says no.
1093
1094
if ( settings . entry === "" ) {
1094
1095
settings . entry = "resume" ;
1095
1096
} // most definitely its a resume if there is suspend data.
0 commit comments