Merge branch 'api-1.1'
commit
e0a615b8b3
|
@ -1,24 +1,5 @@
|
||||||
var H5P = H5P || {};
|
var H5P = H5P || {};
|
||||||
|
|
||||||
if (H5P.getPath === undefined) {
|
|
||||||
/**
|
|
||||||
* Find the path to the content files based on the id of the content
|
|
||||||
*
|
|
||||||
* Also identifies and returns absolute paths
|
|
||||||
*
|
|
||||||
* @param {String} path Absolute path to a file, or relative path to a file in the content folder
|
|
||||||
* @param {Number} contentId Identifier of the content requesting the path
|
|
||||||
* @returns {String} The path to use.
|
|
||||||
*/
|
|
||||||
H5P.getPath = function (path, contentId) {
|
|
||||||
if (path.substr(0, 7) === 'http://' || path.substr(0, 8) === 'https://') {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
return H5PIntegration.getContentPath(contentId) + path;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will render a Question with multiple choices for answers.
|
* Will render a Question with multiple choices for answers.
|
||||||
*
|
*
|
||||||
|
@ -127,13 +108,11 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
var question = params.questions[i];
|
var question = params.questions[i];
|
||||||
// TODO: Render on init, inject in template.
|
// TODO: Render on init, inject in template.
|
||||||
|
|
||||||
var libraryObject = H5P.libraryFromString(question.library);
|
|
||||||
$.extend(question.params, {
|
$.extend(question.params, {
|
||||||
displaySolutionsButton: false,
|
displaySolutionsButton: false,
|
||||||
postUserStatistics: false
|
postUserStatistics: false
|
||||||
});
|
});
|
||||||
var tmp = new (H5P.classFromName(libraryObject.machineName))(question.params, contentId);
|
questionInstances.push(H5P.newRunnable(question, contentId));
|
||||||
questionInstances.push(tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update button state.
|
// Update button state.
|
||||||
|
@ -172,8 +151,9 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
$('.question-container', $myDom).hide().eq(questionNumber).show();
|
$('.question-container', $myDom).hide().eq(questionNumber).show();
|
||||||
|
|
||||||
// Trigger resize on question in case the size of the QS has changed.
|
// Trigger resize on question in case the size of the QS has changed.
|
||||||
if (questionInstances[questionNumber].resize !== undefined) {
|
var instance = questionInstances[questionNumber];
|
||||||
questionInstances[questionNumber].resize();
|
if (instance.resize !== undefined) {
|
||||||
|
instance.resize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update progress indicator
|
// Update progress indicator
|
||||||
|
@ -444,4 +424,4 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
getCopyrights: getCopyrights
|
getCopyrights: getCopyrights
|
||||||
};
|
};
|
||||||
return returnObject;
|
return returnObject;
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
"fullscreen": 0,
|
"fullscreen": 0,
|
||||||
"machineName": "H5P.QuestionSet",
|
"machineName": "H5P.QuestionSet",
|
||||||
"author": "Amendor AS",
|
"author": "Amendor AS",
|
||||||
|
"coreApi": {
|
||||||
|
"majorVersion": 1,
|
||||||
|
"minorVersion": 1
|
||||||
|
},
|
||||||
"license": "cc-by-sa",
|
"license": "cc-by-sa",
|
||||||
"preloadedJs": [
|
"preloadedJs": [
|
||||||
{
|
{
|
||||||
|
@ -20,11 +24,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"preloadedDependencies": [
|
"preloadedDependencies": [
|
||||||
{
|
|
||||||
"machineName": "H5P.API",
|
|
||||||
"majorVersion": 1,
|
|
||||||
"minorVersion": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"machineName": "EmbeddedJS",
|
"machineName": "EmbeddedJS",
|
||||||
"majorVersion": 1,
|
"majorVersion": 1,
|
||||||
|
|
Loading…
Reference in New Issue