Merge branch 'master' into text-editor
commit
894220c525
|
@ -22,9 +22,6 @@
|
|||
.questionset.hidden {
|
||||
display: none;
|
||||
}
|
||||
.questionset .h5p-multichoice > .h5p-show-solution, .questionset .dragndrop > .h5p-show-solution, .h5p-blanks .h5p-button {
|
||||
display: none;
|
||||
}
|
||||
.questionset, .intro-page, .questionset-results {
|
||||
position: relative;
|
||||
}
|
||||
|
@ -94,7 +91,7 @@
|
|||
.qs-footer {
|
||||
overflow: hidden;
|
||||
}
|
||||
.qs-footer .button, .qs-startbutton, .qs-finishbutton, .questionset-results .button, .video-container > .button {
|
||||
.qs-footer .h5p-button, .qs-startbutton, .qs-finishbutton, .questionset-results .h5p-button, .video-container > .h5p-button {
|
||||
display: inline-block;
|
||||
padding: 0 0.7em;
|
||||
border: 0.2em solid #fff;
|
||||
|
@ -112,7 +109,7 @@
|
|||
background: -ms-linear-gradient(top, rgba(100,152,254,1) 0%,rgba(4,104,206,1) 100%); /* IE10+ */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6498fe', endColorstr='#0468ce',GradientType=0 ); /* IE6-9 */
|
||||
}
|
||||
.qs-footer .button:hover, .qs-startbutton:hover, .questionset-results .button:hover, .video-container > .button:hover {
|
||||
.qs-footer .h5p-button:hover, .qs-startbutton:hover, .questionset-results .h5p-button:hover, .video-container > .h5p-button:hover {
|
||||
text-decoration: none;
|
||||
box-shadow: 0 0 0.5em #999;
|
||||
color: #ffffff;
|
||||
|
@ -133,16 +130,26 @@
|
|||
float: none;
|
||||
}
|
||||
|
||||
.qs-footer > .qs-retrybutton {
|
||||
float: none;
|
||||
}
|
||||
|
||||
.questionset-results a.h5p-button.qs-retrybutton:before {
|
||||
font-family: 'H5PFontAwesome4';
|
||||
padding-right: 0.5em;
|
||||
content: "\f021";
|
||||
}
|
||||
|
||||
.qs-footer > .next, .qs-footer > .finish, .qs-finishbutton {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.qs-footer a.next.button:after {
|
||||
.qs-footer a.next.h5p-button:after {
|
||||
font-family: 'H5PFontAwesome4';
|
||||
content: "\f054"; /* TODO: Use margin not whitespace, spacing is not content! */
|
||||
}
|
||||
|
||||
.qs-footer a.prev.button:before {
|
||||
.qs-footer a.prev.h5p-button:before {
|
||||
font-family: 'H5PFontAwesome4';
|
||||
content: "\f053";
|
||||
}
|
||||
|
@ -151,12 +158,12 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
.qs-footer a.finish.button:before {
|
||||
.qs-footer a.finish.h5p-button:before {
|
||||
font-family: 'H5PFontAwesome4';
|
||||
content: "\f00c ";
|
||||
}
|
||||
|
||||
.questionset-results a.button.qs-solutionbutton:before {
|
||||
.questionset-results a.h5p-button.qs-solutionbutton:before {
|
||||
font-family: 'H5PFontAwesome4';
|
||||
content: "\f06e ";
|
||||
}
|
||||
|
@ -167,7 +174,7 @@
|
|||
.video-container > video {
|
||||
background-color: #000;
|
||||
}
|
||||
.video-container > .button {
|
||||
.video-container > .h5p-button {
|
||||
position: absolute;
|
||||
top: 0.5em;
|
||||
right: 0.5em;
|
||||
|
|
|
@ -26,7 +26,7 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
' <% if (introPage.introduction) { %>' +
|
||||
' <div class="introduction"><%= introPage.introduction %></div>' +
|
||||
' <% } %>' +
|
||||
' <div class="buttons"><a class="qs-startbutton button"><%= introPage.startButtonText %></a></div>' +
|
||||
' <div class="buttons"><a class="qs-startbutton h5p-button"><%= introPage.startButtonText %></a></div>' +
|
||||
'</div>' +
|
||||
'<% } %>' +
|
||||
'<div class="questionset<% if (introPage.showIntroPage) { %> hidden<% } %>">' +
|
||||
|
@ -45,9 +45,9 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
' <span class="progress-text"></span>' +
|
||||
' <% } %>' +
|
||||
' </div>' +
|
||||
' <a class="prev button" title="<%= texts.prevButton %>"></a>' +
|
||||
' <a class="next button" title="<%= texts.nextButton %>"></a>' +
|
||||
' <a class="finish button"><%= texts.finishButton %></a>' +
|
||||
' <a class="prev h5p-button" title="<%= texts.prevButton %>"></a>' +
|
||||
' <a class="next h5p-button" title="<%= texts.nextButton %>"></a>' +
|
||||
' <a class="finish h5p-button"><%= texts.finishButton %></a>' +
|
||||
' </div>' +
|
||||
'</div>';
|
||||
|
||||
|
@ -58,7 +58,7 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
' <div class="emoticon"></div>' +
|
||||
' <div class="resulttext <%= scoreclass %>"><% if (comment) { %><h2><%= comment %></h2><% } %><%= score %><br><%= resulttext %></div>' +
|
||||
' </div>' +
|
||||
' <div class="buttons"><a class="button qs-finishbutton"><%= finishButtonText %></a><a class="button qs-solutionbutton"><%= solutionButtonText %></a></div>' +
|
||||
' <div class="buttons"><a class="h5p-button qs-finishbutton"><%= finishButtonText %></a><a class="h5p-button qs-solutionbutton"><%= solutionButtonText %></a><a class="h5p-button qs-retrybutton"></a></div>' +
|
||||
'</div>';
|
||||
|
||||
var defaults = {
|
||||
|
@ -89,8 +89,14 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
scoreString: 'You got @score points of @total possible.',
|
||||
finishButtonText: 'Finish',
|
||||
solutionButtonText: 'Show solution',
|
||||
retryButtonText: 'Retry',
|
||||
showAnimations: false
|
||||
},
|
||||
override: {
|
||||
overrideButtons: false,
|
||||
overrideShowSolutionButton: false,
|
||||
overrideRetry: false
|
||||
},
|
||||
postUserStatistics: (H5P.postUserStatistics === true)
|
||||
};
|
||||
|
||||
|
@ -108,8 +114,16 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
var question = params.questions[i];
|
||||
// TODO: Render on init, inject in template.
|
||||
|
||||
// override content parameters.
|
||||
if (params.override.overrideButtons) {
|
||||
// Extend subcontent with the overrided settings.
|
||||
$.extend(question.params.behaviour, {
|
||||
enableRetry: params.override.overrideRetry,
|
||||
enableSolutionsButton: params.override.overrideShowSolutionButton
|
||||
});
|
||||
}
|
||||
|
||||
$.extend(question.params, {
|
||||
displaySolutionsButton: false,
|
||||
postUserStatistics: false
|
||||
});
|
||||
questionInstances.push(H5P.newRunnable(question, contentId));
|
||||
|
@ -123,18 +137,18 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
}
|
||||
|
||||
if (currentQuestion === 0) {
|
||||
$('.prev.button', $myDom).hide();
|
||||
$('.prev.h5p-button', $myDom).hide();
|
||||
} else {
|
||||
$('.prev.button', $myDom).show();
|
||||
$('.prev.h5p-button', $myDom).show();
|
||||
}
|
||||
if (currentQuestion === (params.questions.length - 1)) {
|
||||
$('.next.button', $myDom).hide();
|
||||
$('.next.h5p-button', $myDom).hide();
|
||||
if (answered) {
|
||||
$('.finish.button', $myDom).show();
|
||||
$('.finish.h5p-button', $myDom).show();
|
||||
}
|
||||
} else {
|
||||
$('.next.button', $myDom).show();
|
||||
$('.finish.button', $myDom).hide();
|
||||
$('.next.h5p-button', $myDom).show();
|
||||
$('.finish.h5p-button', $myDom).hide();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -173,12 +187,42 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
return currentQuestion;
|
||||
};
|
||||
|
||||
/**
|
||||
* Show solutions for subcontent, and hide subcontent buttons.
|
||||
* Used for contracts with integrated content.
|
||||
* @public
|
||||
*/
|
||||
var showSolutions = function () {
|
||||
for (var i = 0; i < questionInstances.length; i++) {
|
||||
questionInstances[i].showSolutions();
|
||||
try {
|
||||
questionInstances[i].showSolutions();
|
||||
}
|
||||
catch(error) {
|
||||
console.log(error);
|
||||
console.log("subcontent does not contain a valid showSolutions() function");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Resets the task and every subcontent task.
|
||||
* Used for contracts with integrated content.
|
||||
* @public
|
||||
*/
|
||||
var resetTask = function () {
|
||||
for (var i = 0; i < questionInstances.length; i++) {
|
||||
try {
|
||||
questionInstances[i].resetTask();
|
||||
}
|
||||
catch(error) {
|
||||
console.log(error);
|
||||
console.log("subcontent does not contain a valid resetTask() function");
|
||||
}
|
||||
}
|
||||
//Force the last page to be reRendered
|
||||
rendered = false;
|
||||
};
|
||||
|
||||
var rendered = false;
|
||||
|
||||
var reRender = function () {
|
||||
|
@ -190,6 +234,8 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
$myDom.children().hide().filter('.questionset-results').show();
|
||||
return;
|
||||
}
|
||||
//Remove old score screen.
|
||||
$myDom.children().hide().filter('.questionset-results').remove();
|
||||
rendered = true;
|
||||
|
||||
// Get total score.
|
||||
|
@ -232,6 +278,12 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
$myDom.children().hide().filter('.questionset').show();
|
||||
_showQuestion(params.initialQuestion);
|
||||
});
|
||||
$('.qs-retrybutton', $myDom)
|
||||
.html(params.endGame.retryButtonText)
|
||||
.click(function () {
|
||||
resetTask();
|
||||
$myDom.children().hide().filter('.questionset').show();
|
||||
_showQuestion(params.initialQuestion);});
|
||||
};
|
||||
|
||||
if (params.endGame.showAnimations) {
|
||||
|
@ -254,7 +306,7 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
video.play();
|
||||
|
||||
if (params.endGame.skipButtonText) {
|
||||
$('<a class="button skip">' + params.endGame.skipButtonText + '</a>').click(function () {
|
||||
$('<a class="h5p-button skip">' + params.endGame.skipButtonText + '</a>').click(function () {
|
||||
video.stop();
|
||||
$videoContainer.hide();
|
||||
displayResults();
|
||||
|
@ -325,13 +377,13 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
$('.progress-dot', $myDom).click(function () {
|
||||
_showQuestion($(this).index());
|
||||
});
|
||||
$('.next.button', $myDom).click(function () {
|
||||
$('.next.h5p-button', $myDom).click(function () {
|
||||
_showQuestion(currentQuestion + 1);
|
||||
});
|
||||
$('.prev.button', $myDom).click(function () {
|
||||
$('.prev.h5p-button', $myDom).click(function () {
|
||||
_showQuestion(currentQuestion - 1);
|
||||
});
|
||||
$('.finish.button', $myDom).click(function () {
|
||||
$('.finish.h5p-button', $myDom).click(function () {
|
||||
_displayEndGame();
|
||||
});
|
||||
|
||||
|
@ -426,4 +478,4 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
getCopyrights: getCopyrights
|
||||
};
|
||||
return returnObject;
|
||||
};
|
||||
};
|
|
@ -143,6 +143,24 @@
|
|||
"description": "Denne videoen vil bli vist dersom brukeren ikke består spørsmålssettet."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Innstillinger for \"Vis svar\" knapp og \"Prøv igjen\".",
|
||||
"description": "Disse instillingene lar deg overstyre når \"Vis svar\" knapp og \"Prøv igjen\" er slått på i integrert h5p innhold.",
|
||||
"fields": [
|
||||
{
|
||||
"label": "Slå på overstyring for \"Vis svar\" og \"Prøv igjen\".",
|
||||
"description": "Aktivering vil overstyre de følgende innstillingene for integrert innhold."
|
||||
},
|
||||
{
|
||||
"label": "Slå på \"Vis svar\" knapp.",
|
||||
"description": "Aktivering vil slå på \"Vis svar\" knappen."
|
||||
},
|
||||
{
|
||||
"label": "Slå på \"Prøv igjen\".",
|
||||
"description": "Aktivering vil slå på \"Prøv igjen\" ."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -143,6 +143,24 @@
|
|||
"description": "Denne videoen vil bli vist dersom brukaren ikkje består spørsmålssettet."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Innstillinger for \"Vis svar\" knapp og \"Prøv igjen\".",
|
||||
"description": "Disse instillingene lar deg overstyre når \"Vis svar\" knapp og \"Prøv igjen\" er slått på i integrert h5p innhald.",
|
||||
"fields": [
|
||||
{
|
||||
"label": "Slå på overstyring for \"Vis svar\" og \"Prøv igjen\".",
|
||||
"description": "Aktivering vil overstyre dei følgjande innstillingene for integrert innhald."
|
||||
},
|
||||
{
|
||||
"label": "Slå på \"Vis svar\" knapp.",
|
||||
"description": "Aktivering vil slå på \"Vis svar\" knappen."
|
||||
},
|
||||
{
|
||||
"label": "Slå på \"Prøv igjen\".",
|
||||
"description": "Aktivering vil slå på \"Prøv igjen\" ."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
"title": "Question set",
|
||||
"contentType": "question",
|
||||
"majorVersion": 1,
|
||||
"minorVersion": 0,
|
||||
"patchVersion": 57,
|
||||
"minorVersion": 1,
|
||||
"patchVersion": 0,
|
||||
"runnable": 1,
|
||||
"fullscreen": 0,
|
||||
"machineName": "H5P.QuestionSet",
|
||||
|
|
|
@ -110,9 +110,11 @@
|
|||
"label": "Question type",
|
||||
"description": "Library for this question.",
|
||||
"options": [
|
||||
"H5P.MultiChoice 1.0",
|
||||
"H5P.DragQuestion 1.0",
|
||||
"H5P.Blanks 1.0"
|
||||
"H5P.MultiChoice 1.1",
|
||||
"H5P.DragQuestion 1.1",
|
||||
"H5P.Blanks 1.1",
|
||||
"H5P.MarkTheWords 1.1",
|
||||
"H5P.DragText 1.1"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -248,6 +250,13 @@
|
|||
"default": "Show solution",
|
||||
"description": "Text for the solution button."
|
||||
},
|
||||
{
|
||||
"name": "retryButtonText",
|
||||
"type": "text",
|
||||
"label": "Retry button label",
|
||||
"default": "Retry",
|
||||
"description": "Text for the retry button."
|
||||
},
|
||||
{
|
||||
"name": "finishButtonText",
|
||||
"type": "text",
|
||||
|
@ -268,8 +277,7 @@
|
|||
"name": "skipButtonText",
|
||||
"type": "text",
|
||||
"label": "Skip video button label",
|
||||
"default": "Skip video",
|
||||
"common": true
|
||||
"default": "Skip video"
|
||||
},
|
||||
{
|
||||
"name": "successVideo",
|
||||
|
@ -286,5 +294,35 @@
|
|||
"description": "This video will be played if the user failes the quiz."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "override",
|
||||
"type": "group",
|
||||
"label": "Settings for \"Show solution\" button and \"Retry\".",
|
||||
"description": "These options will let you override when to display \"Show solution\" button and \"Retry\" in integrated h5p content.",
|
||||
"optional": true,
|
||||
"fields": [
|
||||
{
|
||||
"name": "overrideButtons",
|
||||
"type": "boolean",
|
||||
"label": "Enable override for \"Show solution\" and \"Retry\" settings.",
|
||||
"description": "If this is enabled the questions own settings will be ignored and the below settings will be used instead.",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "overrideShowSolutionButton",
|
||||
"type": "boolean",
|
||||
"label": "Enable \"Show solution\" buttons.",
|
||||
"description": "Enabling this option will make questions show the \"Show solution\" button.",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "overrideRetry",
|
||||
"type": "boolean",
|
||||
"label": "Enable \"Retry\".",
|
||||
"description": "Enabling this option will make the user able to \"Retry\" .",
|
||||
"default": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue