From b02fe7c6685663d1e89a33aa2417b438085eb9b7 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Wed, 8 Jul 2015 11:01:20 +0200 Subject: [PATCH 01/23] Resize on video loaded and when results are already rendered. --- js/questionset.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index ae0442b..c4602fe 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -234,6 +234,7 @@ H5P.QuestionSet = function (options, contentId) { var _displayEndGame = function () { if (rendered) { $myDom.children().hide().filter('.questionset-results').show(); + self.trigger('resize'); return; } //Remove old score screen. @@ -305,6 +306,10 @@ H5P.QuestionSet = function (options, contentId) { } }); video.attach($videoContainer); + // Resize on video loaded + video.on('loaded', function () { + self.trigger('resize'); + }); video.play(); if (params.endGame.skipButtonText) { @@ -399,7 +404,7 @@ H5P.QuestionSet = function (options, contentId) { if (renderSolutions) { showSolutions(); } - + this.trigger('resize'); return this; @@ -476,4 +481,4 @@ H5P.QuestionSet = function (options, contentId) { } }; H5P.QuestionSet.prototype = Object.create(H5P.EventDispatcher.prototype); -H5P.QuestionSet.prototype.constructor = H5P.QuestionSet; \ No newline at end of file +H5P.QuestionSet.prototype.constructor = H5P.QuestionSet; From 56bb61352e2d32d26c8d0cb26ce3621939810929 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Wed, 8 Jul 2015 15:27:16 +0200 Subject: [PATCH 02/23] Added missing translation. --- language/nb.json | 5 +++++ language/nn.json | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/language/nb.json b/language/nb.json index c731683..0aeaa5d 100644 --- a/language/nb.json +++ b/language/nb.json @@ -120,6 +120,11 @@ "default": "Vis fasit", "description": "" }, + { + "label": "Tekst til \"Prøv igjen\" knapp", + "default": "Prøv igjen", + "description": "" + }, { "label": "Tekst til \"Avslutt\" knapp", "default": "Avslutt" diff --git a/language/nn.json b/language/nn.json index 667389e..39d1537 100644 --- a/language/nn.json +++ b/language/nn.json @@ -120,6 +120,11 @@ "default": "Vis fasit", "description": "" }, + { + "label": "Tekst til \"Prøv igjen\" knapp", + "default": "Prøv igjen", + "description": "" + }, { "label": "Tekst til \"Avslutt\" knapp", "default": "Avslutt" From cce3af6078416dbb39c26a0c9eb3358284600adc Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Fri, 10 Jul 2015 13:15:37 +0200 Subject: [PATCH 03/23] Replace attempted with interacted --- js/questionset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/questionset.js b/js/questionset.js index 6554bdf..7a08f65 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -364,7 +364,7 @@ H5P.QuestionSet = function (options, contentId) { question.attach($('.question-container:eq(' + i + ')', $myDom)); question.on('xAPI', function (event) { - if (event.getVerb() === 'attempted') { + if (event.getVerb() === 'interacted') { $('.progress-dot:eq(' + currentQuestion +')', $myDom).removeClass('unanswered').addClass('answered'); _updateButtons(); } From 436b9d572cc2ff7f84f4e5692f5ef8fa41c8767a Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Fri, 10 Jul 2015 13:41:16 +0200 Subject: [PATCH 04/23] Sub content is not allowed to generate completed statements --- js/questionset.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/questionset.js b/js/questionset.js index 7a08f65..269c056 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -364,10 +364,15 @@ H5P.QuestionSet = function (options, contentId) { question.attach($('.question-container:eq(' + i + ')', $myDom)); question.on('xAPI', function (event) { - if (event.getVerb() === 'interacted') { + var shortVerb = event.getVerb(); + if (shortVerb === 'interacted') { $('.progress-dot:eq(' + currentQuestion +')', $myDom).removeClass('unanswered').addClass('answered'); _updateButtons(); } + if (shortVerb === 'completed') { + // An activity within this activity is not allowed to send completed events + event.setVerb('answered'); + } }); if (question.getAnswerGiven()) { $('.progress-dot:eq(' + i +')', $myDom).removeClass('unanswered').addClass('answered'); From b399f9530d74e60e2e5bd67bd93b6db3a341fdd1 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Mon, 20 Jul 2015 13:22:22 +0200 Subject: [PATCH 05/23] xAPI update - add duration to xAPI --- js/questionset.js | 1 + library.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/js/questionset.js b/js/questionset.js index 269c056..27be0d4 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -331,6 +331,7 @@ H5P.QuestionSet = function (options, contentId) { // Function for attaching the multichoice to a DOM element. this.attach = function (target) { + this.setActivityStarted(); if (typeof(target) === "string") { $myDom = $('#' + target); } diff --git a/library.json b/library.json index 2f96968..fbe9cd5 100644 --- a/library.json +++ b/library.json @@ -13,7 +13,7 @@ "author": "Joubel AS", "coreApi": { "majorVersion": 1, - "minorVersion": 5 + "minorVersion": 6 }, "license": "cc-by-sa", "preloadedJs": [ From c4a78bfdcd71d43be62adbf04c5cbc4216959cc5 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Wed, 12 Aug 2015 14:46:49 +0200 Subject: [PATCH 06/23] Use new button design. Add navigation buttons to Question, instead of to QS. Added specific stylings for new button design. HFJ-946 --- css/questionset.css | 77 +++++++++++++++++++++----------------------- js/questionset.js | 78 +++++++++++++++++++++++++++------------------ library.json | 7 +++- 3 files changed, 89 insertions(+), 73 deletions(-) diff --git a/css/questionset.css b/css/questionset.css index 19130c0..6dceb75 100644 --- a/css/questionset.css +++ b/css/questionset.css @@ -62,7 +62,7 @@ font-weight: bold; text-align: center; } -.intro-page .title > span { +.intro-page .title > span { padding: 0.125em 0.5em; border-radius: 0.125em; background: rgb(255,255,255); /* Fallback for browsers not supporting rgba */ @@ -91,37 +91,7 @@ .qs-footer { overflow: hidden; } -.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; - border-radius: 0.4em; - margin: 0 0.5em 1em; - cursor: pointer; - color: #ffffff; - box-shadow: 0 0 0.5em #999; - line-height: 1.9em; - background: rgb(100,152,254); /* Old browsers */ - background: -moz-linear-gradient(top, rgba(100,152,254,1) 0%, rgba(4,104,206,1) 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(100,152,254,1)), color-stop(100%,rgba(4,104,206,1))); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, rgba(100,152,254,1) 0%,rgba(4,104,206,1) 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, rgba(100,152,254,1) 0%,rgba(4,104,206,1) 100%); /* Opera 11.10+ */ - 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 .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; - border-color: #fff; - background: rgb(4,104,206); /* Old browsers */ - background: -moz-linear-gradient(top, rgba(4,104,206,1) 0%, rgba(100,152,254,1) 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(4,104,206,1)), color-stop(100%,rgba(100,152,254,1))); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, rgba(4,104,206,1) 0%,rgba(100,152,254,1) 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, rgba(4,104,206,1) 0%,rgba(100,152,254,1) 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, rgba(4,104,206,1) 0%,rgba(100,152,254,1) 100%); /* IE10+ */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0468ce', endColorstr='#6498fe',GradientType=0 ); /* IE6-9 */ -} + .qs-footer > .prev { float: left; } @@ -144,28 +114,53 @@ float: right; } -.qs-footer a.next.h5p-button:after { - font-family: 'H5PFontAwesome4'; - content: "\f054"; /* TODO: Use margin not whitespace, spacing is not content! */ +.h5p-question .h5p-question-prev, +.h5p-question .h5p-question-finish, +.h5p-question .h5p-question-next { + float: right; } -.qs-footer a.prev.h5p-button:before { - font-family: 'H5PFontAwesome4'; +.h5p-question .h5p-question-prev, +.h5p-question .h5p-question-next { + padding: 0; + height: 2.1875em; + width: 2.1875em; +} + +.h5p-question .h5p-question-next, +.h5p-question .h5p-question-finish { + margin: 0 0 1.5em 0.5em; +} + +.h5p-question .h5p-question-prev { + margin: 0 0.5em 1.5em 0.5em; +} + +.h5p-question .h5p-question-next:before { + content: "\f054"; + padding-right: 0; + position: relative; + left: 2px; +} + +.h5p-question .h5p-question-prev:before { content: "\f053"; + padding-right: 0; + position: relative; + left: -2px; } .questionset-results .qs-finishbutton { display: none; } -.qs-footer a.finish.h5p-button:before { - font-family: 'H5PFontAwesome4'; - content: "\f00c "; +.h5p-question .h5p-question-finish:before { + content: "\f00c"; } .questionset-results a.h5p-button.qs-solutionbutton:before { font-family: 'H5PFontAwesome4'; - content: "\f06e "; + content: "\f06e "; /* TODO: Use margin not whitespace, spacing is not content! */ } .video-container { diff --git a/js/questionset.js b/js/questionset.js index 27be0d4..20eba15 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -28,7 +28,7 @@ H5P.QuestionSet = function (options, contentId) { ' <% if (introPage.introduction) { %>' + '
<%= introPage.introduction %>
' + ' <% } %>' + - ' ' + + ' ' + '' + '<% } %>' + '
' + @@ -47,9 +47,6 @@ H5P.QuestionSet = function (options, contentId) { ' ' + ' <% } %>' + '
' + - ' ' + - ' ' + - ' <%= texts.finishButton %>' + ' ' + ''; @@ -60,7 +57,11 @@ H5P.QuestionSet = function (options, contentId) { '
' + '
<% if (comment) { %>

<%= comment %>

<% } %><%= score %>
<%= resulttext %>
' + ' ' + - ' ' + + '
' + + ' <%= finishButtonText %>' + + ' <%= solutionButtonText %>' + + ' ' + + '
' + ''; var defaults = { @@ -126,11 +127,15 @@ H5P.QuestionSet = function (options, contentId) { } var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, {parent: self}); questionInstances.push(questionInstance); - questionInstance.on('resize', function() { - self.trigger('resize'); - }); } + // Resize all interactions on resize + self.on('resize', function () { + for (var i = 0; i < questionInstances.length; i++) { + questionInstances[i].trigger('resize'); + } + }); + // Update button state. var _updateButtons = function () { var answered = true; @@ -138,19 +143,8 @@ H5P.QuestionSet = function (options, contentId) { answered = answered && (questionInstances[i]).getAnswerGiven(); } - if (currentQuestion === 0) { - $('.prev.h5p-button', $myDom).hide(); - } else { - $('.prev.h5p-button', $myDom).show(); - } - if (currentQuestion === (params.questions.length - 1)) { - $('.next.h5p-button', $myDom).hide(); - if (answered) { - $('.finish.h5p-button', $myDom).show(); - } - } else { - $('.next.h5p-button', $myDom).show(); - $('.finish.h5p-button', $myDom).hide(); + if (currentQuestion === (params.questions.length - 1) && answered) { + questionInstances[currentQuestion].showButton('finish'); } }; @@ -222,6 +216,10 @@ H5P.QuestionSet = function (options, contentId) { console.log("subcontent does not contain a valid resetTask() function"); } } + + // Hide finish button + questionInstances[questionInstances.length - 1].hideButton('finish'); + //Force the last page to be reRendered rendered = false; }; @@ -314,7 +312,7 @@ H5P.QuestionSet = function (options, contentId) { video.play(); if (params.endGame.skipButtonText) { - $('').click(function () { + $('').click(function () { video.pause(); $videoContainer.hide(); displayResults(); @@ -364,6 +362,33 @@ H5P.QuestionSet = function (options, contentId) { var question = questionInstances[i]; question.attach($('.question-container:eq(' + i + ')', $myDom)); + + // 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 () { + _displayEndGame(); + }); + + } else { + + // Add next question button + question.addButton('next', '', function () { + _showQuestion(currentQuestion + 1); + }); + } + + // Add previous question button + if (questionInstances[0] !== question) { + question.addButton('prev', '', function () { + _showQuestion(currentQuestion - 1); + }); + } + question.on('xAPI', function (event) { var shortVerb = event.getVerb(); if (shortVerb === 'interacted') { @@ -393,15 +418,6 @@ H5P.QuestionSet = function (options, contentId) { $('.progress-dot', $myDom).click(function () { _showQuestion($(this).index()); }); - $('.next.h5p-button', $myDom).click(function () { - _showQuestion(currentQuestion + 1); - }); - $('.prev.h5p-button', $myDom).click(function () { - _showQuestion(currentQuestion - 1); - }); - $('.finish.h5p-button', $myDom).click(function () { - _displayEndGame(); - }); // Hide all but initial Question. _showQuestion(params.initialQuestion); diff --git a/library.json b/library.json index fbe9cd5..897cc19 100644 --- a/library.json +++ b/library.json @@ -41,6 +41,11 @@ "machineName": "H5P.Video", "majorVersion": 1, "minorVersion": 1 + }, + { + "machineName": "H5P.JoubelUI", + "majorVersion": 1, + "minorVersion": 1 } ], "editorDependencies": [ @@ -55,4 +60,4 @@ "minorVersion": 0 } ] -} \ No newline at end of file +} From 396abf92b77910a00c58b5788b0b5cd6649747d7 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Wed, 12 Aug 2015 15:30:10 +0200 Subject: [PATCH 07/23] No left, right, top or bot margins for Questions inside QS without frame. HFJ-949 --- css/questionset.css | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/css/questionset.css b/css/questionset.css index 6dceb75..ce830fa 100644 --- a/css/questionset.css +++ b/css/questionset.css @@ -264,3 +264,17 @@ color: #6aa81b; text-align: left; } + +/* No margin for questions when no frame */ +.h5p-no-frame .questionset .h5p-question > * { + margin-left: 0; + margin-right: 0; +} + +.h5p-no-frame .questionset .h5p-question > *:first-child { + margin-top: 0; +} + +.h5p-no-frame .questionset .h5p-question > *:last-child { + margin-bottom: 0; +} From ad0acb28984ca304c04cf066a6d165eabcb19e11 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Thu, 13 Aug 2015 10:35:55 +0200 Subject: [PATCH 08/23] Changed retry icon for whole task for consistency. Accepts answered and attempted xapi verbs as well to mark a question as answered. HFJ-946 --- css/questionset.css | 2 +- js/questionset.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/css/questionset.css b/css/questionset.css index ce830fa..8448f36 100644 --- a/css/questionset.css +++ b/css/questionset.css @@ -107,7 +107,7 @@ .questionset-results a.h5p-button.qs-retrybutton:before { font-family: 'H5PFontAwesome4'; padding-right: 0.5em; - content: "\f021"; + content: "\f01e"; } .qs-footer > .next, .qs-footer > .finish, .qs-finishbutton { diff --git a/js/questionset.js b/js/questionset.js index 20eba15..be4ec96 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -391,7 +391,9 @@ H5P.QuestionSet = function (options, contentId) { question.on('xAPI', function (event) { var shortVerb = event.getVerb(); - if (shortVerb === 'interacted') { + if (shortVerb === 'interacted' || + shortVerb === 'answered' || + shortVerb === 'attempted') { $('.progress-dot:eq(' + currentQuestion +')', $myDom).removeClass('unanswered').addClass('answered'); _updateButtons(); } From 0fb9b8882fc4269c26c797fe8bcafa52f5e9d132 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Tue, 18 Aug 2015 13:58:33 +0200 Subject: [PATCH 09/23] Added Question design to QS HFJ-946 --- css/questionset.css | 85 +++++++-------------------------------------- js/questionset.js | 24 ++++++++----- 2 files changed, 27 insertions(+), 82 deletions(-) diff --git a/css/questionset.css b/css/questionset.css index 8448f36..62b6068 100644 --- a/css/questionset.css +++ b/css/questionset.css @@ -187,82 +187,17 @@ padding: 0.625em; } -.questionset-results .greeting { - text-align: left; - border-bottom: 0.1em solid #ddd; - width: 100%; +.questionset-results .feedback-section { + margin: 1.5em; } -.questionset-results .score { - margin: 0; - display: block; - margin-bottom: 2em; -} - -.questionset-results .resulttext { - text-align: left; - font-size: 1.25em; - line-height: 1.25em; - margin: 1em 0em; - background-repeat: no-repeat; - background-position: left center; -} - -.questionset-results .resulttext.fail em { - font-style: normal; - color: #b9272d; -} - -.questionset-results .score.success .emoticon:before { - font-family: icomoon-questionset; - font-size: 5em; - line-height: 100%; - content: "\e606"; - float: left; -} - -.questionset-results .score.fail .emoticon:before { - font-family: icomoon-questionset; - font-size: 5em; - line-height: 100%; - content: "\e607"; - float: left; -} - -.questionset-results .resulttext.success, -.questionset-results .resulttext.almost, -.questionset-results .resulttext.fail -{ - display: block; - background: #eee; - padding: 1em; - border-radius: 1em; - margin-left: 6.5em; - position: relative; - font-size: 1em; -} - -.questionset-results .resulttext.success:before, -.questionset-results .resulttext.fail:before -{ - font-family: icomoon-questionset; - content: ""; - font-size: 5em; - position: absolute; - left: -14px; - top: 36px; - height: 0; - width: 0; - border-top: 15px solid transparent; - border-bottom: 15px solid transparent; - border-right: 15px solid #eee; +.questionset-results .feedback-section .feedback-text { + font-weight: bold; + color: #1a73d9; display: inline-block; -} - -.questionset-results .resulttext.success em { - font-style: normal; - color: #6aa81b; - text-align: left; + position: relative; + top: -1em; + margin-top: .8em; } /* No margin for questions when no frame */ @@ -278,3 +213,7 @@ .h5p-no-frame .questionset .h5p-question > *:last-child { margin-bottom: 0; } + +.h5p-no-frame .questionset-results .feedback-section { + margin-top: 0; +} diff --git a/js/questionset.js b/js/questionset.js index be4ec96..47753fc 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -52,10 +52,9 @@ H5P.QuestionSet = function (options, contentId) { var resulttemplate = '
' + - '
<%= message %>
' + - '
' + - '
' + - '
<% if (comment) { %>

<%= comment %>

<% } %><%= score %>
<%= resulttext %>
' + + ' ' + '
' + ' <%= finishButtonText %>' + @@ -110,6 +109,7 @@ H5P.QuestionSet = function (options, contentId) { var currentQuestion = 0; var questionInstances = []; var $myDom; + var scoreBar; renderSolutions = false; // Instantiate question instances @@ -258,11 +258,7 @@ H5P.QuestionSet = function (options, contentId) { } var eparams = { - message: params.endGame.message, comment: (success ? params.endGame.successGreeting : params.endGame.failGreeting), - score: scoreString, - scoreclass: (success ? 'success' : 'fail'), - resulttext: (success ? params.endGame.successComment : params.endGame.failComment), finishButtonText: params.endGame.finishButtonText, solutionButtonText: params.endGame.solutionButtonText }; @@ -270,7 +266,7 @@ H5P.QuestionSet = function (options, contentId) { // Show result page. $myDom.children().hide(); $myDom.append(endTemplate.render(eparams)); - $('.qs-finishbutton').click(function () { + $('.qs-finishbutton', $myDom).click(function () { self.trigger('h5pQuestionSetFinished', eventData); }); $('.qs-solutionbutton', $myDom).click(function () { @@ -284,6 +280,16 @@ H5P.QuestionSet = function (options, contentId) { resetTask(); $myDom.children().hide().filter('.questionset').show(); _showQuestion(params.initialQuestion);}); + + if (scoreBar === undefined) { + scoreBar = H5P.JoubelUI.createScoreBar(totals); + } + console.log($myDom); + console.log($('.feedback-scorebar', $myDom)); + scoreBar.appendTo($('.feedback-scorebar', $myDom)); + scoreBar.setScore(finals); + console.log($('.feedback-text', $myDom)); + $('.feedback-text', $myDom).html(scoreString); }; if (params.endGame.showAnimations) { From fdc91abcf8498a1f9ff787e2fb4761b5b9597bd3 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Tue, 18 Aug 2015 14:02:13 +0200 Subject: [PATCH 10/23] Removed debugging lines HFJ-946 --- js/questionset.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 47753fc..e0ff70f 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -284,11 +284,8 @@ H5P.QuestionSet = function (options, contentId) { if (scoreBar === undefined) { scoreBar = H5P.JoubelUI.createScoreBar(totals); } - console.log($myDom); - console.log($('.feedback-scorebar', $myDom)); scoreBar.appendTo($('.feedback-scorebar', $myDom)); scoreBar.setScore(finals); - console.log($('.feedback-text', $myDom)); $('.feedback-text', $myDom).html(scoreString); }; From 8623bb5670a1c7803cc52e56337157bab8322626 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Tue, 18 Aug 2015 14:16:07 +0200 Subject: [PATCH 11/23] Repositioned buttons, added bottom margin, repositioned feedback-text. HFJ-946 --- css/questionset.css | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/css/questionset.css b/css/questionset.css index 62b6068..cdb03e1 100644 --- a/css/questionset.css +++ b/css/questionset.css @@ -194,10 +194,10 @@ .questionset-results .feedback-section .feedback-text { font-weight: bold; color: #1a73d9; - display: inline-block; - position: relative; - top: -1em; - margin-top: .8em; +} + +.questionset-results .buttons { + margin-bottom: 1.5em; } /* No margin for questions when no frame */ @@ -206,14 +206,12 @@ margin-right: 0; } +.h5p-no-frame .questionset-results .feedback-section, .h5p-no-frame .questionset .h5p-question > *:first-child { margin-top: 0; } +.h5p-no-frame .questionset-results .buttons, .h5p-no-frame .questionset .h5p-question > *:last-child { margin-bottom: 0; } - -.h5p-no-frame .questionset-results .feedback-section { - margin-top: 0; -} From b9cd56820f7ed17460ca33c3a8f75638d2e83de4 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Wed, 19 Aug 2015 16:05:16 +0200 Subject: [PATCH 12/23] Adjusted paddings/margins for H5P.Question HFJ-942 --- css/questionset.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/questionset.css b/css/questionset.css index cdb03e1..fef0b6f 100644 --- a/css/questionset.css +++ b/css/questionset.css @@ -188,7 +188,7 @@ } .questionset-results .feedback-section { - margin: 1.5em; + margin: 1em; } .questionset-results .feedback-section .feedback-text { From 7c6aa504fd4e1b9e8a442d27c67cb4b5e60d40f4 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Thu, 20 Aug 2015 16:14:29 +0200 Subject: [PATCH 13/23] Replaced console logs with useful error messages. HFJ-946 --- js/questionset.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index e0ff70f..4333b60 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -195,8 +195,7 @@ H5P.QuestionSet = function (options, contentId) { questionInstances[i].showSolutions(); } catch(error) { - console.log(error); - console.log("subcontent does not contain a valid showSolutions() function"); + H5P.error("subcontent does not contain a valid showSolutions function"); } } }; @@ -212,8 +211,7 @@ H5P.QuestionSet = function (options, contentId) { questionInstances[i].resetTask(); } catch(error) { - console.log(error); - console.log("subcontent does not contain a valid resetTask() function"); + H5P.error("subcontent does not contain a valid resetTask function"); } } From 9b0844c480231becd0be973dd9f55a1fe74b0c8e Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Thu, 20 Aug 2015 16:16:02 +0200 Subject: [PATCH 14/23] Display error stack as well as useful error message. HFJ-946 --- js/questionset.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/questionset.js b/js/questionset.js index 4333b60..ff08a33 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -196,6 +196,7 @@ H5P.QuestionSet = function (options, contentId) { } catch(error) { H5P.error("subcontent does not contain a valid showSolutions function"); + H5P.error(error); } } }; @@ -212,6 +213,7 @@ H5P.QuestionSet = function (options, contentId) { } catch(error) { H5P.error("subcontent does not contain a valid resetTask function"); + H5P.error(error); } } From 7da44eb0f9dcd3e038751b16b6f690ba582bc632 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Fri, 21 Aug 2015 16:38:26 +0200 Subject: [PATCH 15/23] Added French language support. --- language/fr.json | 174 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 language/fr.json diff --git a/language/fr.json b/language/fr.json new file mode 100644 index 0000000..c742a7d --- /dev/null +++ b/language/fr.json @@ -0,0 +1,174 @@ +{ + "semantics": [ + { + "label": "Introduction du Quiz ", + "fields": [ + { + "label": "Montrer l'introduction" + }, + { + "label": "Titre", + "description": "Ce titre sera affiché au-dessus de votre texte d'introduction." + }, + { + "label": "Texte d'introduction ", + "description": "Ce texte sera affiché avant le démarrage du quiz." + }, + { + "label": "Texte du bouton de démarrage", + "default": "Commencer le Quiz" + }, + { + "label": "Image d'arrière-plan", + "description": "Image d'arrière-plan optionnelle pour l'introduction." + } + ] + }, + { + "label": "Image d'arrière-plan", + "description": "Image d'arrière-plan optionnelle pour la série de questions." + }, + { + "label": "Indicateur de progression", + "description": "Style de l'indicateur de progression de la série de questions", + "options": [ + { + "label": "Texte" + }, + { + "label": "Points" + } + ] + }, + { + "label": "Pourcentage de réussite", + "description": "Pourcentage exigé pour la réussite du quiz." + }, + { + "label": "Questions", + "widgets": [ + { + "label": "Par défaut" + }, + { + "label": "Texte" + } + ], + "entity": "question", + "field": { + "label": "Type de question", + "description": "Types possibles pour cette question." + } + }, + { + "label": "Interface des Textes dans le quiz", + "fields": [ + { + "label": "Bouton précédent", + "default": "Précédent" + }, + { + "label": "Bouton suivant", + "default": "Suivant" + }, + { + "label": "Bouton fin", + "default": "Fin" + }, + { + "label": "Texte de progression", + "description": "Texte utilisé si la progression textuelle est utilisée.", + "default": "Question: @current sur @total questions" + } + ] + }, + { + "label": "Quiz fini", + "fields": [ + { + "label": "Montrer les résultats" + }, + { + "label": "Feedback de fin", + "default": "Votre score:", + "description": "Ce texte sera affiché quand l'utilisateur aura totalement terminé le quiz." + }, + { + "label": "Texte d'affichage du score", + "description": "Texte utilisé pour afficher le score total de l'utilisateur. \"@score\" sera remplacé par le score de l'utilisateur, \"@total\" sera remplacé par le score maximum possible. ", + "default": "Vous avez @score points sur un total de @total points possibles." + }, + { + "label": "Texte de félicitation", + "default": "Félicitations!", + "description": "Texte affiché lors du passage du quiz avec succès." + }, + { + "label": "Commentaire de fin de quiz réussi", + "default": "Très bien joué!", + "description": "Commentaire affiché lors du passage du quiz avec succès." + }, + { + "label": "Texte d'échec", + "default": "Ce sera pour une autre fois!", + "description": "Texte affiché lors de l'échec au quiz." + }, + { + "label": "Commentaire de fin de quiz échoué", + "default": "Il faudra réessayer!", + "description": "Commentaire affiché lors de l'échec au quiz." + }, + { + "label": "Texte du bouton Solution", + "default": "Solution", + "description": "Texte pour le bouton de solution." + }, + { + "label": "Texte du bouton Réessayer", + "default": "Réessayer", + "description": "Texte pour le bouton Réessayer." + }, + { + "label": "Texte pour le bouton de fin", + "default": "Fin" + }, + { + "label": "Montrer une vidéo avant l'affichage des résultats du quiz" + }, + { + "label": "Activer le bouton passer la vidéo" + }, + { + "label": "Texte du bouton passer la vidéo", + "default": "Passer la vidéo" + }, + { + "label": "Video en cas de succès", + "description": "Vidéo affichée lors du passage du quiz avec succès." + }, + { + "label": "Video en cas d'échec", + "description": "Vidéo affichée lors de l'échec au quiz." + } + ] + }, + { + "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": "Afficher le bouton \"Solution\".", + "description": "Affiche le bouton \"Solution\"." + }, + { + "label": "Afficher le bouton \"Réessayer\".", + "description": "Affiche le bouton \"Réessayer\"." + } + ] + } + ] +} \ No newline at end of file From a6b11ba71ca9ab4dabcf221553c827f9353b57b5 Mon Sep 17 00:00:00 2001 From: Stephlabaraque Date: Tue, 25 Aug 2015 19:08:14 +0200 Subject: [PATCH 16/23] Update fr.json --- language/fr.json | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/language/fr.json b/language/fr.json index c742a7d..27eb841 100644 --- a/language/fr.json +++ b/language/fr.json @@ -15,8 +15,7 @@ "description": "Ce texte sera affiché avant le démarrage du quiz." }, { - "label": "Texte du bouton de démarrage", - "default": "Commencer le Quiz" + "label": "Texte du bouton de démarrage" }, { "label": "Image d'arrière-plan", @@ -64,21 +63,17 @@ "label": "Interface des Textes dans le quiz", "fields": [ { - "label": "Bouton précédent", - "default": "Précédent" + "label": "Bouton précédent" }, { - "label": "Bouton suivant", - "default": "Suivant" + "label": "Bouton suivant" }, { - "label": "Bouton fin", - "default": "Fin" + "label": "Bouton fin" }, { "label": "Texte de progression", - "description": "Texte utilisé si la progression textuelle est utilisée.", - "default": "Question: @current sur @total questions" + "description": "Texte utilisé si la progression textuelle est utilisée." } ] }, @@ -90,47 +85,38 @@ }, { "label": "Feedback de fin", - "default": "Votre score:", "description": "Ce texte sera affiché quand l'utilisateur aura totalement terminé le quiz." }, { "label": "Texte d'affichage du score", - "description": "Texte utilisé pour afficher le score total de l'utilisateur. \"@score\" sera remplacé par le score de l'utilisateur, \"@total\" sera remplacé par le score maximum possible. ", - "default": "Vous avez @score points sur un total de @total points possibles." + "description": "Texte utilisé pour afficher le score total de l'utilisateur. \"@score\" sera remplacé par le score de l'utilisateur, \"@total\" sera remplacé par le score maximum possible." }, { "label": "Texte de félicitation", - "default": "Félicitations!", "description": "Texte affiché lors du passage du quiz avec succès." }, { "label": "Commentaire de fin de quiz réussi", - "default": "Très bien joué!", "description": "Commentaire affiché lors du passage du quiz avec succès." }, { "label": "Texte d'échec", - "default": "Ce sera pour une autre fois!", "description": "Texte affiché lors de l'échec au quiz." }, { "label": "Commentaire de fin de quiz échoué", - "default": "Il faudra réessayer!", "description": "Commentaire affiché lors de l'échec au quiz." }, { "label": "Texte du bouton Solution", - "default": "Solution", "description": "Texte pour le bouton de solution." }, { "label": "Texte du bouton Réessayer", - "default": "Réessayer", "description": "Texte pour le bouton Réessayer." }, { - "label": "Texte pour le bouton de fin", - "default": "Fin" + "label": "Texte pour le bouton de fin" }, { "label": "Montrer une vidéo avant l'affichage des résultats du quiz" @@ -139,8 +125,7 @@ "label": "Activer le bouton passer la vidéo" }, { - "label": "Texte du bouton passer la vidéo", - "default": "Passer la vidéo" + "label": "Texte du bouton passer la vidéo" }, { "label": "Video en cas de succès", @@ -169,6 +154,10 @@ "description": "Affiche le bouton \"Réessayer\"." } ] + }, + { + "label": "Texte de la question", + "default": "Question" } ] -} \ No newline at end of file +} From ef302b1173de68ba39a4f4a1aea1eb2594c4fde3 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Fri, 28 Aug 2015 10:41:49 +0200 Subject: [PATCH 17/23] Updated title and description. --- library.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 897cc19..5f45d14 100644 --- a/library.json +++ b/library.json @@ -1,5 +1,6 @@ { - "title": "Question set", + "title": "Question Set", + "description": "Put together a set of different questions that has to be solved. (Quiz)", "contentType": "question", "majorVersion": 1, "minorVersion": 4, @@ -15,7 +16,7 @@ "majorVersion": 1, "minorVersion": 6 }, - "license": "cc-by-sa", + "license": "MIT", "preloadedJs": [ { "path": "js/questionset.js" From 4f7c4e77712de651f51de75c345baf68e85792af Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Wed, 9 Sep 2015 16:22:46 +0200 Subject: [PATCH 18/23] Increased dependencies to match other content types [HFJ-1007] --- library.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.json b/library.json index 5f45d14..c11582d 100644 --- a/library.json +++ b/library.json @@ -36,7 +36,7 @@ { "machineName": "FontAwesome", "majorVersion": 4, - "minorVersion": 1 + "minorVersion": 3 }, { "machineName": "H5P.Video", From 848a680de4294d30705897fd7791c51a91eb0d05 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Tue, 15 Sep 2015 09:49:28 +0200 Subject: [PATCH 19/23] Increase patch version --- library.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index c11582d..0ae5c19 100644 --- a/library.json +++ b/library.json @@ -4,7 +4,7 @@ "contentType": "question", "majorVersion": 1, "minorVersion": 4, - "patchVersion": 2, + "patchVersion": 3, "embedTypes": [ "iframe" ], @@ -61,4 +61,4 @@ "minorVersion": 0 } ] -} +} \ No newline at end of file From e0f8afb3f9033f1488aa0b9546d0492d03b4b145 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Thu, 24 Sep 2015 13:16:54 +0200 Subject: [PATCH 20/23] Make sure content is resized after images in content types are laoded. [HFJ-1091] --- js/questionset.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/questionset.js b/js/questionset.js index ff08a33..be6968c 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -360,12 +360,21 @@ H5P.QuestionSet = function (options, contentId) { } } + var registerImageLoadedListener = function (question) { + H5P.on(question, 'imageLoaded', function () { + self.trigger('resize'); + }); + }; + // Attach questions for (var i = 0; i < questionInstances.length; i++) { var question = questionInstances[i]; question.attach($('.question-container:eq(' + i + ')', $myDom)); + // Listen for image resize + registerImageLoadedListener(question); + // Disable feedback for question question.setBehaviour({disableFeedback: true}); From 2e307e8e55685f15418cb8a0f9d4bc7f6f0f5e69 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Thu, 24 Sep 2015 15:39:12 +0200 Subject: [PATCH 21/23] Increased minor version and dependency to JoubelUI. [HFJ-1088] --- library.json | 8 ++++---- semantics.json | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/library.json b/library.json index 0ae5c19..15176cb 100644 --- a/library.json +++ b/library.json @@ -3,8 +3,8 @@ "description": "Put together a set of different questions that has to be solved. (Quiz)", "contentType": "question", "majorVersion": 1, - "minorVersion": 4, - "patchVersion": 3, + "minorVersion": 5, + "patchVersion": 0, "embedTypes": [ "iframe" ], @@ -46,7 +46,7 @@ { "machineName": "H5P.JoubelUI", "majorVersion": 1, - "minorVersion": 1 + "minorVersion": 2 } ], "editorDependencies": [ @@ -61,4 +61,4 @@ "minorVersion": 0 } ] -} \ No newline at end of file +} diff --git a/semantics.json b/semantics.json index a83cdc9..aa23981 100644 --- a/semantics.json +++ b/semantics.json @@ -110,11 +110,11 @@ "label": "Question type", "description": "Library for this question.", "options": [ - "H5P.MultiChoice 1.3", - "H5P.DragQuestion 1.4", - "H5P.Blanks 1.3", - "H5P.MarkTheWords 1.3", - "H5P.DragText 1.3" + "H5P.MultiChoice 1.4", + "H5P.DragQuestion 1.5", + "H5P.Blanks 1.4", + "H5P.MarkTheWords 1.4", + "H5P.DragText 1.4" ] } }, From 198ae5fd3e28036421249c2135f715f4e0a72db8 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Sat, 26 Sep 2015 17:38:07 +0200 Subject: [PATCH 22/23] Add 'finish' button as hidden, do not show it before all questions has been answered. [HFJ-1029] --- js/questionset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/questionset.js b/js/questionset.js index be6968c..d2a5c2f 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -384,7 +384,7 @@ H5P.QuestionSet = function (options, contentId) { // Add finish question set button question.addButton('finish', params.texts.finishButton, function () { _displayEndGame(); - }); + }, false); } else { From a6299e94e4d9221062d3982f954c8fe8449e22c6 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Sun, 27 Sep 2015 19:12:40 +0200 Subject: [PATCH 23/23] Do not show try-again and show-solution button for questions inside a question set. [HFJ-1110] --- css/questionset.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/css/questionset.css b/css/questionset.css index fef0b6f..325f94d 100644 --- a/css/questionset.css +++ b/css/questionset.css @@ -215,3 +215,9 @@ .h5p-no-frame .questionset .h5p-question > *:last-child { margin-bottom: 0; } + +/* Hide retry and show solution buttons */ +.questionset .h5p-question .h5p-question-try-again, +.questionset .h5p-question .h5p-question-show-solution { + display: none; +}