summaryrefslogtreecommitdiff
path: root/scripts/cards
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2021-10-19 00:18:37 -0400
committerKyle Gunger <kgunger12@gmail.com>2021-10-19 00:18:37 -0400
commit811571e23b68f4318794de3d34aa15cb91ec3d2d (patch)
tree56c1a5648a06aac8c59125d0af7669c0a9688547 /scripts/cards
parentfb231e3c6f3afbd40de5a94187221b788656cb5c (diff)
[Refactor] Lots of little patches
+ Make chatbox code a little cleaner + Add a bit of documentation + Begin prep for passwords + Function to easily grab decks from cards ~ I am going to have to completely re-do cards and decks probably.
Diffstat (limited to 'scripts/cards')
-rw-r--r--scripts/cards/card.js10
-rw-r--r--scripts/cards/deck.js6
2 files changed, 7 insertions, 9 deletions
diff --git a/scripts/cards/card.js b/scripts/cards/card.js
index 43dc965..47c7f17 100644
--- a/scripts/cards/card.js
+++ b/scripts/cards/card.js
@@ -7,16 +7,12 @@ const CardPos = ["top", "topl", "topr", "mid", "midt", "midb", "bot", "botl", "b
// Every card should have a deck.
// Use deck.appendCard or deck.prependCard to make a card visible
class Card {
- constructor (id, data)
+ constructor (data)
{
this.e = document.createElement("card");
this.generateElements(data);
this.e.style.left = "0px";
this.e.style.top = "0px";
-
- this.getID = function() {
- return id;
- }
}
// Generate a card with basic text only
@@ -117,4 +113,8 @@ class Card {
this.e.style.left = "0px";
this.e.style.top = "0px";
}
+
+ getDeck() {
+ return this.e.parentElement.deck;
+ }
}
diff --git a/scripts/cards/deck.js b/scripts/cards/deck.js
index caa62bc..27020f0 100644
--- a/scripts/cards/deck.js
+++ b/scripts/cards/deck.js
@@ -13,7 +13,7 @@ class Deck {
y = 0;
e = null;
- constructor(id, options = {mode: "stack", smode: "one", sct: 0, pos: [0, 0]})
+ constructor(options = {mode: "stack", smode: "one", sct: 0, pos: [0, 0]})
{
// View mode
// infdraw - infinite draw. always appears as if there are multiple cards
@@ -53,9 +53,7 @@ class Deck {
this.e.setAttribute("mode", options.mode);
- this.getID = function() {
- return id;
- }
+ this.e.deck = this;
}
updatePos()