Merge branch 'master' into release
commit
04362d33f3
6
card.js
6
card.js
|
@ -20,7 +20,7 @@
|
||||||
EventDispatcher.call(self);
|
EventDispatcher.call(self);
|
||||||
|
|
||||||
var path = H5P.getPath(image.path, id);
|
var path = H5P.getPath(image.path, id);
|
||||||
var width, height, margin, $card, $wrapper, removedState, flippedState;
|
var width, height, $card, $wrapper, removedState, flippedState;
|
||||||
|
|
||||||
alt = alt || 'Missing description'; // Default for old games
|
alt = alt || 'Missing description'; // Default for old games
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
/**
|
/**
|
||||||
* Remove.
|
* Remove.
|
||||||
*/
|
*/
|
||||||
self.remove = function (announce) {
|
self.remove = function () {
|
||||||
$card.addClass('h5p-matched');
|
$card.addClass('h5p-matched');
|
||||||
removedState = true;
|
removedState = true;
|
||||||
};
|
};
|
||||||
|
@ -137,7 +137,7 @@
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</div></li>')
|
'</div></li>')
|
||||||
.appendTo($container)
|
.appendTo($container)
|
||||||
.on('keydown', function (event) {
|
.on('keydown', function (event) {
|
||||||
switch (event.which) {
|
switch (event.which) {
|
||||||
case 13: // Enter
|
case 13: // Enter
|
||||||
case 32: // Space
|
case 32: // Space
|
||||||
|
|
|
@ -154,7 +154,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
|
||||||
* Shuffle the cards and restart the game!
|
* Shuffle the cards and restart the game!
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
var resetGame = function () {
|
var resetGame = function () {
|
||||||
|
|
||||||
// Reset cards
|
// Reset cards
|
||||||
removed = 0;
|
removed = 0;
|
||||||
|
@ -197,7 +197,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
|
||||||
buttonElement.innerHTML = label;
|
buttonElement.innerHTML = label;
|
||||||
buttonElement.setAttribute('role', 'button');
|
buttonElement.setAttribute('role', 'button');
|
||||||
buttonElement.tabIndex = 0;
|
buttonElement.tabIndex = 0;
|
||||||
buttonElement.addEventListener('click', function (event) {
|
buttonElement.addEventListener('click', function () {
|
||||||
action.apply(buttonElement);
|
action.apply(buttonElement);
|
||||||
}, false);
|
}, false);
|
||||||
buttonElement.addEventListener('keypress', function (event) {
|
buttonElement.addEventListener('keypress', function (event) {
|
||||||
|
@ -437,7 +437,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
|
||||||
|
|
||||||
$bottom = $('<div/>', {
|
$bottom = $('<div/>', {
|
||||||
tabindex: '-1',
|
tabindex: '-1',
|
||||||
appendTo: $container
|
appendTo: $container
|
||||||
});
|
});
|
||||||
$taskComplete = $('<div/>', {
|
$taskComplete = $('<div/>', {
|
||||||
'class': 'h5p-memory-complete h5p-memory-hidden-read',
|
'class': 'h5p-memory-complete h5p-memory-hidden-read',
|
||||||
|
@ -467,10 +467,10 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will try to scale the game so that it fits within its container.
|
* Will try to scale the game so that it fits within its container.
|
||||||
* Puts the cards into a grid layout to make it as square as possible –
|
* Puts the cards into a grid layout to make it as square as possible –
|
||||||
* which improves the playability on multiple devices.
|
* which improves the playability on multiple devices.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
var scaleGameSize = function () {
|
var scaleGameSize = function () {
|
||||||
|
|
||||||
|
@ -538,7 +538,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
|
||||||
/**
|
/**
|
||||||
* Determine color contrast level compared to white(#fff)
|
* Determine color contrast level compared to white(#fff)
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {string} color hex code
|
* @param {string} color hex code
|
||||||
* @return {number} From 1 to Infinity.
|
* @return {number} From 1 to Infinity.
|
||||||
*/
|
*/
|
||||||
|
|
2
popup.js
2
popup.js
|
@ -18,7 +18,7 @@
|
||||||
var $top = $popup.find('.h5p-memory-top');
|
var $top = $popup.find('.h5p-memory-top');
|
||||||
|
|
||||||
// Hook up the close button
|
// Hook up the close button
|
||||||
$popup.find('.h5p-memory-close').on('click', function () {
|
$popup.find('.h5p-memory-close').on('click', function () {
|
||||||
self.close(true);
|
self.close(true);
|
||||||
}).on('keypress', function (event) {
|
}).on('keypress', function (event) {
|
||||||
if (event.which === 13 || event.which === 32) {
|
if (event.which === 13 || event.which === 32) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var H5PUpgrades = H5PUpgrades || {};
|
var H5PUpgrades = H5PUpgrades || {};
|
||||||
|
|
||||||
H5PUpgrades['H5P.MemoryGame'] = (function ($) {
|
H5PUpgrades['H5P.MemoryGame'] = (function () {
|
||||||
return {
|
return {
|
||||||
1: {
|
1: {
|
||||||
/**
|
/**
|
||||||
|
@ -42,4 +42,4 @@ H5PUpgrades['H5P.MemoryGame'] = (function ($) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})(H5P.jQuery);
|
})();
|
||||||
|
|
Loading…
Reference in New Issue