Merge pull request #10 from h5p/falcon-git-patch-1

Don't require that the user removes the final description to trigger …
pull/12/head
Frode Petterson 2016-06-20 15:05:55 +02:00 committed by GitHub
commit 5ceb12d8df
1 changed files with 4 additions and 2 deletions

View File

@ -36,12 +36,15 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
var finished = (removed === cards.length);
var desc = card.getDescription();
if (finished) {
self.triggerXAPIScored(1, 1, 'completed');
}
if (desc !== undefined) {
// Pause timer and show desciption.
timer.stop();
popup.show(desc, card.getImage(), function () {
if (finished) {
self.triggerXAPIScored(1, 1, 'completed');
// Game has finished
$feedback.addClass('h5p-show');
}
@ -52,7 +55,6 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
});
}
else if (finished) {
self.triggerXAPIScored(1, 1, 'completed');
// Game has finished
timer.stop();
$feedback.addClass('h5p-show');