diff --git a/css/questionset.css b/css/questionset.css index a6959fa..6f5cf48 100644 --- a/css/questionset.css +++ b/css/questionset.css @@ -55,6 +55,11 @@ .progress-dot.current { background: #285585; } +.progress-dot:focus { + outline-color: rgb(40, 130, 211); + outline-width: thin; + outline-style: solid; +} .intro-page .title { font-size: 2em; @@ -104,7 +109,7 @@ float: none; } -.questionset-results a.h5p-button.qs-retrybutton:before { +.questionset-results button.h5p-button.qs-retrybutton:before { font-family: 'H5PFontAwesome4'; padding-right: 0.5em; content: "\f01e"; @@ -128,8 +133,7 @@ .h5p-question .h5p-question-prev, .h5p-question .h5p-question-next { - padding: 0; - height: 2.1875em; + padding: 0.5em 0; width: 2.1875em; } @@ -164,7 +168,7 @@ content: "\f00c"; } -.questionset-results a.h5p-button.qs-solutionbutton:before { +.questionset-results button.h5p-button.qs-solutionbutton:before { font-family: 'H5PFontAwesome4'; content: "\f06e "; /* TODO: Use margin not whitespace, spacing is not content! */ } @@ -190,22 +194,44 @@ text-align: center; background: rgba(255, 255, 255, 0.9); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#E6FFFFFF,endColorstr=#E6FFFFFF); - padding: 0.625em; } .questionset-results .feedback-section { - margin: 1em; + margin: 0.75em; +} + +.questionset-results .greeting { + margin-top: 1em; + color: #777; + font-size: 1.25em; } .questionset-results .feedback-section .feedback-text { - font-weight: bold; - color: #1a73d9; + font-weight: normal; + color: #777; } .questionset-results .buttons { margin-bottom: 1.5em; } +.questionset-results .result-header, +.questionset-results .result-text { + color: #1a73d9; + font-weight: bold; +} + +.questionset-results .result-header { + font-size: 2em; + margin-top: 1em; +} + +.questionset-results .result-text { + font-size: 1.25em; + line-height: 1.25em; + margin: 1em 1em 2.25em; +} + /* No margin for questions when no frame */ .h5p-no-frame .questionset .h5p-question > * { margin-left: 0; diff --git a/js/questionset.js b/js/questionset.js index c34a4a8..eeac01d 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -40,7 +40,7 @@ H5P.QuestionSet = function (options, contentId) { ' <% if (progressType == "dots") { %>' + '
' + ' <% for (var i=0; i' + - ' ' + + ' ' + ' <%} %>' + '
' + ' <% } else if (progressType == "textual") { %>' + @@ -52,14 +52,19 @@ H5P.QuestionSet = function (options, contentId) { var resulttemplate = '
' + + '
<%= message %>
' + '
' + ' ' + ' ' + '
' + + ' <% if (comment) { %>' + + '
<%= comment %>
' + + ' <% } %>' + + '
<%= resulttext %>
' + '
' + - ' <%= finishButtonText %>' + - ' <%= solutionButtonText %>' + - ' ' + + ' ' + + ' ' + + ' ' + '
' + '
'; @@ -76,10 +81,12 @@ H5P.QuestionSet = function (options, contentId) { startButtonText: 'Start' }, texts: { - prevButton: 'Previous', - nextButton: 'Next', + prevButton: 'Previous question', + nextButton: 'Next question', finishButton: 'Finish', - textualProgress: 'Question: @current of @total questions' + textualProgress: 'Question: @current of @total questions', + jumpToQuestion: 'Jump to question %d', + questionLabel: 'Question' }, endGame: { showResultPage: true, @@ -88,18 +95,13 @@ H5P.QuestionSet = function (options, contentId) { 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: 'You got @score points of @total possible.', + scoreString: '@score of @total points', finishButtonText: 'Finish', - solutionButtonText: 'Show solution', + solutionButtonText: 'Solution', retryButtonText: 'Retry', - showAnimations: false - }, - override: { - overrideButtons: false, - overrideShowSolutionButton: false, - overrideRetry: false - }, - questionLabel: 'Question' + showAnimations: false, + skipButtonText: 'Skip video' + } }; var template = new EJS({text: texttemplate}); @@ -113,18 +115,31 @@ H5P.QuestionSet = function (options, contentId) { var up; renderSolutions = false; + // Set overrides for questions + var override; + if (params.override.showSolutionButton || params.override.retryButton) { + override = {}; + if (params.override.showSolutionButton) { + // Force "Show solution" button to be on or off for all interactions + override.enableSolutionsButton = + (params.override.showSolutionButton === 'on' ? true : false); + } + + if (params.override.retryButton) { + // Force "Retry" button to be on or off for all interactions + override.enableRetry = + (params.override.retryButton === 'on' ? true : false); + } + } + // Instantiate question instances for (var i = 0; i < params.questions.length; i++) { var question = params.questions[i]; - // TODO: Render on init, inject in template. - // override content parameters. - if (params.override.overrideButtons) { + question.jumpAriaLabel = params.texts.jumpToQuestion.replace('%d', i + 1); + if (override) { // Extend subcontent with the overrided settings. - $.extend(question.params.behaviour, { - enableRetry: params.override.overrideRetry, - enableSolutionsButton: params.override.overrideShowSolutionButton - }); + $.extend(question.params.behaviour, override); } var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, {parent: self}); questionInstance.on('resize', function () { @@ -252,6 +267,17 @@ H5P.QuestionSet = function (options, contentId) { rendered = false; }; + var moveQuestion = function (direction) { + _stopQuestion(currentQuestion); + if (currentQuestion + direction >= questionInstances.length) { + _displayEndGame(); + + } + else { + _showQuestion(currentQuestion + direction); + } + }; + var _displayEndGame = function () { if (rendered) { $myDom.children().hide().filter('.questionset-results').show(); @@ -271,6 +297,23 @@ H5P.QuestionSet = function (options, contentId) { score: scoreString, 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 () { self.triggerXAPICompleted(self.getScore(), self.totalScore(), success); @@ -280,28 +323,42 @@ H5P.QuestionSet = function (options, contentId) { } var eparams = { + message: params.endGame.message, comment: (success ? params.endGame.successGreeting : params.endGame.failGreeting), + resulttext: (success ? params.endGame.successComment : params.endGame.failComment), finishButtonText: params.endGame.finishButtonText, - solutionButtonText: params.endGame.solutionButtonText + solutionButtonText: params.endGame.solutionButtonText, + retryButtonText: params.endGame.retryButtonText }; // Show result page. $myDom.children().hide(); $myDom.append(endTemplate.render(eparams)); - $('.qs-finishbutton', $myDom).click(function () { + + // Add event handlers to summary buttons + hookUpButton('.qs-finishbutton', function () { self.trigger('h5pQuestionSetFinished', eventData); }); - $('.qs-solutionbutton', $myDom).click(function () { + hookUpButton('.qs-solutionbutton', function () { showSolutions(); $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);}); + 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(); + _showQuestion(params.initialQuestion); + } + }); if (scoreBar === undefined) { scoreBar = H5P.JoubelUI.createScoreBar(totals); @@ -377,13 +434,15 @@ H5P.QuestionSet = function (options, contentId) { if (params.introPage.backgroundImage !== undefined) { var $intro = $myDom.find('.intro-page'); if ($intro.length) { + var bgImg = params.introPage.backgroundImage; + var bgImgRatio = (bgImg.height / bgImg.width); $intro.css({ - background: '#fff url("' + H5P.getPath(params.introPage.backgroundImage.path, contentId) + '") no-repeat 50% 50%', - backgroundSize: '100% auto' + background: '#fff url("' + H5P.getPath(bgImg.path, contentId) + '") no-repeat 50% 50%', + backgroundSize: 'auto 100%', + minHeight: bgImgRatio * +window.getComputedStyle($intro[0]).width.replace('px','') }); } } - var registerImageLoadedListener = function (question) { H5P.on(question, 'imageLoaded', function () { self.trigger('resize'); @@ -399,32 +458,27 @@ H5P.QuestionSet = function (options, contentId) { // Listen for image resize registerImageLoadedListener(question); - // Disable feedback for question - question.setBehaviour({disableFeedback: true}); - // Add next/finish button if (questionInstances[questionInstances.length -1] === question) { // Add finish question set button - question.addButton('finish', params.texts.finishButton, function () { - _stopQuestion(currentQuestion); - _displayEndGame(); - }, false); + question.addButton('finish', params.texts.finishButton, + moveQuestion.bind(this, 1), false); } else { // Add next question button - question.addButton('next', '', function () { - _stopQuestion(currentQuestion); - _showQuestion(currentQuestion + 1); + question.addButton('next', '', moveQuestion.bind(this, 1), true, { + href: '#', // Use href since this is a navigation button + 'aria-label': params.texts.nextButton }); } // Add previous question button if (questionInstances[0] !== question) { - question.addButton('prev', '', function () { - _stopQuestion(currentQuestion); - _showQuestion(currentQuestion - 1); + question.addButton('prev', '', moveQuestion.bind(this, -1), true, { + href: '#', // Use href since this is a navigation button + 'aria-label': params.texts.prevButton }); } @@ -455,14 +509,15 @@ H5P.QuestionSet = function (options, contentId) { $('.qs-startbutton', $myDom).click(function () { $(this).parents('.intro-page').hide(); - $('.questionset', $myDom).removeClass('hidden'); - _showQuestion(currentQuestion); + $('.questionset', $myDom).show(); + _showQuestion(params.initialQuestion); }); // Set event listeners. $('.progress-dot', $myDom).click(function () { _stopQuestion(currentQuestion); _showQuestion($(this).index()); + return false; }); // Hide all but initial Question. @@ -529,7 +584,7 @@ H5P.QuestionSet = function (options, contentId) { } // Determine label - var label = (params.questionLabel + ' ' + (i + 1)); + var label = (params.texts.questionLabel + ' ' + (i + 1)); if (qParams.contentName !== undefined) { label += ': ' + qParams.contentName; } diff --git a/language/ar.json b/language/ar.json index 55032b7..168b643 100644 --- a/language/ar.json +++ b/language/ar.json @@ -74,6 +74,15 @@ { "label": "نص التقدم", "description": "النص المستخدم إذا تم تحديد التقدم نصيا" + }, + { + "label": "Label for jumping to a certain question", + "description": "You must use the placeholder '%d' instead of the question number.", + "default": "Jump to question %d" + }, + { + "label": "Copyright dialog question label", + "default": "Question" } ] }, @@ -139,25 +148,32 @@ }, { "label": "إعدادات زر \"مشاهدة حل \" وزر \"إعادة المحاولة\" ", - "description": "وهذه الخيارات تمكنك من تجاوز وقت العرض بزر \"مشاهدة حل \" وزر \"إعادة المحاولة \" في محتويات متكامل h5p.", "fields": [ { - "label": "تفعيل زر تجاوز \"مشاهدة حل \" و إعدادات \"إعادة \"المحاولة", - "description": "وإذا تم تفعيل هذه الأسئلة سيتم تجاهل الإعدادات الخاصة وسيتم استخدام الضبط أدناه بدلا من ذلك" + "label": "Override \"Show Solution\" button", + "description": "This option determines if the \"Show Solution\" button will be shown for all questions, disabled for all or configured for each question individually.", + "options": [ + { + "label": "Enabled" + }, + { + "label": "Disabled" + } + ] }, { - "label": "تفعيل زر \"إظهار الحل\"", - "description": "تفعيل هذا الخيار يجعل الأسئلة تظهر زر \"مشاهدة الحل\"" - }, - { - "label": "تفعيل زر \"إعادة المحاولة\"", - "description": "تفعيل هذا الخيار يجعل المستخدم قادرا على \"إعادة المحاولة\"" + "label": "Override \"Retry\" button", + "description": "This option determines if the \"Retry\" button will be shown for all questions, disabled for all or configured for each question individually.", + "options": [ + { + "label": "Enabled" + }, + { + "label": "Disabled" + } + ] } ] - }, - { - "label": "Question label text", - "default": "Question" } ] } diff --git a/language/de.json b/language/de.json index 428a353..31b2515 100644 --- a/language/de.json +++ b/language/de.json @@ -79,6 +79,15 @@ "label": "Fortschrittstext", "description": "Verwendeter Text wenn Text Fortschrittsanzeige gewählt wurde.", "default": "Aktuelle Frage: @current von @total Fragen" + }, + { + "label": "Label for jumping to a certain question", + "description": "You must use the placeholder '%d' instead of the question number.", + "default": "Jump to question %d" + }, + { + "label": "Copyright dialog question label", + "default": "Question" } ] }, @@ -154,19 +163,30 @@ }, { "label": "Einstellungen für \"Zeige die Lösung\" Button und \"Nochmal\".", - "description": "Diese Möglichkeiten überschreiben die Anzeige von \"Zeige die Lösung\" Button und \"Nochmal\" bei integrierten h5p Inhalten.", "fields": [ { - "label": "Aktiviert das Überschreiben für \"Zeige die Lösung\" Button und \"Wiederholen\" Einstellungen.", - "description": "Wenn dies ausgewählt wurde, werden die Einstellungen der Frage ignoriert und stattdessen werden die nachfolgenden Einstellungen verwendet." + "label": "Override \"Show Solution\" button", + "description": "This option determines if the \"Show Solution\" button will be shown for all questions, disabled for all or configured for each question individually.", + "options": [ + { + "label": "Enabled" + }, + { + "label": "Disabled" + } + ] }, { - "label": "Aktiviert \"Zeige die Lösung\" Buttons.", - "description": "Wenn dies ausgewählt wurde, werden die Fragen den \"Zeige die Lösung\" Button haben." - }, - { - "label": "Aktiviert \"Wiederholen\".", - "description": "Wenn diese Option gewählt wurde, ermöglicht es den Benutzern zu \"Wiederholen\" ." + "label": "Override \"Retry\" button", + "description": "This option determines if the \"Retry\" button will be shown for all questions, disabled for all or configured for each question individually.", + "options": [ + { + "label": "Enabled" + }, + { + "label": "Disabled" + } + ] } ] } diff --git a/language/fr.json b/language/fr.json index 27eb841..5b00c62 100644 --- a/language/fr.json +++ b/language/fr.json @@ -74,6 +74,15 @@ { "label": "Texte de progression", "description": "Texte utilisé si la progression textuelle est utilisée." + }, + { + "label": "Label for jumping to a certain question", + "description": "You must use the placeholder '%d' instead of the question number.", + "default": "Jump to question %d" + }, + { + "label": "Copyright dialog question label", + "default": "Question" } ] }, @@ -139,25 +148,32 @@ }, { "label": "Options pour les boutons \"Montrer la solution\" et \"Réessayer\".", - "description": "Ces options vous permettent de choisir quand afficher les boutons \"Solutions\" et \"Réessayer\" dans votre acivité h5p..", "fields": [ { - "label": "Activer les réglages par défaut pour les boutons \"Solution\" et \"Réessayer\".", - "description": "Si cette option est choisie, les réglages seront valables pour toutes les questions, les réglages individuels ne seront pas pris en compte." + "label": "Override \"Show Solution\" button", + "description": "This option determines if the \"Show Solution\" button will be shown for all questions, disabled for all or configured for each question individually.", + "options": [ + { + "label": "Enabled" + }, + { + "label": "Disabled" + } + ] }, { - "label": "Afficher le bouton \"Solution\".", - "description": "Affiche le bouton \"Solution\"." - }, - { - "label": "Afficher le bouton \"Réessayer\".", - "description": "Affiche le bouton \"Réessayer\"." + "label": "Override \"Retry\" button", + "description": "This option determines if the \"Retry\" button will be shown for all questions, disabled for all or configured for each question individually.", + "options": [ + { + "label": "Enabled" + }, + { + "label": "Disabled" + } + ] } ] - }, - { - "label": "Texte de la question", - "default": "Question" } ] } diff --git a/language/it.json b/language/it.json index 6f52c6f..14c342f 100644 --- a/language/it.json +++ b/language/it.json @@ -74,6 +74,15 @@ { "label": "Testo Avanzamento", "description": "esto utilizzato se il testo Avanzamento è selezionato." + }, + { + "label": "Label for jumping to a certain question", + "description": "You must use the placeholder '%d' instead of the question number.", + "default": "Jump to question %d" + }, + { + "label": "Copyright dialog question label", + "default": "Question" } ] }, @@ -139,25 +148,32 @@ }, { "label": "Impostazioni per i pulsanti \"Mostra soluzione\" e \"Riprova\".", - "description": "Queste opzioni consentono di ignorare quando visualizzare i pulsanti \"Mostra soluzione\" e \"Riprova\" nel contenuto H5P integrato.", "fields": [ { - "label": "Abilita ignora impostazioni per \"Mostra soluzione\" e \"Riprova\".", - "description": "Se questa opzione è abilitata le proprie impostazioni per le domande saranno ignorate e verranno utilizzate le impostazioni seguenti." + "label": "Override \"Show Solution\" button", + "description": "This option determines if the \"Show Solution\" button will be shown for all questions, disabled for all or configured for each question individually.", + "options": [ + { + "label": "Enabled" + }, + { + "label": "Disabled" + } + ] }, { - "label": "Abilita pulsanti \"Mostra soluzione\".", - "description": "L'attivazione di questa opzione farà in modo che le domande mostrino il tasto \"Mostra soluzione\"." - }, - { - "label": "Abilita \"Riprova\".", - "description": "L'attivazione di questa opzione farà in modo che per l'utente sia abilitata l'opzione \"Riprova\"." + "label": "Override \"Retry\" button", + "description": "This option determines if the \"Retry\" button will be shown for all questions, disabled for all or configured for each question individually.", + "options": [ + { + "label": "Enabled" + }, + { + "label": "Disabled" + } + ] } ] - }, - { - "label": "Question label text", - "default": "Question" } ] } diff --git a/language/nb.json b/language/nb.json index 023a101..bfe4399 100644 --- a/language/nb.json +++ b/language/nb.json @@ -62,11 +62,11 @@ "fields": [ { "label": "Forrige-knappen", - "default": "Forrige" + "default": "Forrige spørsmål" }, { "label": "Neste-knappen", - "default": "Neste" + "default": "Neste spørsmål" }, { "label": "Avslutt-knappen", @@ -76,6 +76,15 @@ "label": "Fremdriftstekst", "description": "Tekst brukt hvis tekstlig angivelse av fremdrift er valgt. Variabler: @current og @total", "default": "Deloppgave @current av @total" + }, + { + "label": "Merkelapp ved hopping til spørsmål", + "description": "Du må bruke plassholderen '%d' istedenfor spørsmålsnummeret.", + "default": "Hopp til spørsmål %d" + }, + { + "label": "Opphavsrett spørsmål-etikett", + "default": "Spørsmål" } ] }, @@ -87,12 +96,12 @@ }, { "label": "Overskrift over tilbakemeldinger", - "default": "Ditt resultat:", + "default": "Resultat:", "description": "Denne overskriften vises over tilbakemeldingene på slutten av spørsmålssettet." }, { "label": "Poengvisningstekst", - "default": "Du fikk @score poeng av @total mulige.", + "default": "@score av @total poeng", "description": "Tekst som viser brukerens oppnådde poeng. \"@score\" blir erstattet med utregnet resultat, \"@total\" blir erstattet med høyest mulige resultat." }, { @@ -102,27 +111,27 @@ }, { "label": "Kommentar ved bestått", - "default": "Du presterte godt!", + "default": "Dette gikk bra.", "description": "Denne kommentaren vises dersom brukeren har bestått spørsmålssettet." }, { "label": "Tittel ved ikke bestått", - "default": "Ikke bestått", + "default": "Dette gikk ikke så bra!", "description": "Denne tittelen vises dersom brukeren ikke har bestått spørsmålssettet." }, { "label": "Kommentar ved ikke bestått", - "default": "Ikke bestått. Prøv igjen!", + "default": "Det er litt mange feil her. Prøv igjen!", "description": "Denne kommentaren vises dersom brukeren ikke har bestått spørsmålssettet." }, { "label": "Tekst til \"Fasit\" knapp", - "default": "Vis fasit", + "default": "Gå gjennom fasit.", "description": "" }, { "label": "Tekst til \"Prøv igjen\" knapp", - "default": "Prøv igjen", + "default": "Prøv igjen!", "description": "" }, { @@ -150,26 +159,33 @@ ] }, { - "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.", + "label": "Innstillinger for «Fasit»- og «Prøv igjen»-knapp", "fields": [ { - "label": "Slå på overstyring for \"Vis svar\" og \"Prøv igjen\".", - "description": "Aktivering vil overstyre de følgende innstillingene for integrert innhold." + "label": "Overstyr «Fasit»-knapp", + "description": "Dette valget avgjør om «Fasit»-knappen vil vises for alle spørsmål, skjules for alle eller konfigureres individuelt for hvert spørsmål.", + "options": [ + { + "label": "Aktivert" + }, + { + "label": "Deaktivert" + } + ] }, { - "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\" ." + "label": "Overstyr «Prøv igjen»-knapp", + "description": "Dette valget avgjør om «Prøv igjen»-knappen vil vises for alle spørsmål, skjules for alle eller konfigureres individuelt for hvert spørsmål.", + "options": [ + { + "label": "Aktivert" + }, + { + "label": "Deaktivert" + } + ] } ] - }, - { - "label": "Spørsmål-etikett", - "default": "Spørsmål" } ] } diff --git a/language/nn.json b/language/nn.json index 106be80..5d8cb0c 100644 --- a/language/nn.json +++ b/language/nn.json @@ -61,8 +61,8 @@ "label": "Ledetekster", "fields": [ { - "label": "Forrige-knappen", - "default": "Forrige" + "label": "Førre-knappen", + "default": "Førre" }, { "label": "Neste-knappen", @@ -75,7 +75,16 @@ { "label": "Fremdriftstekst", "description": "Tekst brukt hvis tekstlig angivelse av fremdrift er valgt. Variabler: @current og @total", - "default": "Deloppgave @current av @total" + "default": "Deloppgåve @current av @total" + }, + { + "label": "Merkelapp ved hopping til spørsmål", + "description": "Du må bruke plassholderen '%d' istedenfor spørsmålstalet.", + "default": "Hopp til spørsmål %d" + }, + { + "label": "Opphavsrett spørsmål-etikett", + "default": "Spørsmål" } ] }, @@ -87,12 +96,12 @@ }, { "label": "Overskrift over tilbakemeldingar", - "default": "Ditt resultat:", + "default": "Resultat:", "description": "Denne overskriften vises over tilbakemeldingane på slutten av spørsmålssettet." }, { "label": "Poengvisningstekst", - "default": "Du fikk @score poeng av @total mulige.", + "default": "@score av @total poeng", "description": "Tekst som viser brukerens oppnådde poeng. \"@score\" blir erstatta med utregna resultat, \"@total\" blir erstatta med høgest mulig resultat." }, { @@ -102,17 +111,17 @@ }, { "label": "Kommentar ved bestått", - "default": "Du presterte meget godt!", + "default": "Dette gjekk bra.", "description": "Denne kommentaren vises dersom brukaren har bestått spørsmålssettet." }, { "label": "Tittel ved ikkje bestått", - "default": "Ikkje bestått", + "default": "Dette gjekk ikkje så bra!", "description": "Denne tittelen visast dersom brukaren ikkje har bestått spørsmålssettet." }, { "label": "Kommentar ved ikkje bestått", - "default": "Dette er litt mange feil her. Prøv igjen!", + "default": "Det er litt mange feil her. Prøv igjen!", "description": "Denne kommentaren vises dersom brukaren ikkje har bestått spørsmålssettet." }, { @@ -150,26 +159,33 @@ ] }, { - "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.", + "label": "Innstillinger for «Fasit»- og «Prøv igjen»-knapp", "fields": [ { - "label": "Slå på overstyring for \"Vis svar\" og \"Prøv igjen\".", - "description": "Aktivering vil overstyre dei følgjande innstillingene for integrert innhald." + "label": "Overstyr «Fasit»-knapp", + "description": "Dette valget avgjør om «Fasit»-knappen vil vises for alle spørsmål, skjules for alle eller konfigureres individuelt for hvert spørsmål.", + "options": [ + { + "label": "Aktivert" + }, + { + "label": "Deaktivert" + } + ] }, { - "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\" ." + "label": "Overstyr «Prøv igjen»-knapp", + "description": "Dette valget avgjør om «Prøv igjen»-knappen vil vises for alle spørsmål, skjules for alle eller konfigureres individuelt for hvert spørsmål.", + "options": [ + { + "label": "Aktivert" + }, + { + "label": "Deaktivert" + } + ] } ] - }, - { - "label": "Spørsmål-etikett", - "default": "Spørsmål" } ] } diff --git a/library.json b/library.json index f813828..4ffc1b5 100644 --- a/library.json +++ b/library.json @@ -3,7 +3,7 @@ "description": "Put together a set of different questions that has to be solved. (Quiz)", "contentType": "question", "majorVersion": 1, - "minorVersion": 7, + "minorVersion": 8, "patchVersion": 0, "embedTypes": [ "iframe" diff --git a/semantics.json b/semantics.json index de90e20..b292c54 100644 --- a/semantics.json +++ b/semantics.json @@ -112,7 +112,7 @@ "options": [ "H5P.MultiChoice 1.6", "H5P.DragQuestion 1.5", - "H5P.Blanks 1.4", + "H5P.Blanks 1.5", "H5P.MarkTheWords 1.5", "H5P.DragText 1.4" ] @@ -128,13 +128,13 @@ "name": "prevButton", "type": "text", "label": "Back button", - "default": "Previous" + "default": "Previous question" }, { "name": "nextButton", "type": "text", "label": "Next button", - "default": "Next" + "default": "Next question" }, { "name": "finishButton", @@ -152,6 +152,19 @@ "strong", "em" ] + }, + { + "name": "jumpToQuestion", + "type": "text", + "label": "Label for jumping to a certain question", + "description": "You must use the placeholder '%d' instead of the question number.", + "default": "Jump to question %d" + }, + { + "name": "questionLabel", + "type": "text", + "label": "Copyright dialog question label", + "default": "Question" } ] }, @@ -183,7 +196,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": "You got @score points of @total possible.", + "default": "@score of @total points", "optional": true }, { @@ -249,7 +262,7 @@ "name": "solutionButtonText", "type": "text", "label": "Solution button label", - "default": "Show solution", + "default": "Solution", "description": "Text for the solution button." }, { @@ -300,37 +313,43 @@ { "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.", + "label": "Settings for \"Show solution\" and \"Retry\" buttons", "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": "showSolutionButton", + "type": "select", + "label": "Override \"Show Solution\" button", + "description": "This option determines if the \"Show Solution\" button will be shown for all questions, disabled for all or configured for each question individually.", + "optional": true, + "options": [ + { + "value": "on", + "label": "Enabled" + }, + { + "value": "off", + "label": "Disabled" + } + ] }, { - "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 + "name": "retryButton", + "type": "select", + "label": "Override \"Retry\" button", + "description": "This option determines if the \"Retry\" button will be shown for all questions, disabled for all or configured for each question individually.", + "optional": true, + "options": [ + { + "value": "on", + "label": "Enabled" + }, + { + "value": "off", + "label": "Disabled" + } + ] } ] - }, - { - "name": "questionLabel", - "type": "text", - "label": "Question label text", - "default": "Question" } ] diff --git a/upgrades.js b/upgrades.js index 77c5add..a44e08f 100644 --- a/upgrades.js +++ b/upgrades.js @@ -14,6 +14,42 @@ H5PUpgrades['H5P.QuestionSet'] = (function ($) { }); } } + finished(null, parameters); + }, + + /** + * Asynchronous content upgrade hook. + * Upgrades content parameters to support IV 1.7. + * + * Groups all UI text strings to make them eaiser to translate and handle. + * + * @params {Object} parameters + * @params {function} finished + */ + 8: function (parameters, finished) { + + if (parameters.override.overrideButtons) { + // Set new variables + parameters.override.showSolutionButton = + (parameters.override.overrideShowSolutionButton ? 'on' : 'off'); + parameters.override.retryButton = + (parameters.override.overrideRetry ? 'on' : 'off'); + } + + // Remove old field variables + delete parameters.override.overrideButtons; + delete parameters.override.overrideShowSolutionButton; + delete parameters.override.overrideRetry; + + // Move copyright dialog question label + if (parameters.questionLabel) { + parameters.texts = parameters.texts || {}; + parameters.texts.questionLabel = parameters.questionLabel; + } + + // Remove old copyright dialog question label + delete parameters.questionLabel; + finished(null, parameters); } }