summaryrefslogtreecommitdiff
path: root/webcards/scripts/gui/table.js
diff options
context:
space:
mode:
authorKyle Gunger <corechg@gmail.com>2020-04-03 16:44:23 -0400
committerKyle Gunger <corechg@gmail.com>2020-04-03 16:44:23 -0400
commit1697da112a9b9f529fad2f54c62aecd7bbb614e6 (patch)
tree68c7cd383107e824953b6aa213d05d9a6842b73f /webcards/scripts/gui/table.js
parent3040a822085adeb9025ddc1a4573cf37cb37d377 (diff)
[WEBCARDS] Update some webcards stuff
Diffstat (limited to 'webcards/scripts/gui/table.js')
-rw-r--r--webcards/scripts/gui/table.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/webcards/scripts/gui/table.js b/webcards/scripts/gui/table.js
new file mode 100644
index 0000000..db67529
--- /dev/null
+++ b/webcards/scripts/gui/table.js
@@ -0,0 +1,34 @@
+// Table represents and manages the actual game. It accepts inputs from the server and tries to queries the server when the player makes a move.
+function Table(el, soc) {
+ this.root = el;
+ this.soc = soc;
+}
+
+Table.prototype = {
+
+ openTable: function(){
+ let state = this.root.getAttribute("state")
+ if((state == "close" || state == "closed") && state != "") {
+ this.root.setAttribute("state", "closed");
+ setTimeout(this.root.setAttribute.bind(this.root), 50, "state", "open");
+ }
+ },
+
+ closeTable: function(){
+ let state = this.root.getAttribute("state")
+ if(state != "close" && state != "closed") {
+ this.root.setAttribute("state", "");
+ setTimeout(this.root.setAttribute.bind(this.root), 50, "state", "close");
+ }
+ },
+
+
+
+ handleClose: function() {
+ this.reset();
+ },
+
+ reset: function() {
+ this.closeTable();
+ }
+} \ No newline at end of file