summaryrefslogtreecommitdiff
path: root/webcards/client.html
blob: 069a041bdef45a1d89d21102a86b162c6ec256c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE HTML>

<html>
    <head>
        <meta name="viewport" content="width=device-width,initial-scale=1">
        <meta charset="utf-8">
        
        <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700&display=swap" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="styles/icofont.css">

        <link rel="stylesheet" type="text/css" href="styles/input.css">

        <link rel="stylesheet" type="text/css" href="styles/client/base.css">
        <link rel="stylesheet" type="text/css" href="styles/client/desktop.css">
        <link rel="stylesheet" type="text/css" href="styles/client/tablet.css">
        <link rel="stylesheet" type="text/css" href="styles/client/mobile.css">
        <link rel="stylesheet" type="text/css" href="styles/client/card.css">

        <link id="theme" rel="stylesheet" type="text/css" href="styles/themes/colors-base.css">

        <link rel="icon" sizes="32x32" href="images/wc-icon-32.png">
        <link rel="icon" sizes="48x48" href="images/wc-icon-48.png">
        <link rel="icon" sizes="96x96" href="images/wc-icon-96.png">
        <link rel="icon" sizes="144x144" href="images/wc-icon-144.png">
        <link rel="icon" sizes="288x288" href="images/wc-icon-288.png">

        <script src="scripts/cookie.js"></script>
        <script src="scripts/theme.js"></script>

        <script src="scripts/cards/card.js"></script>
        <script src="scripts/cards/deck.js"></script>
        <script src="scripts/cards/drag.js"></script>

        <script src="scripts/gui/input.js"></script>
        <script src="scripts/gui/lobby.js"></script>
        <script src="scripts/gui/table.js"></script>

        <script src="scripts/socket/message.js"></script>
        <script src="scripts/socket/sock.js"></script>

        <script src="scripts/client.js"></script>

        <title>WebCards - Client</title>
    </head>

    <body>
        
        <div class="table" state="closed" onmouseup="d.stopDraggingAll()">

        </div>

        <div class="topbar" style="height: auto;">
            <div class="top-buttons">
                <button id="newgame" class="top-button" onclick="game.lob.newGame()"></button>
                <button id="settings" class="top-button" onclick="game.lob.mobileSettings()"></button>
                <button id="reset" class="top-button" onclick="game.reset()"></button>
            </div>

            <div class="new-game" style="display: none;"></div>

            <div class="settings mobile-settings" style="display: none;">
                <span><input type="text" placeholder="Username"/></span>
                <span><input type="color" value="#f00"/></span>

                <button id="set">Accept Settings</button>
            </div>
            
            <div class="status"></div>
        </div>

        <div class="lobby">

            <div class="server">
                <span style="font-weight: 700;" class="status">Connecting</span>
                <span class="addr"></span>
            </div>

            <div class="content">

                <div class="games">
                    <div class="game">Hello</div>
                </div>

                <div class="info">
                    <div class="stats">
                        <div>
                            <span>Game Name:</span><span id="game">-</span>
                        </div>

                        <div>
                            <span>Packs Available:</span><span id="packs">-</span>
                        </div>
                        
                        <div>
                            <span>Players Online:</span><span id="online">-</span>
                        </div>

                        <div>
                            <span>Players In Game:</span><span id="ingame">-</span>
                        </div>

                        <div>
                            <span>Public Games:</span><span id="pubgame">-</span>
                        </div>
                    </div>

                    <div class="settings" >
                        <div class="input-container" type="color" onclick="this.getElementsByTagName('input')[0].click()">
                            <input type="color">
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <script>
            var params = new URLSearchParams((new URL(window.location)).search);
            var game = new Client(params.get("s"), params.get("g"));
            setTimeout(game.init.bind(game), 100);


            // Live testing purposes only
            var d = new MultiDrag();
            var c1 = new Card({
                all: [
                    {
                        type: "image",
                        image: "assets/standard/diamond.svg"
                    }
                ]
            });
            var c2 = new Card({
                all: [
                    {
                        type: "image",
                        image: "assets/standard/heart.svg"
                    },
                    {
                        type: "image",
                        image: "assets/standard/heart.svg"
                    },
                    {
                        type: "image",
                        image: "assets/standard/heart.svg"
                    }
                ]
            });
            function test() {
                c1.e.addEventListener("mousedown", d.startDragging.bind(d));
                c1.e.addEventListener("mouseup", d.stopDraggingAll.bind(d));
                c2.e.addEventListener("mousedown", d.startDragging.bind(d));
                c2.e.addEventListener("mouseup", d.stopDraggingAll.bind(d));

                game.tab.root.append(c1.e);
                game.tab.root.append(c2.e);
                game.tab.openTable();
            }
        </script>
    </body>

</html>