Fix issues with old content
parent
2ac7ca6721
commit
8289ff5f8c
2
card.js
2
card.js
|
@ -89,7 +89,7 @@
|
||||||
self.appendTo = function ($container) {
|
self.appendTo = function ($container) {
|
||||||
// TODO: Translate alt attr
|
// TODO: Translate alt attr
|
||||||
$card = $('<li class="h5p-memory-wrap"><div class="h5p-memory-card" role="button" tabindex="1">' +
|
$card = $('<li class="h5p-memory-wrap"><div class="h5p-memory-card" role="button" tabindex="1">' +
|
||||||
'<div class="h5p-front"' + (styles && styles.front ? styles.front : '') + '>' + (styles.backImage ? '' : '<span></span>') + '</div>' +
|
'<div class="h5p-front"' + (styles && styles.front ? styles.front : '') + '>' + (styles && styles.backImage ? '' : '<span></span>') + '</div>' +
|
||||||
'<div class="h5p-back"' + (styles && styles.back ? styles.back : '') + '>' +
|
'<div class="h5p-back"' + (styles && styles.back ? styles.back : '') + '>' +
|
||||||
'<img src="' + path + '" alt="Memory Card" style="width:' + width + ';height:' + height + '"/>' +
|
'<img src="' + path + '" alt="Memory Card" style="width:' + width + ';height:' + height + '"/>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
|
|
|
@ -71,7 +71,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
|
||||||
if (card.hasTwoImages) {
|
if (card.hasTwoImages) {
|
||||||
imgs.push(mate.getImage());
|
imgs.push(mate.getImage());
|
||||||
}
|
}
|
||||||
popup.show(desc, imgs, cardStyles.back, function () {
|
popup.show(desc, imgs, cardStyles ? cardStyles.back : undefined, function () {
|
||||||
if (isFinished) {
|
if (isFinished) {
|
||||||
// Game done
|
// Game done
|
||||||
finished();
|
finished();
|
||||||
|
@ -319,7 +319,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
|
||||||
|
|
||||||
timer = new MemoryGame.Timer($status.find('.h5p-time-spent')[0]);
|
timer = new MemoryGame.Timer($status.find('.h5p-time-spent')[0]);
|
||||||
counter = new MemoryGame.Counter($status.find('.h5p-card-turns'));
|
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 () {
|
$container.click(function () {
|
||||||
popup.close();
|
popup.close();
|
||||||
|
|
5
popup.js
5
popup.js
|
@ -5,6 +5,7 @@
|
||||||
*
|
*
|
||||||
* @class H5P.MemoryGame.Popup
|
* @class H5P.MemoryGame.Popup
|
||||||
* @param {H5P.jQuery} $container
|
* @param {H5P.jQuery} $container
|
||||||
|
* @param {string} [styles]
|
||||||
*/
|
*/
|
||||||
MemoryGame.Popup = function ($container, styles) {
|
MemoryGame.Popup = function ($container, styles) {
|
||||||
/** @alias H5P.MemoryGame.Popup# */
|
/** @alias H5P.MemoryGame.Popup# */
|
||||||
|
@ -12,7 +13,7 @@
|
||||||
|
|
||||||
var closed;
|
var closed;
|
||||||
|
|
||||||
var $popup = $('<div class="h5p-memory-pop"><div class="h5p-memory-top"' + styles + '></div><div class="h5p-memory-desc"></div></div>').appendTo($container);
|
var $popup = $('<div class="h5p-memory-pop"><div class="h5p-memory-top"' + (styles ? styles : '') + '></div><div class="h5p-memory-desc"></div></div>').appendTo($container);
|
||||||
var $desc = $popup.find('.h5p-memory-desc');
|
var $desc = $popup.find('.h5p-memory-desc');
|
||||||
var $top = $popup.find('.h5p-memory-top');
|
var $top = $popup.find('.h5p-memory-top');
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@
|
||||||
$desc.html(desc);
|
$desc.html(desc);
|
||||||
$top.html('').toggleClass('h5p-memory-two-images', imgs.length > 1);
|
$top.html('').toggleClass('h5p-memory-two-images', imgs.length > 1);
|
||||||
for (var i = 0; i < imgs.length; i++) {
|
for (var i = 0; i < imgs.length; i++) {
|
||||||
$('<div class="h5p-memory-image"' + styles + '></div>').append(imgs[i]).appendTo($top);
|
$('<div class="h5p-memory-image"' + (styles ? styles : '') + '></div>').append(imgs[i]).appendTo($top);
|
||||||
}
|
}
|
||||||
$popup.show();
|
$popup.show();
|
||||||
closed = done;
|
closed = done;
|
||||||
|
|
Loading…
Reference in New Issue