upgrade
This commit is contained in:
1 parent
fb6d5d5926
commit
3641e93527
9156 files changed
+1813532
No files matched your search
@@ -0,0 +1,714 @@
|
||||
/**
|
||||
* Wrapper to the SCORM API provided by Chamilo
|
||||
* The complete set of functions and variables are in this file to avoid unnecessary file
|
||||
* accesses.
|
||||
* Only event triggers and answer data are inserted into the final document.
|
||||
* @author Yannick Warnier - inspired by the ADLNet documentation on SCORM content-side API
|
||||
* @package scorm.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialisation of the SCORM API section.
|
||||
* Find the SCO functions (startTimer, computeTime, etc in the second section)
|
||||
* Find the Chamilo-proper functions (checkAnswers, etc in the third section)
|
||||
*/
|
||||
|
||||
var _debug = true;
|
||||
var findAPITries = 0;
|
||||
var _apiHandle = null; //private variable
|
||||
var errMsgLocate = "Unable to locate the LMS's API implementation";
|
||||
var _NoError = 0;
|
||||
var _GeneralException = 101;
|
||||
var _ServerBusy = 102;
|
||||
var _InvalidArgumentError = 201;
|
||||
var _ElementCannotHaveChildren = 202;
|
||||
var _ElementIsNotAnArray = 203;
|
||||
var _NotInitialized = 301;
|
||||
var _NotImplementedError = 401;
|
||||
var _InvalidSetValue = 402;
|
||||
var _ElementIsReadOnly = 403;
|
||||
var _ElementIsWriteOnly = 404;
|
||||
var _IncorrectDataType = 405;
|
||||
var startTime;
|
||||
var exitPageStatus;
|
||||
|
||||
/**
|
||||
* Gets the API handle right into the local API object and ensure there is only one.
|
||||
* Using the singleton pattern to ensure there's only one API object.
|
||||
* @return object The API object as given by the LMS
|
||||
*/
|
||||
var API = new function()
|
||||
{
|
||||
if (_apiHandle == null) {
|
||||
_apiHandle = getAPI();
|
||||
}
|
||||
|
||||
return _apiHandle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the API on the LMS side or gives up giving an error message
|
||||
* @param object The window/frame object in which we are searching for the SCORM API
|
||||
* @return object The API object recovered from the LMS's implementation of the SCORM API
|
||||
*/
|
||||
function findAPI(win)
|
||||
{
|
||||
while((win.API == null) && (win.parent != null) && (win.parent != win)) {
|
||||
findAPITries++;
|
||||
if (findAPITries>10) {
|
||||
alert("Error finding API - too deeply nested");
|
||||
return null;
|
||||
}
|
||||
win = win.parent
|
||||
}
|
||||
return win.API;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the API from the current window/frame or from parent objects if not found
|
||||
* @return object The API object recovered from the LMS's implementation of the SCORM API
|
||||
*/
|
||||
function getAPI()
|
||||
{
|
||||
//window is the global/root object of the current window/frame
|
||||
var MyAPI = findAPI(window);
|
||||
//look through parents if any
|
||||
if ((MyAPI == null) && (window.opener != null) && (typeof(window.opener) != "undefined")) {
|
||||
MyAPI = findAPI(window.opener);
|
||||
}
|
||||
//still not found? error message
|
||||
if (MyAPI == null) {
|
||||
alert("Unable to find SCORM API adapter.\nPlease check your LMS is considering this page as SCORM and providing the right JavaScript interface.")
|
||||
}
|
||||
return MyAPI;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles error codes (prints the error if it has a description)
|
||||
* @return int Error code from LMS's API
|
||||
*/
|
||||
function errorHandler()
|
||||
{
|
||||
if (API == null) {
|
||||
alert("Unable to locate the LMS's API. Cannot determine LMS error code");
|
||||
return;
|
||||
}
|
||||
var errCode = API.LMSGetLastError().toString();
|
||||
if (errCode != _NoError) {
|
||||
if (errCode == _NotImplementedError) {
|
||||
var errDescription = "The LMS doesn't support this feature";
|
||||
if (_debug) {
|
||||
errDescription += "\n";
|
||||
errDescription += api.LMSGetDiagnostic(null);
|
||||
}
|
||||
addDebug(errDescription);
|
||||
} else {
|
||||
var errDescription = API.LMSGetErrorString(errCode);
|
||||
if (_debug) {
|
||||
errDescription += "\n";
|
||||
errDescription += api.LMSGetDiagnostic(null);
|
||||
}
|
||||
addDebug(errDescription);
|
||||
}
|
||||
}
|
||||
return errCode;
|
||||
}
|
||||
|
||||
function addDebug(message) {
|
||||
if (_debug && window.console) {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
|
||||
function addDebugTable(message) {
|
||||
if (_debug && window.console) {
|
||||
console.table(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the LMSInitialize method of the LMS's API object
|
||||
* @return string The string value of the LMS returned value or false if error (should be "true" otherwise)
|
||||
*/
|
||||
function doLMSInitialize()
|
||||
{
|
||||
if (API == null) {
|
||||
alert(errMsgLocate + "\nLMSInitialize failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
var result = API.LMSInitialize("");
|
||||
if (result.toString() != "true") {
|
||||
var err = errorHandler();
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the LMSFinish method of the LMS's API object
|
||||
* @return string The string value of the LMS return value, or false if error (should be "true" otherwise)
|
||||
*/
|
||||
function doLMSFinish()
|
||||
{
|
||||
if (API == null) {
|
||||
alert(errMsgLocate + "\nLMSFinish failed");
|
||||
return false;
|
||||
} else {
|
||||
var result = API.LMSFinish('');
|
||||
if (result.toString() != "true") {
|
||||
var err = errorHandler();
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
/**
|
||||
* Calls the LMSGetValue method
|
||||
* @param string The name of the SCORM parameter to get
|
||||
* @return string The value returned by the LMS
|
||||
*/
|
||||
function doLMSGetValue(name)
|
||||
{
|
||||
if (API == null) {
|
||||
alert(errMsgLocate + "\nLMSGetValue was not successful.");
|
||||
return '';
|
||||
} else {
|
||||
var value = API.LMSGetValue(name);
|
||||
var errCode = API.LMSGetLastError().toString();
|
||||
if (errCode != _NoError) {
|
||||
// an error was encountered so display the error description
|
||||
var errDescription = API.LMSGetErrorString(errCode);
|
||||
addDebug("LMSGetValue(" + name + ") failed. \n" + errDescription)
|
||||
return '';
|
||||
}
|
||||
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the LMSSetValue method of the API object
|
||||
* @param string The name of the SCORM parameter to set
|
||||
* @param string The value to set the parameter to
|
||||
* @return void
|
||||
*/
|
||||
function doLMSSetValue(name, value)
|
||||
{
|
||||
if (API == null) {
|
||||
alert("Unable to locate the LMS's API Implementation.\nLMSSetValue was not successful.");
|
||||
return;
|
||||
} else {
|
||||
var result = API.LMSSetValue(name, value);
|
||||
if (result.toString() != "true") {
|
||||
var err = errorHandler();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the LMSCommit method
|
||||
*/
|
||||
function doLMSCommit()
|
||||
{
|
||||
if (API == null) {
|
||||
alert(errMsgLocate + "\nLMSCommit was not successful.");
|
||||
return "false";
|
||||
} else {
|
||||
var result = API.LMSCommit("");
|
||||
if (result != "true") {
|
||||
var err = errorHandler();
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls GetLastError()
|
||||
*/
|
||||
function doLMSGetLastError()
|
||||
{
|
||||
if (API == null) {
|
||||
alert(errMsgLocate + "\nLMSGetLastError was not successful.");
|
||||
//since we can't get the error code from the LMS, return a general error
|
||||
return _GeneralError;
|
||||
}
|
||||
return API.LMSGetLastError().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls LMSGetErrorString()
|
||||
*/
|
||||
function doLMSGetErrorString(errorCode)
|
||||
{
|
||||
if (API == null) {
|
||||
alert(errMsgLocate + "\nLMSGetErrorString was not successful.");
|
||||
}
|
||||
|
||||
return API.LMSGetErrorString(errorCode).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls LMSGetDiagnostic()
|
||||
*/
|
||||
function doLMSGetDiagnostic(errorCode)
|
||||
{
|
||||
if (API == null) {
|
||||
alert(errMsgLocate + "\nLMSGetDiagnostic was not successful.");
|
||||
}
|
||||
|
||||
return API.LMSGetDiagnostic(errorCode).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise page values
|
||||
*/
|
||||
function loadPage()
|
||||
{
|
||||
var result = doLMSInitialize();
|
||||
if (result) {
|
||||
var status = doLMSGetValue("cmi.core.lesson_status");
|
||||
if (status == "not attempted") {
|
||||
doLMSSetValue("cmi.core.lesson_status", "incomplete");
|
||||
}
|
||||
exitPageStatus = false;
|
||||
startTimer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the local timer
|
||||
*/
|
||||
function startTimer()
|
||||
{
|
||||
startTime = new Date().getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the total time and sends the result to the LMS
|
||||
*/
|
||||
function computeTime()
|
||||
{
|
||||
if (startTime != 0) {
|
||||
var currentDate = new Date().getTime();
|
||||
var elapsedSeconds = ( (currentDate - startTime) / 1000 );
|
||||
var formattedTime = convertTotalSeconds(elapsedSeconds);
|
||||
} else {
|
||||
formattedTime = "00:00:00.0";
|
||||
}
|
||||
|
||||
doLMSSetValue( "cmi.core.session_time", formattedTime );
|
||||
}
|
||||
/**
|
||||
* Formats the time in a SCORM time format
|
||||
*/
|
||||
function convertTotalSeconds(ts)
|
||||
{
|
||||
var sec = (ts % 60);
|
||||
ts -= sec;
|
||||
var tmp = (ts % 3600); //# of seconds in the total # of minutes
|
||||
ts -= tmp; //# of seconds in the total # of hours
|
||||
|
||||
// convert seconds to conform to CMITimespan type (e.g. SS.00)
|
||||
sec = Math.round(sec*100)/100;
|
||||
var strSec = new String(sec);
|
||||
var strWholeSec = strSec;
|
||||
var strFractionSec = "";
|
||||
|
||||
if (strSec.indexOf(".") != -1) {
|
||||
strWholeSec = strSec.substring(0, strSec.indexOf("."));
|
||||
strFractionSec = strSec.substring(strSec.indexOf(".") + 1, strSec.length);
|
||||
}
|
||||
if (strWholeSec.length < 2) {
|
||||
strWholeSec = "0" + strWholeSec;
|
||||
}
|
||||
strSec = strWholeSec;
|
||||
if (strFractionSec.length) {
|
||||
strSec = strSec + "." + strFractionSec;
|
||||
}
|
||||
if ((ts % 3600) != 0)
|
||||
var hour = 0;
|
||||
else var hour = (ts / 3600);
|
||||
if ((tmp % 60) != 0)
|
||||
var min = 0;
|
||||
else var min = (tmp / 60);
|
||||
if ((new String(hour)).length < 2)
|
||||
hour = "0" + hour;
|
||||
if ((new String(min)).length < 2)
|
||||
min = "0" + min;
|
||||
var rtnVal = hour + ":" + min + ":" + strSec;
|
||||
return rtnVal
|
||||
}
|
||||
/**
|
||||
* Handles the use of the back button (saves data and closes SCO)
|
||||
*/
|
||||
function doBack()
|
||||
{
|
||||
checkAnswers(true);
|
||||
doLMSSetValue( "cmi.core.exit", "suspend" );
|
||||
computeTime();
|
||||
exitPageStatus = true;
|
||||
var result;
|
||||
result = doLMSCommit();
|
||||
result = doLMSFinish();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the closure of the current SCO before an interruption. This is only useful if the LMS
|
||||
* deals with the cmi.core.exit, cmi.core.lesson_status and cmi.core.lesson_mode *and* the SCO
|
||||
* sends some kind of value for cmi.core.exit, which is not the case here (yet).
|
||||
*/
|
||||
function doContinue(status)
|
||||
{
|
||||
// Reinitialize Exit to blank
|
||||
doLMSSetValue( "cmi.core.exit", "" );
|
||||
var mode = doLMSGetValue( "cmi.core.lesson_mode" );
|
||||
if ( mode != "review" && mode != "browse" )
|
||||
{
|
||||
doLMSSetValue( "cmi.core.lesson_status", status );
|
||||
}
|
||||
computeTime();
|
||||
exitPageStatus = true;
|
||||
var result;
|
||||
result = doLMSCommit();
|
||||
result = doLMSFinish();
|
||||
}
|
||||
|
||||
/**
|
||||
* handles the recording of everything on a normal shutdown
|
||||
*/
|
||||
function doQuit()
|
||||
{
|
||||
checkAnswers();
|
||||
computeTime();
|
||||
exitPageStatus = true;
|
||||
var result;
|
||||
result = doLMSCommit();
|
||||
result = doLMSFinish();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called upon unload event from body element
|
||||
*/
|
||||
function unloadPage(status)
|
||||
{
|
||||
if (!exitPageStatus)
|
||||
{
|
||||
// doQuit( status );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the answers on the test formular page
|
||||
*/
|
||||
function checkAnswers(interrupted)
|
||||
{
|
||||
var tmpScore = 0;
|
||||
var status = 'not attempted';
|
||||
var scoreMax = 0;
|
||||
|
||||
addDebug('Number of questions: '+ questions.length);
|
||||
|
||||
for (var i=0; i < questions.length; i++) {
|
||||
if (questions[i] != undefined && questions[i] != null) {
|
||||
var idQuestion = questions[i];
|
||||
var type = questions_types[idQuestion];
|
||||
var interactionScore = 0;
|
||||
var interactionAnswers = '';
|
||||
var interactionCorrectResponses = '';
|
||||
var interactionType = '';
|
||||
|
||||
addDebug('idQuestion: ' +idQuestion + ', Type: ' +type);
|
||||
addDebug('questions_answers: ');
|
||||
addDebugTable(questions_answers[idQuestion]);
|
||||
addDebug('questions_answers_ponderation: ');
|
||||
addDebugTable(questions_answers_ponderation[idQuestion]);
|
||||
addDebug('questions_answers_correct: ');
|
||||
addDebugTable(questions_answers_correct[idQuestion]);
|
||||
|
||||
switch (type) {
|
||||
case 'mcma':
|
||||
interactionType = 'choice';
|
||||
var myScore = 0;
|
||||
for(var j = 0; j< questions_answers[idQuestion].length;j++) {
|
||||
var idAnswer = questions_answers[idQuestion][j];
|
||||
var answer = document.getElementById('question_'+(idQuestion)+'_multiple_'+(idAnswer));
|
||||
if (answer.checked) {
|
||||
interactionAnswers += idAnswer+'__|';// changed by isaac flores
|
||||
myScore += questions_answers_ponderation[idQuestion][idAnswer];
|
||||
}
|
||||
}
|
||||
interactionScore = myScore;
|
||||
scoreMax += questions_score_max[idQuestion];
|
||||
addDebug("Score: "+myScore);
|
||||
break;
|
||||
case 'mcua':
|
||||
interactionType = 'choice';
|
||||
var myScore = 0;
|
||||
for (var j = 0; j<questions_answers[idQuestion].length; j++) {
|
||||
var idAnswer = questions_answers[idQuestion][j];
|
||||
var elementId = 'question_'+(idQuestion)+'_unique_'+(idAnswer);
|
||||
var answer = document.getElementById(elementId);
|
||||
if (answer.checked) {
|
||||
addDebug('Element id # "'+ elementId +'" was checked');
|
||||
interactionAnswers += idAnswer;
|
||||
addDebug("List of correct answers: "+questions_answers_correct[idQuestion]);
|
||||
addDebug('Score for this answer: ' + questions_answers_ponderation[idQuestion][idAnswer]);
|
||||
addDebug("idAnswer: "+idAnswer);
|
||||
addDebug("Option selected: "+questions_answers_correct[idQuestion][idAnswer]);
|
||||
if (questions_answers_correct[idQuestion][idAnswer] == 1) {
|
||||
if (questions_answers_ponderation[idQuestion][idAnswer]) {
|
||||
myScore += questions_answers_ponderation[idQuestion][idAnswer];
|
||||
} else {
|
||||
myScore++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
addDebug("Score: "+myScore);
|
||||
interactionScore = myScore;
|
||||
scoreMax += questions_score_max[idQuestion];
|
||||
break;
|
||||
case 'tf':
|
||||
interactionType = 'true-false';
|
||||
var myScore = 0;
|
||||
for (var j = 0; j < questions_answers[idQuestion].length; j++) {
|
||||
var idAnswer = questions_answers[idQuestion][j];
|
||||
var answer = document.getElementById('question_' + idQuestion + '_tf_' + (idAnswer));
|
||||
if (answer.checked.value) {
|
||||
interactionAnswers += idAnswer;
|
||||
for (k = 0; k < questions_answers_correct[idQuestion].length; k++) {
|
||||
if (questions_answers_correct[idQuestion][k] == idAnswer) {
|
||||
if (questions_answers_ponderation[idQuestion][idAnswer]) {
|
||||
myScore += questions_answers_ponderation[idQuestion][idAnswer];
|
||||
} else {
|
||||
myScore++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
addDebug("Score: "+ myScore);
|
||||
interactionScore = myScore;
|
||||
scoreMax += questions_score_max[idQuestion];
|
||||
break;
|
||||
case 'fib':
|
||||
interactionType = 'fill-in';
|
||||
var myScore = 0;
|
||||
for (var j = 0; j < questions_answers[idQuestion].length; j++) {
|
||||
var idAnswer = questions_answers[idQuestion][j];
|
||||
var answer = document.getElementById('question_'+(idQuestion)+'_fib_'+(idAnswer));
|
||||
if (answer.value) {
|
||||
interactionAnswers += answer.value + '__|';//changed by isaac flores
|
||||
for (k = 0; k < questions_answers_correct[idQuestion].length; k++) {
|
||||
if (questions_answers_correct[idQuestion][k] == answer.value) {
|
||||
if (questions_answers_ponderation[idQuestion][idAnswer]) {
|
||||
myScore += questions_answers_ponderation[idQuestion][idAnswer];
|
||||
} else {
|
||||
myScore++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
addDebug("Score: "+myScore);
|
||||
interactionScore = myScore;
|
||||
scoreMax += questions_score_max[idQuestion];
|
||||
break;
|
||||
case 'matching':
|
||||
interactionType = 'matching';
|
||||
var myScore = 0;
|
||||
addDebug("List of correct answers: ");
|
||||
console.log(questions_answers_correct[idQuestion]);
|
||||
for (var j = 0; j < questions_answers[idQuestion].length; j++) {
|
||||
var idAnswer = questions_answers[idQuestion][j];
|
||||
var elementId = 'question_' + (idQuestion) + '_matching_' + (idAnswer);
|
||||
|
||||
addDebug("---------idAnswer #"+idAnswer+'------------------');
|
||||
addDebug("Checking element #"+elementId);
|
||||
|
||||
var answer = document.getElementById(elementId);
|
||||
|
||||
if (answer && answer.value) {
|
||||
interactionAnswers += answer.value + '__|';//changed by isaac flores
|
||||
for (k = 0; k < questions_answers_correct[idQuestion].length; k++) {
|
||||
var left = questions_answers_correct[idQuestion][k][0];
|
||||
var right = questions_answers_correct[idQuestion][k][1];
|
||||
addDebug('Left ' + left);
|
||||
addDebug('Right ' + right);
|
||||
addDebug('answer.value ' + answer.value);
|
||||
|
||||
if (right == idAnswer && left == answer.value) {
|
||||
addDebug('Score for this answer: ' + questions_answers_ponderation[idQuestion][idAnswer]);
|
||||
if (questions_answers_ponderation[idQuestion][idAnswer]) {
|
||||
myScore += questions_answers_ponderation[idQuestion][idAnswer];
|
||||
} else {
|
||||
// myScore++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
addDebug("Partial score: "+myScore);
|
||||
addDebug("--------- end --- idAnswer #"+idAnswer+'------------------');
|
||||
}
|
||||
addDebug("Score: "+myScore);
|
||||
interactionScore = myScore;
|
||||
scoreMax += questions_score_max[idQuestion];
|
||||
break;
|
||||
case 'free':
|
||||
//ignore for now as a score cannot be given
|
||||
interactionType = 'free';
|
||||
var answer = document.getElementById('question_'+(idQuestion)+'_free');
|
||||
if (answer && answer.value) {
|
||||
interactionAnswers += answer.value
|
||||
}
|
||||
|
||||
//interactionScore = questions_score_max[idQuestion];
|
||||
interactionScore = 0;
|
||||
scoreMax += questions_score_max[idQuestion];
|
||||
|
||||
//interactionAnswers = document.getElementById('question_'+(idQuestion)+'_free').value;
|
||||
//correct responses work by pattern, see SCORM Runtime Env Doc
|
||||
//interactionCorrectResponses += questions_answers_correct[idQuestion].toString();
|
||||
break;
|
||||
case 'hotspot':
|
||||
interactionType = 'sequencing';
|
||||
interactionScore = 0;
|
||||
//if(question_score && question_score[idQuestion]){
|
||||
// interactionScore = question_score[idQuestion];
|
||||
//} //else, 0
|
||||
//interactionAnswers = document.getElementById('question_'+(idQuestion)+'_free').innerHTML;
|
||||
//correct responses work by pattern, see SCORM Runtime Env Doc
|
||||
//for(k=0;k<questions_answers_correct[idQuestion].length;k++)
|
||||
//{
|
||||
// interactionCorrectResponses += questions_answers_correct[idQuestion][k].toString()+',';
|
||||
//}
|
||||
break;
|
||||
case 'exact':
|
||||
interactionType = 'exact';
|
||||
interactionScore = 0;
|
||||
var real_answers = new Array();
|
||||
for (var j = 0; j < questions_answers[idQuestion].length; j++) {
|
||||
var idAnswer = questions_answers[idQuestion][j];
|
||||
var answer = document.getElementById('question_' + (idQuestion) + '_exact_' + (idAnswer));
|
||||
|
||||
if (answer.checked == true) {
|
||||
interactionAnswers += idAnswer+', ';
|
||||
if (questions_answers_correct[idQuestion][idAnswer] != 0) {
|
||||
real_answers[j] = true;
|
||||
} else {
|
||||
real_answers[j] = false;
|
||||
}
|
||||
} else {
|
||||
if (questions_answers_correct[idQuestion][idAnswer] != 0) {
|
||||
real_answers[j] = false;
|
||||
} else {
|
||||
real_answers[j] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var final_answer = true;
|
||||
for (var z = 0; z < real_answers.length; z++) {
|
||||
if (real_answers[z] == false) {
|
||||
final_answer = false;
|
||||
}
|
||||
}
|
||||
interactionScore = 0;
|
||||
addDebug(real_answers);
|
||||
if (final_answer) {
|
||||
//getting only the first score where we save the weight of all the question
|
||||
interactionScore = questions_answers_ponderation[idQuestion][1];
|
||||
}
|
||||
addDebug("Score: "+interactionScore);
|
||||
scoreMax += questions_score_max[idQuestion];
|
||||
break;
|
||||
}
|
||||
tmpScore += interactionScore;
|
||||
doLMSSetValue('cmi.interactions.'+idQuestion+'.id', 'Q'+idQuestion);
|
||||
doLMSSetValue('cmi.interactions.'+idQuestion+'.type', interactionType);
|
||||
doLMSSetValue('cmi.interactions.'+idQuestion+'.student_response', interactionAnswers);
|
||||
doLMSSetValue('cmi.interactions.'+idQuestion+'.result', interactionScore);
|
||||
}
|
||||
}
|
||||
doLMSSetValue('cmi.core.score.min', 0);
|
||||
doLMSSetValue('cmi.core.score.max', scoreMax);
|
||||
doLMSSetValue('cmi.core.score.raw', tmpScore);
|
||||
|
||||
// Get status
|
||||
var mastery_score = doLMSGetValue('cmi.student_data.mastery_score');
|
||||
if (mastery_score <= 0) {
|
||||
mastery_score = (scoreMax * 0.80);
|
||||
}
|
||||
if (tmpScore >= mastery_score) {
|
||||
status = 'passed';
|
||||
} else {
|
||||
status = 'failed';
|
||||
}
|
||||
|
||||
addDebug('student_score: ' + tmpScore);
|
||||
addDebug('mastery_score: ' + mastery_score);
|
||||
addDebug('cmi.core.score.max: ' + scoreMax);
|
||||
addDebug('cmi.core.lesson_status: ' + status);
|
||||
doLMSSetValue('cmi.core.lesson_status', status);
|
||||
if (interrupted && (status != 'completed') && (status != 'passed')) {
|
||||
doLMSSetValue('cmi.core.exit', 'suspended');
|
||||
}
|
||||
|
||||
return false; //do not submit the form
|
||||
}
|
||||
|
||||
(function($){
|
||||
//Shuffle all rows, while keeping the first column
|
||||
//Requires: Shuffle
|
||||
$.fn.shuffleRows = function(){
|
||||
return this.each(function(){
|
||||
var main = $(/table/i.test(this.tagName) ? this.tBodies[0] : this);
|
||||
var firstElem = [], counter=0;
|
||||
main.children().each(function(){
|
||||
firstElem.push(this.firstChild);
|
||||
});
|
||||
main.shuffle();
|
||||
main.children().each(function(){
|
||||
this.insertBefore(firstElem[counter++], this.firstChild);
|
||||
});
|
||||
});
|
||||
}
|
||||
/* Shuffle is required */
|
||||
$.fn.shuffle = function() {
|
||||
return this.each(function(){
|
||||
var items = $(this).children();
|
||||
return (items.length)
|
||||
? $(this).html($.shuffle(items))
|
||||
: this;
|
||||
});
|
||||
}
|
||||
|
||||
$.shuffle = function(arr) {
|
||||
for(
|
||||
var j, x, i = arr.length; i;
|
||||
j = parseInt(Math.random() * i),
|
||||
x = arr[--i], arr[i] = arr[j], arr[j] = x
|
||||
);
|
||||
return arr;
|
||||
}
|
||||
})(jQuery);
|
||||
|
||||
/*
|
||||
* Assigns any event handler to any element
|
||||
* @param object Element on which the event is added
|
||||
* @param string Name of event
|
||||
* @param string Function to trigger on event
|
||||
* @param boolean Capture the event and prevent
|
||||
*/
|
||||
function addEvent(elm, evType, fn, useCapture)
|
||||
{
|
||||
if (elm.addEventListener) {
|
||||
elm.addEventListener(evType, fn, useCapture);
|
||||
return true;
|
||||
} else if(elm.attachEvent) {
|
||||
var r = elm.attachEvent('on' + evType, fn);
|
||||
return r;
|
||||
} else {
|
||||
elm['on' + evType] = fn;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* Bootstrap v3.3.6 (http://getbootstrap.com)
|
||||
* Copyright 2011-2015 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
*//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0 0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff2) format('woff2'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\002a"}.glyphicon-plus:before{content:"\002b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\Line truncated
|
||||
/*# sourceMappingURL=bootstrap.min.css.map */
|
||||
@@ -0,0 +1,5 @@
|
||||
/*! jQuery v1.12.4 | (c) jQuery Foundation | jquery.org/license */
|
||||
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(!l.ownFirst)for(b in a)return k.call(a,b);for(b in a);return void 0===b||k.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(h)return h.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=e.call(arguments,2),d=function(){return a.apply(b||this,c.concat(e.call(arguments)))},d.guid=a.guid=a.guid||n.guid++,d):void 0},now:function(){return+new Date},support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|Line truncated
|
||||
}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(M(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),"object"!=typeof b&&"function"!=typeof b||(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f}}function S(a,b,c){if(M(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=void 0)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}}),function(){var a;l.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,e;return c=d.getElementsByTagName("body")[0],c&&c.style?(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),"undefined"!=typeof b.style.zoom&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(d.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(e),a):void 0}}();var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),V=["Top","Right","Bottom","Left"],W=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function X(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&U.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,n.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var Y=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)Y(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},Z=/^(?:checkbox|radio)$/i,$=/<([\w:-]+)/,_=/^$|\/(?:java|ecma)script/i,aa=/^\s+/,ba="abbr|article|aside|audio|bdi|canvas|data|datalist|details|dialog|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|picture|progress|section|summary|template|time|video";function ca(a){var b=ba.split("|"),c=a.createDocumentFraLine truncated
|
||||
marginLeft:0},function(){return a.getBoundingClientRect().left}):0))+"px":void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+V[d]+b]=f[d]||f[d-2]||f[0];return e}},Na.test(a)||(n.cssHooks[a+b].set=db)}),n.fn.extend({css:function(a,b){return Y(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Ra(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return cb(this,!0)},hide:function(){return cb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){W(this)?n(this).show():n(this).hide()})}});function gb(a,b,c,d,e){return new gb.prototype.init(a,b,c,d,e)}n.Tween=gb,gb.prototype={constructor:gb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=gb.propHooks[this.prop];return a&&a.get?a.get(this):gb.propHooks._default.get(this)},run:function(a){var b,c=gb.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):gb.propHooks._default.set(this),this}},gb.prototype.init.prototype=gb.prototype,gb.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},gb.propHooks.scrollTop=gb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=gb.prototype.init,n.fx.step={};var hb,ib,jb=/^(?:toggle|show|hide)$/,kb=/queueHooks$/;function lb(){return a.setTimeout(function(){hb=void 0}),hb=n.now()}function mb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=V[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function nb(a,b,c){for(var d,e=(qb.tweeners[b]||[]).concat(qb.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ob(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&W(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k="none"===j?n._data(a,"olddisplay")||Ma(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==Ma(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],jb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(o))"inline"===("none"===j?Ma(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=nb(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function pb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function qb(a,b,c){var d,e,f=0,g=qb.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=hb||lb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:hb||lb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]Line truncated
|
||||
padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return Y(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var nc=a.jQuery,oc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=oc),b&&a.jQuery===n&&(a.jQuery=nc),n},b||(a.jQuery=a.$=n),n});
|
||||
Reference in new issue
Block a user