Minor style fixes
This commit is contained in:
parent
4d7a2d7172
commit
ef1ce122bb
@ -6,8 +6,8 @@ window.addEventListener('load', () => {
|
|||||||
xhr.addEventListener("load", () => {
|
xhr.addEventListener("load", () => {
|
||||||
deckJSON = JSON.parse(xhr.responseText);
|
deckJSON = JSON.parse(xhr.responseText);
|
||||||
piles.deck = deckJSON.ObjectStates[0].DeckIDs.map(c => c - 100);
|
piles.deck = deckJSON.ObjectStates[0].DeckIDs.map(c => c - 100);
|
||||||
cardCount = piles['deck'].length;
|
cardCount = piles.deck.length;
|
||||||
shuffle(piles['deck']);
|
shuffle(piles.deck);
|
||||||
deckWidth = deckJSON.ObjectStates[0].CustomDeck["1"].NumWidth;
|
deckWidth = deckJSON.ObjectStates[0].CustomDeck["1"].NumWidth;
|
||||||
deckHeight = deckJSON.ObjectStates[0].CustomDeck["1"].NumHeight;
|
deckHeight = deckJSON.ObjectStates[0].CustomDeck["1"].NumHeight;
|
||||||
console.log(deckName);
|
console.log(deckName);
|
||||||
@ -157,15 +157,15 @@ interact('.card-pile')
|
|||||||
searchBox.setAttribute('type', 'search');
|
searchBox.setAttribute('type', 'search');
|
||||||
searchBox.setAttribute('placeholder', 'Filter');
|
searchBox.setAttribute('placeholder', 'Filter');
|
||||||
searchBox.addEventListener('input', event => {
|
searchBox.addEventListener('input', event => {
|
||||||
for (var ii = 0; ii < cardList.children.length; ii++) {
|
Array.from(cardList.children).forEach(card => {
|
||||||
let input = event.target.value;
|
let input = event.target.value;
|
||||||
let cardNum = parseInt(cardList.children[ii].getAttribute('data-num'));
|
let cardNum = parseInt(card.getAttribute('data-num'));
|
||||||
let cardData = deckJSON.ObjectStates[0].ContainedObjects.find(c => c.CardID === (cardNum + 100));
|
let cardData = deckJSON.ObjectStates[0].ContainedObjects.find(c => c.CardID === (cardNum + 100));
|
||||||
cardList.children[ii].style.display =
|
card.style.display =
|
||||||
(cardData.Nickname.toLowerCase().includes(input.toLowerCase()) ||
|
(cardData.Nickname.toLowerCase().includes(input.toLowerCase()) ||
|
||||||
cardData.Description.toLowerCase().includes(input.toLowerCase())) ?
|
cardData.Description.toLowerCase().includes(input.toLowerCase())) ?
|
||||||
"": "none";
|
"": "none";
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
container.appendChild(searchBox);
|
container.appendChild(searchBox);
|
||||||
|
|
||||||
@ -245,11 +245,12 @@ function shuffle(array) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function dragMoveListener (event) {
|
function dragMoveListener (event) {
|
||||||
let target = event.target,
|
let target = event.target;
|
||||||
// keep the dragged position in the data-x/data-y attributes
|
|
||||||
x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx,
|
// keep the dragged position in the data-x/data-y attribute
|
||||||
y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy;
|
let x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx;
|
||||||
scale = (parseFloat(target.getAttribute('data-scale')) || 1);
|
let y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy;
|
||||||
|
let scale = (parseFloat(target.getAttribute('data-scale')) || 1);
|
||||||
|
|
||||||
// translate and scale the element
|
// translate and scale the element
|
||||||
target.style.webkitTransform =
|
target.style.webkitTransform =
|
||||||
|
@ -20,7 +20,7 @@ const server = http.createServer((req, res) => {
|
|||||||
sendFile(res, 'style.css', 'text/css');
|
sendFile(res, 'style.css', 'text/css');
|
||||||
break;
|
break;
|
||||||
case 'js':
|
case 'js':
|
||||||
switch (pathParts[2] || "") {
|
switch (pathParts[2]) {
|
||||||
case 'playfield.js':
|
case 'playfield.js':
|
||||||
sendFile(res, 'js/playfield.js', 'application/javascript');
|
sendFile(res, 'js/playfield.js', 'application/javascript');
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user