diff --git a/css/questionset.css b/css/questionset.css index 6f5cf48..5e9cd9b 100644 --- a/css/questionset.css +++ b/css/questionset.css @@ -178,6 +178,7 @@ } .video-container > video { background-color: #000; + width: 100%; } .video-container > .h5p-button { position: absolute; diff --git a/js/questionset.js b/js/questionset.js index 945d2d5..f8d60dd 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -60,7 +60,9 @@ H5P.QuestionSet = function (options, contentId) { ' <% if (comment) { %>' + '
<%= comment %>
' + ' <% } %>' + + ' <% if (resulttext) { %>' + '
<%= resulttext %>
' + + ' <% } %>' + '
' + ' ' + ' ' + @@ -90,14 +92,15 @@ H5P.QuestionSet = function (options, contentId) { }, endGame: { showResultPage: true, + noResultMessage: 'Finished', message: 'Your result:', successGreeting: 'Congratulations!', successComment: 'You have enough correct answers to pass the test.', failGreeting: 'Sorry!', failComment: "You don't have enough correct answers to pass this test.", - scoreString: '@score of @total points', + scoreString: 'You got @score of @total points', finishButtonText: 'Finish', - solutionButtonText: 'Solution', + solutionButtonText: 'Show solution', retryButtonText: 'Retry', showAnimations: false, skipButtonText: 'Skip video' @@ -145,7 +148,7 @@ H5P.QuestionSet = function (options, contentId) { question.params = question.params || {}; question.params.overrideSettings = question.params.overrideSettings || {}; - question.params.overrideSettings.$confirmationDialogParent = $template; + question.params.overrideSettings.$confirmationDialogParent = $template.last(); question.params.overrideSettings.instance = this; var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, {parent: self}); @@ -264,6 +267,9 @@ H5P.QuestionSet = function (options, contentId) { // Hide finish button questionInstances[questionInstances.length - 1].hideButton('finish'); + // Mark all tasks as unanswered: + $('.progress-dot').removeClass('answered').addClass('unanswered'); + //Force the last page to be reRendered rendered = false; }; @@ -324,15 +330,10 @@ H5P.QuestionSet = function (options, contentId) { var displayResults = function () { self.triggerXAPICompleted(self.getScore(), self.totalScore(), success); - if (!params.endGame.showResultPage) { - self.trigger('h5pQuestionSetFinished', eventData); - return; - } - var eparams = { - message: params.endGame.message, - comment: (success ? params.endGame.successGreeting : params.endGame.failGreeting), - resulttext: (success ? params.endGame.successComment : params.endGame.failComment), + message: params.endGame.showResultPage ? params.endGame.message : params.endGame.noResultMessage, + comment: params.endGame.showResultPage ? (success ? params.endGame.successGreeting : params.endGame.failGreeting) : undefined, + resulttext: params.endGame.showResultPage ? (success ? params.endGame.successComment : params.endGame.failComment) : undefined, finishButtonText: params.endGame.finishButtonText, solutionButtonText: params.endGame.solutionButtonText, retryButtonText: params.endGame.retryButtonText @@ -342,37 +343,45 @@ H5P.QuestionSet = function (options, contentId) { $myDom.children().hide(); $myDom.append(endTemplate.render(eparams)); - // Add event handlers to summary buttons - hookUpButton('.qs-finishbutton', function () { - self.trigger('h5pQuestionSetFinished', eventData); - }); - hookUpButton('.qs-solutionbutton', function () { - showSolutions(); - $myDom.children().hide().filter('.questionset').show(); - _showQuestion(params.initialQuestion); - }); - hookUpButton('.qs-retrybutton', function () { - resetTask(); - $myDom.children().hide(); - - var $intro = $('.intro-page', $myDom); - if ($intro.length) { - // Show intro - $('.intro-page', $myDom).show(); - } - else { - // Show first question - $('.questionset', $myDom).show(); + if (params.endGame.showResultPage) { + // Add event handlers to summary buttons + hookUpButton('.qs-finishbutton', function () { + self.trigger('h5pQuestionSetFinished', eventData); + }); + hookUpButton('.qs-solutionbutton', function () { + showSolutions(); + $myDom.children().hide().filter('.questionset').show(); _showQuestion(params.initialQuestion); - } - }); + }); + hookUpButton('.qs-retrybutton', function () { + resetTask(); + $myDom.children().hide(); - if (scoreBar === undefined) { - scoreBar = H5P.JoubelUI.createScoreBar(totals); + var $intro = $('.intro-page', $myDom); + if ($intro.length) { + // Show intro + $('.intro-page', $myDom).show(); + } + else { + // Show first question + $('.questionset', $myDom).show(); + _showQuestion(params.initialQuestion); + } + }); + + if (scoreBar === undefined) { + scoreBar = H5P.JoubelUI.createScoreBar(totals); + } + scoreBar.appendTo($('.feedback-scorebar', $myDom)); + scoreBar.setScore(finals); + $('.feedback-text', $myDom).html(scoreString); } - scoreBar.appendTo($('.feedback-scorebar', $myDom)); - scoreBar.setScore(finals); - $('.feedback-text', $myDom).html(scoreString); + else { + // Remove buttons and feedback section + $('.qs-finishbutton, .qs-solutionbutton, .qs-retrybutton, .feedback-section', $myDom).remove(); + } + + self.trigger('resize'); }; if (params.endGame.showAnimations) { @@ -495,7 +504,9 @@ H5P.QuestionSet = function (options, contentId) { if (shortVerb === 'interacted' || shortVerb === 'answered' || shortVerb === 'attempted') { - $('.progress-dot:eq(' + currentQuestion +')', $myDom).removeClass('unanswered').addClass('answered'); + if (questionInstances[currentQuestion].getAnswerGiven()) { + $('.progress-dot:eq(' + currentQuestion +')', $myDom).removeClass('unanswered').addClass('answered'); + } _updateButtons(); } if (shortVerb === 'completed') { @@ -503,13 +514,10 @@ H5P.QuestionSet = function (options, contentId) { event.setVerb('answered'); } if (event.data.statement.context.extensions === undefined) { - event.data.statement.context.extensions = []; + event.data.statement.context.extensions = {}; } event.data.statement.context.extensions['http://id.tincanapi.com/extension/ending-point'] = currentQuestion + 1; }); - if (question.getAnswerGiven()) { - $('.progress-dot:eq(' + i +')', $myDom).removeClass('unanswered').addClass('answered'); - } } // Allow other libraries to add transitions after the questions have been inited @@ -530,7 +538,6 @@ H5P.QuestionSet = function (options, contentId) { // Hide all but initial Question. _showQuestion(params.initialQuestion); - _updateButtons(); if (renderSolutions) { showSolutions(); diff --git a/language/ar.json b/language/ar.json index 168b643..5217dad 100644 --- a/language/ar.json +++ b/language/ar.json @@ -92,6 +92,11 @@ { "label": "عرض النتائج" }, + { + "label": "No results message", + "description": "Text displayed on end page when \"Display results\" is disabled", + "default": "Finished" + }, { "label": "نص راس الملاحظات", "description": "سيتم عرض هذا العنوان في نهاية هذه المسابقة حيثما أجاب المستخدم على جميع الأسئلة المستعملة" diff --git a/language/de.json b/language/de.json index 31b2515..82a29c6 100644 --- a/language/de.json +++ b/language/de.json @@ -97,6 +97,11 @@ { "label": "Ergebnisanzeige" }, + { + "label": "No results message", + "description": "Text displayed on end page when \"Display results\" is disabled", + "default": "Finished" + }, { "label": "Kopfzeile Feedback", "default": "Dein Ergebnis:", diff --git a/language/fr.json b/language/fr.json index 5b00c62..23f6fb9 100644 --- a/language/fr.json +++ b/language/fr.json @@ -92,6 +92,11 @@ { "label": "Montrer les résultats" }, + { + "label": "No results message", + "description": "Text displayed on end page when \"Display results\" is disabled", + "default": "Finished" + }, { "label": "Feedback de fin", "description": "Ce texte sera affiché quand l'utilisateur aura totalement terminé le quiz." diff --git a/language/it.json b/language/it.json index 14c342f..8af2417 100644 --- a/language/it.json +++ b/language/it.json @@ -92,6 +92,11 @@ { "label": "Visualizza risultati" }, + { + "label": "No results message", + "description": "Text displayed on end page when \"Display results\" is disabled", + "default": "Finished" + }, { "label": "Intestazione Feedback", "description": "Questa intestazione verrà visualizzata alla fine del quiz, dopo che l'utente avrà risposto a tutte le domande." diff --git a/language/nb.json b/language/nb.json index bfe4399..84783da 100644 --- a/language/nb.json +++ b/language/nb.json @@ -94,6 +94,11 @@ { "label": "Vis resultater" }, + { + "label": "Melding når resultater ikke vises", + "description": "Teksten vises på avslutnings-siden når resultater ikke vises", + "default": "Ferdig" + }, { "label": "Overskrift over tilbakemeldinger", "default": "Resultat:", @@ -126,7 +131,7 @@ }, { "label": "Tekst til \"Fasit\" knapp", - "default": "Gå gjennom fasit.", + "default": "Gå gjennom fasit", "description": "" }, { diff --git a/language/nn.json b/language/nn.json index 5d8cb0c..5e47a98 100644 --- a/language/nn.json +++ b/language/nn.json @@ -94,6 +94,11 @@ { "label": "Vis resultat" }, + { + "label": "Melding når resultater ikke vises", + "description": "Teksten vises på avslutnings-siden når resultater ikke vises", + "default": "Ferdig" + }, { "label": "Overskrift over tilbakemeldingar", "default": "Resultat:", diff --git a/library.json b/library.json index b50a5f1..f4e9632 100644 --- a/library.json +++ b/library.json @@ -4,7 +4,7 @@ "contentType": "question", "majorVersion": 1, "minorVersion": 8, - "patchVersion": 1, + "patchVersion": 3, "embedTypes": [ "iframe" ], @@ -61,4 +61,4 @@ "minorVersion": 1 } ] -} \ No newline at end of file +} diff --git a/semantics.json b/semantics.json index b292c54..1ce4c57 100644 --- a/semantics.json +++ b/semantics.json @@ -110,11 +110,11 @@ "label": "Question type", "description": "Library for this question.", "options": [ - "H5P.MultiChoice 1.6", - "H5P.DragQuestion 1.5", - "H5P.Blanks 1.5", - "H5P.MarkTheWords 1.5", - "H5P.DragText 1.4" + "H5P.MultiChoice 1.7", + "H5P.DragQuestion 1.6", + "H5P.Blanks 1.6", + "H5P.MarkTheWords 1.6", + "H5P.DragText 1.5" ] } }, @@ -179,6 +179,14 @@ "label": "Display results", "default": true }, + { + "name": "noResultMessage", + "type": "text", + "label": "No results message", + "description": "Text displayed on end page when \"Display results\" is disabled", + "default": "Finished", + "optional": true + }, { "name": "message", "type": "text", @@ -196,7 +204,7 @@ "type": "text", "label": "Score display text", "description": "Text used to display Total user score. \"@score\" will be replaced by calculated score, \"@total\" will be replaced by maximum possible score. ", - "default": "@score of @total points", + "default": "You got @score of @total points", "optional": true }, { @@ -262,7 +270,7 @@ "name": "solutionButtonText", "type": "text", "label": "Solution button label", - "default": "Solution", + "default": "Show solution", "description": "Text for the solution button." }, {