From dd94513736d2be148cecb68ac9b7e44c4cb67a0c Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 20 Sep 2017 18:12:41 -0400 Subject: [PATCH] Shuffle decks on click --- script.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/script.js b/script.js index e4d9aa4..105d3fb 100644 --- a/script.js +++ b/script.js @@ -15,6 +15,12 @@ window.addEventListener('load', () => { deckName = document.querySelector('#card-container').getAttribute("data-deckName"); xhr.open("GET", "/deck/" + deckName + "/deck.json"); xhr.send(); + + document.querySelectorAll('.card-pile').forEach(e => { + e.addEventListener('click', event => { + shuffle(piles[event.target.getAttribute('data-pile')]); + }); + }); }); let cardInteract = interact('.card')