From bfa29df4c68db8b815cf8e7a020221ba84227475 Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Mon, 5 Sep 2016 14:37:20 +0200 Subject: [PATCH 1/9] Bumped h5p-drag-n-bar and all dependent libraries --- library.json | 6 +++--- semantics.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library.json b/library.json index fac3d5c..b83a392 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": 8, - "patchVersion": 4, + "minorVersion": 9, + "patchVersion": 0, "embedTypes": [ "iframe" ], @@ -61,4 +61,4 @@ "minorVersion": 1 } ] -} \ No newline at end of file +} diff --git a/semantics.json b/semantics.json index a29b346..e7c165b 100644 --- a/semantics.json +++ b/semantics.json @@ -111,7 +111,7 @@ "description": "Library for this question.", "options": [ "H5P.MultiChoice 1.7", - "H5P.DragQuestion 1.6", + "H5P.DragQuestion 1.7", "H5P.Blanks 1.6", "H5P.MarkTheWords 1.6", "H5P.DragText 1.5" From 1cafbf09f44280af6d4b0c7c509ce9fd4e827380 Mon Sep 17 00:00:00 2001 From: thomasmars Date: Tue, 4 Oct 2016 11:43:12 +0200 Subject: [PATCH 2/9] Added aria-disabled attribute to dots when they are disabled HFP-8 --- js/questionset.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 3602de9..10cc730 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -45,8 +45,9 @@ H5P.QuestionSet = function (options, contentId, contentData) { '
  • " tabindex="-1">
  • ' + + ' + ", " + texts.unansweredText %>" tabindex="-1" ' + + ' <% if (disableBackwardsNavigation) { %> aria-disabled="true" <% } %>' + + ' >' + ' <% } %>' + ' ' + ' <% } else if (progressType == "textual") { %>' + @@ -296,6 +297,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { for (var i = 0; i < questionInstances.length; i++) { // Enable back and forth navigation in solution mode + toggleDotsNavigation(true); if (i < questionInstances.length - 1) { questionInstances[i].showButton('next'); } @@ -316,6 +318,16 @@ H5P.QuestionSet = function (options, contentId, contentData) { } }; + /** + * Toggles whether dots are enabled for navigation + */ + var toggleDotsNavigation = function (enable) { + console.log("toggle dots", enable); + $('.progress-dot', $myDom).each(function () { + $(this).attr('aria-disabled', enable ? 'false' : 'true'); + }); + }; + /** * Resets the task and every subcontent task. * Used for contracts with integrated content. @@ -329,6 +341,8 @@ H5P.QuestionSet = function (options, contentId, contentData) { // Hide back and forth navigation in normal mode if (params.disableBackwardsNavigation) { + toggleDotsNavigation(false); + // Check if first question is answered by default if (i === 0 && questionInstances[i].getAnswerGiven()) { questionInstances[i].showButton('next'); From 751ee5f597d6007e7c385fdf3853bea7324158ea Mon Sep 17 00:00:00 2001 From: thomasmars Date: Tue, 4 Oct 2016 11:53:04 +0200 Subject: [PATCH 3/9] Removed debug line HFP-8 --- js/questionset.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/questionset.js b/js/questionset.js index 10cc730..788b8bb 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -322,7 +322,6 @@ H5P.QuestionSet = function (options, contentId, contentData) { * Toggles whether dots are enabled for navigation */ var toggleDotsNavigation = function (enable) { - console.log("toggle dots", enable); $('.progress-dot', $myDom).each(function () { $(this).attr('aria-disabled', enable ? 'false' : 'true'); }); From 55d66eb4695444e95235176f5bac0c456f7959e5 Mon Sep 17 00:00:00 2001 From: thomasmars Date: Tue, 4 Oct 2016 11:59:26 +0200 Subject: [PATCH 4/9] Fixed not setting progress when it is undefined. HFP-9 --- js/questionset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/questionset.js b/js/questionset.js index 788b8bb..1dbe17c 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -131,7 +131,7 @@ H5P.QuestionSet = function (options, contentId, contentData) { var renderSolutions = false; var showingSolutions = false; contentData = contentData || {}; - if (contentData.previousState) { + if (contentData.previousState && contentData.previousState.progress) { currentQuestion = contentData.previousState.progress; } From 46ca8846812c8dfb098476d73229732fa8338f20 Mon Sep 17 00:00:00 2001 From: thomasmars Date: Tue, 4 Oct 2016 14:18:50 +0200 Subject: [PATCH 5/9] Disable navigation bar visuals and functions when backward navigation is disabled. HFP-8 --- css/questionset.css | 12 +++++++++++- js/questionset.js | 24 +++++++++++++++++------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/css/questionset.css b/css/questionset.css index 90cf581..5f07c33 100644 --- a/css/questionset.css +++ b/css/questionset.css @@ -52,7 +52,12 @@ background: #fff; background: #cecece; } -.progress-dot:hover { + +.progress-dot.disabled { + cursor: default; +} + +.progress-dot:not(.disabled):hover { box-shadow: 0 0 0.5em #c7c7c7; } .progress-dot.answered { @@ -61,6 +66,11 @@ .progress-dot.current { background: #285585; } + +.progress-dot.disabled:focus { + outline: none +} + .progress-dot:focus { outline-color: rgb(40, 130, 211); outline-width: thin; diff --git a/js/questionset.js b/js/questionset.js index 1dbe17c..1e18f63 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -42,12 +42,16 @@ H5P.QuestionSet = function (options, contentId, contentData) { ' <% if (progressType == "dots") { %>' + '