parent
ab76075acc
commit
04003cf303
|
@ -57,9 +57,9 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
' <div class="feedback-text"></div>' +
|
' <div class="feedback-text"></div>' +
|
||||||
' </div>' +
|
' </div>' +
|
||||||
' <div class="buttons">' +
|
' <div class="buttons">' +
|
||||||
' <a class="h5p-joubelui-button h5p-button qs-finishbutton"><%= finishButtonText %></a>' +
|
' <button type="button" class="h5p-joubelui-button h5p-button qs-finishbutton"><%= finishButtonText %></button>' +
|
||||||
' <a class="h5p-joubelui-button h5p-button qs-solutionbutton"><%= solutionButtonText %></a>' +
|
' <button type="button" class="h5p-joubelui-button h5p-button qs-solutionbutton"><%= solutionButtonText %></button>' +
|
||||||
' <a class="h5p-joubelui-button h5p-button qs-retrybutton"></a>' +
|
' <button type="button" class="h5p-joubelui-button h5p-button qs-retrybutton"><%= retryButtonText %></button>' +
|
||||||
' </div>' +
|
' </div>' +
|
||||||
'</div>';
|
'</div>';
|
||||||
|
|
||||||
|
@ -280,6 +280,23 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
score: scoreString,
|
score: scoreString,
|
||||||
passed: success
|
passed: success
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes our buttons behave like other buttons.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {string} classSelector
|
||||||
|
* @param {function} handler
|
||||||
|
*/
|
||||||
|
var hookUpButton = function (classSelector, handler) {
|
||||||
|
$(classSelector, $myDom).click(handler).keypress(function (e) {
|
||||||
|
if (e.which === 32) {
|
||||||
|
handler();
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
var displayResults = function () {
|
var displayResults = function () {
|
||||||
self.triggerXAPICompleted(self.getScore(), self.totalScore(), success);
|
self.triggerXAPICompleted(self.getScore(), self.totalScore(), success);
|
||||||
|
|
||||||
|
@ -291,26 +308,28 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
var eparams = {
|
var eparams = {
|
||||||
comment: (success ? params.endGame.successGreeting : params.endGame.failGreeting),
|
comment: (success ? params.endGame.successGreeting : params.endGame.failGreeting),
|
||||||
finishButtonText: params.endGame.finishButtonText,
|
finishButtonText: params.endGame.finishButtonText,
|
||||||
solutionButtonText: params.endGame.solutionButtonText
|
solutionButtonText: params.endGame.solutionButtonText,
|
||||||
|
retryButtonText: params.endGame.retryButtonText
|
||||||
};
|
};
|
||||||
|
|
||||||
// Show result page.
|
// Show result page.
|
||||||
$myDom.children().hide();
|
$myDom.children().hide();
|
||||||
$myDom.append(endTemplate.render(eparams));
|
$myDom.append(endTemplate.render(eparams));
|
||||||
$('.qs-finishbutton', $myDom).click(function () {
|
|
||||||
|
// Add event handlers to summary buttons
|
||||||
|
hookUpButton('.qs-finishbutton', function () {
|
||||||
self.trigger('h5pQuestionSetFinished', eventData);
|
self.trigger('h5pQuestionSetFinished', eventData);
|
||||||
});
|
});
|
||||||
$('.qs-solutionbutton', $myDom).click(function () {
|
hookUpButton('.qs-solutionbutton', function () {
|
||||||
showSolutions();
|
showSolutions();
|
||||||
$myDom.children().hide().filter('.questionset').show();
|
$myDom.children().hide().filter('.questionset').show();
|
||||||
_showQuestion(params.initialQuestion);
|
_showQuestion(params.initialQuestion);
|
||||||
});
|
});
|
||||||
$('.qs-retrybutton', $myDom)
|
hookUpButton('.qs-retrybutton', function () {
|
||||||
.html(params.endGame.retryButtonText)
|
resetTask();
|
||||||
.click(function () {
|
$myDom.children().hide().filter('.questionset').show();
|
||||||
resetTask();
|
_showQuestion(params.initialQuestion);
|
||||||
$myDom.children().hide().filter('.questionset').show();
|
});
|
||||||
_showQuestion(params.initialQuestion);});
|
|
||||||
|
|
||||||
if (scoreBar === undefined) {
|
if (scoreBar === undefined) {
|
||||||
scoreBar = H5P.JoubelUI.createScoreBar(totals);
|
scoreBar = H5P.JoubelUI.createScoreBar(totals);
|
||||||
|
|
Loading…
Reference in New Issue