Move pile shuffle from click listener to interact.js tap event

This commit is contained in:
Adam Goldsmith 2017-09-21 02:42:09 -04:00
parent af181e38e7
commit 6770ad949e

View File

@ -15,12 +15,6 @@ window.addEventListener('load', () => {
deckName = document.querySelector('#card-container').getAttribute("data-deckName"); deckName = document.querySelector('#card-container').getAttribute("data-deckName");
xhr.open("GET", "/deck/" + deckName + "/deck.json"); xhr.open("GET", "/deck/" + deckName + "/deck.json");
xhr.send(); xhr.send();
document.querySelectorAll('.card-pile').forEach(e => {
e.addEventListener('click', event => {
shuffle(piles[event.target.getAttribute('data-pile')]);
});
});
}); });
let cardInteract = interact('.card', {ignoreFrom: '.in-list'}) let cardInteract = interact('.card', {ignoreFrom: '.in-list'})
@ -127,7 +121,8 @@ interact('.card-pile')
cardList.appendChild(newCard); cardList.appendChild(newCard);
}); });
showModal(cardList); showModal(cardList);
}); })
.on('tap', event => shuffle(piles[event.target.getAttribute('data-pile')]));
function makeCard(cardNum) { function makeCard(cardNum) {
// draw a new card // draw a new card