From 8289ff5f8cdfd4511227499d1c3c94866de2d411 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Tue, 20 Jun 2017 10:58:13 +0200 Subject: [PATCH] Fix issues with old content --- card.js | 2 +- memory-game.js | 4 ++-- popup.js | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/card.js b/card.js index f4ad3fe..9543016 100644 --- a/card.js +++ b/card.js @@ -89,7 +89,7 @@ self.appendTo = function ($container) { // TODO: Translate alt attr $card = $('
  • ' + - '
    ' + (styles.backImage ? '' : '') + '
    ' + + '
    ' + (styles && styles.backImage ? '' : '') + '
    ' + '
    ' + 'Memory Card' + '
    ' + diff --git a/memory-game.js b/memory-game.js index 3933631..99b9a14 100644 --- a/memory-game.js +++ b/memory-game.js @@ -71,7 +71,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) { if (card.hasTwoImages) { imgs.push(mate.getImage()); } - popup.show(desc, imgs, cardStyles.back, function () { + popup.show(desc, imgs, cardStyles ? cardStyles.back : undefined, function () { if (isFinished) { // Game done finished(); @@ -319,7 +319,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) { timer = new MemoryGame.Timer($status.find('.h5p-time-spent')[0]); counter = new MemoryGame.Counter($status.find('.h5p-card-turns')); - popup = new MemoryGame.Popup($container, cardStyles.popup); + popup = new MemoryGame.Popup($container, cardStyles ? cardStyles.popup : undefined); $container.click(function () { popup.close(); diff --git a/popup.js b/popup.js index 5f07339..7bbcac6 100644 --- a/popup.js +++ b/popup.js @@ -5,6 +5,7 @@ * * @class H5P.MemoryGame.Popup * @param {H5P.jQuery} $container + * @param {string} [styles] */ MemoryGame.Popup = function ($container, styles) { /** @alias H5P.MemoryGame.Popup# */ @@ -12,7 +13,7 @@ var closed; - var $popup = $('
    ').appendTo($container); + var $popup = $('
    ').appendTo($container); var $desc = $popup.find('.h5p-memory-desc'); var $top = $popup.find('.h5p-memory-top'); @@ -27,7 +28,7 @@ $desc.html(desc); $top.html('').toggleClass('h5p-memory-two-images', imgs.length > 1); for (var i = 0; i < imgs.length; i++) { - $('
    ').append(imgs[i]).appendTo($top); + $('
    ').append(imgs[i]).appendTo($top); } $popup.show(); closed = done;