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] 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();