Merge branch 'master' into release
commit
04362d33f3
6
card.js
6
card.js
|
@ -20,7 +20,7 @@
|
|||
EventDispatcher.call(self);
|
||||
|
||||
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
|
||||
|
||||
|
@ -91,7 +91,7 @@
|
|||
/**
|
||||
* Remove.
|
||||
*/
|
||||
self.remove = function (announce) {
|
||||
self.remove = function () {
|
||||
$card.addClass('h5p-matched');
|
||||
removedState = true;
|
||||
};
|
||||
|
@ -137,7 +137,7 @@
|
|||
'</div>' +
|
||||
'</div></li>')
|
||||
.appendTo($container)
|
||||
.on('keydown', function (event) {
|
||||
.on('keydown', function (event) {
|
||||
switch (event.which) {
|
||||
case 13: // Enter
|
||||
case 32: // Space
|
||||
|
|
|
@ -154,7 +154,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
|
|||
* Shuffle the cards and restart the game!
|
||||
* @private
|
||||
*/
|
||||
var resetGame = function () {
|
||||
var resetGame = function () {
|
||||
|
||||
// Reset cards
|
||||
removed = 0;
|
||||
|
@ -197,7 +197,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
|
|||
buttonElement.innerHTML = label;
|
||||
buttonElement.setAttribute('role', 'button');
|
||||
buttonElement.tabIndex = 0;
|
||||
buttonElement.addEventListener('click', function (event) {
|
||||
buttonElement.addEventListener('click', function () {
|
||||
action.apply(buttonElement);
|
||||
}, false);
|
||||
buttonElement.addEventListener('keypress', function (event) {
|
||||
|
@ -437,7 +437,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
|
|||
|
||||
$bottom = $('<div/>', {
|
||||
tabindex: '-1',
|
||||
appendTo: $container
|
||||
appendTo: $container
|
||||
});
|
||||
$taskComplete = $('<div/>', {
|
||||
'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.
|
||||
* 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.
|
||||
*
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
var scaleGameSize = function () {
|
||||
|
||||
|
@ -538,7 +538,7 @@ H5P.MemoryGame = (function (EventDispatcher, $) {
|
|||
/**
|
||||
* Determine color contrast level compared to white(#fff)
|
||||
*
|
||||
* @private
|
||||
* @private
|
||||
* @param {string} color hex code
|
||||
* @return {number} From 1 to Infinity.
|
||||
*/
|
||||
|
|
2
popup.js
2
popup.js
|
@ -18,7 +18,7 @@
|
|||
var $top = $popup.find('.h5p-memory-top');
|
||||
|
||||
// Hook up the close button
|
||||
$popup.find('.h5p-memory-close').on('click', function () {
|
||||
$popup.find('.h5p-memory-close').on('click', function () {
|
||||
self.close(true);
|
||||
}).on('keypress', function (event) {
|
||||
if (event.which === 13 || event.which === 32) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
var H5PUpgrades = H5PUpgrades || {};
|
||||
|
||||
H5PUpgrades['H5P.MemoryGame'] = (function ($) {
|
||||
H5PUpgrades['H5P.MemoryGame'] = (function () {
|
||||
return {
|
||||
1: {
|
||||
/**
|
||||
|
@ -42,4 +42,4 @@ H5PUpgrades['H5P.MemoryGame'] = (function ($) {
|
|||
}
|
||||
}
|
||||
};
|
||||
})(H5P.jQuery);
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue