From 8eaf7512b6a53c4b5f38130523a39af3db8b3c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Follestad?= <44672586+jfcgno@users.noreply.github.com> Date: Sun, 17 Feb 2019 23:53:09 +0100 Subject: [PATCH 1/4] Optional feedback, timer and counter --- memory-game.js | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/memory-game.js b/memory-game.js index 4b63def..99159a4 100644 --- a/memory-game.js +++ b/memory-game.js @@ -37,7 +37,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) { feedback: 'Good work!', tryAgain: 'Reset', closeLabel: 'Close', - label: 'Memory Game. Find the matching cards.', + label: 'Memory Game. Find the matching cards.', done: 'All of the cards have been found.', cardPrefix: 'Card %num: ', cardUnturned: 'Unturned.', @@ -458,19 +458,32 @@ H5P.MemoryGame = (function (EventDispatcher, $) { appendTo: $bottom }); - $feedback = $('
' + parameters.l10n.feedback + '
').appendTo($bottom); + $feedback = $('
' + ''+ '
').appendTo($bottom); + + if(parameters.behaviour && parameters.behaviour.showFeedback){ + $feedback.find('div#h5p-showFeedback').show(); + } // Add status bar - var $status = $('
' + - '
' + parameters.l10n.timeSpent + ':
' + - '
.
' + - '
' + parameters.l10n.cardTurns + ':
' + - '
0.
' + - '
').appendTo($bottom); + var $status = $('
' + '' + '' + '
').appendTo($bottom); - timer = new MemoryGame.Timer($status.find('time')[0]); - counter = new MemoryGame.Counter($status.find('.h5p-card-turns')); - popup = new MemoryGame.Popup($container, parameters.l10n); + timer = new MemoryGame.Timer($status.find('time')[0]); + counter = new MemoryGame.Counter($status.find('.h5p-card-turns')); + popup = new MemoryGame.Popup($container, parameters.l10n); + + if (parameters.behaviour){ + if(parameters.behaviour.showTime){ + $status.find('div#h5p-showTime').show(); + } + if(parameters.behaviour.showTurns){ + $status.find('div#h5p-showTurns').show(); + } + } $container.click(function () { popup.close(); From 1ecf33545e1a5fb27e670902cd3907d5ce336c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Follestad?= <44672586+jfcgno@users.noreply.github.com> Date: Mon, 18 Feb 2019 00:02:22 +0100 Subject: [PATCH 2/4] Added hideable div and status line to .h5p status --- memory-game.css | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/memory-game.css b/memory-game.css index 1b53971..3e65a6b 100644 --- a/memory-game.css +++ b/memory-game.css @@ -183,21 +183,22 @@ -ms-transform: scale(1,1) rotate(0deg); transform: scale(1,1) rotate(0deg); } - .h5p-memory-game .h5p-status { clear: left; padding: 0 1em; margin: 0.25em 0 1em 0; } -.h5p-memory-game .h5p-status > dt { +.h5p-memory-game .h5p-status > div { + margin: 0; +} +.h5p-memory-game .h5p-status .h5p-statusLine > dt { float: left; margin: 0 1em 0 0; font-weight: bold; } -.h5p-memory-game .h5p-status > dd { +.h5p-memory-game .h5p-status .h5p-statusLine > dd { margin: 0; } - .h5p-memory-game .h5p-memory-pop { display: none; background: #fff; From ea0874bdcdafe4a24f31eae11e3fc8a5b14f5717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Follestad?= <44672586+jfcgno@users.noreply.github.com> Date: Mon, 18 Feb 2019 00:07:16 +0100 Subject: [PATCH 3/4] Added showTime, showTurns and showFeedback --- semantics.json | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/semantics.json b/semantics.json index 3e73546..fe19c03 100644 --- a/semantics.json +++ b/semantics.json @@ -111,6 +111,27 @@ "label": "Add button for retrying when the game is over", "importance": "low", "default": true + }, + { + "name": "showTime", + "type": "boolean", + "label": "Show timer", + "importance": "low", + "default": true + }, + { + "name": "showTurns", + "type": "boolean", + "label": "Show card turns", + "importance": "low", + "default": true + }, + { + "name": "showFeedback", + "type": "boolean", + "label": "Show feedback", + "importance": "low", + "default": true } ] }, @@ -193,7 +214,7 @@ "importance": "low", "name": "label", "type": "text", - "default": "Memory Game. Find the matching cards." + "default": "Memory Game. Find the matching cards." }, { "label": "Game finished label", From 7564c66d0c38a1ace5d55d6ffbee4a46ae0fe01e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Follestad?= <44672586+jfcgno@users.noreply.github.com> Date: Mon, 18 Feb 2019 00:08:34 +0100 Subject: [PATCH 4/4] Added showTime, showTurns and showFeedback --- upgrades.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/upgrades.js b/upgrades.js index ce870bc..815d2ad 100644 --- a/upgrades.js +++ b/upgrades.js @@ -37,6 +37,9 @@ H5PUpgrades['H5P.MemoryGame'] = (function () { parameters.behaviour = {}; parameters.behaviour.useGrid = false; parameters.behaviour.allowRetry = false; + parameters.behaviour.showTime = true; + parameters.behaviour.showTurns = true; + parameters.behaviour.showFeedback = true; finished(null, parameters); }