summaryrefslogtreecommitdiff
path: root/scripts/cards
diff options
context:
space:
mode:
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()