diff --git a/css/counter.css b/css/counter.css index 4108b97..30cf977 100644 --- a/css/counter.css +++ b/css/counter.css @@ -21,26 +21,26 @@ color: var(--text-color); font-family: 'Inter', sans-serif; - font-size: 24px; + font-size: 32px; } -#pp::after { - content: 'pp'; +#pp { font-weight: 700; } -.hundred-count, .fifty-count, .zero-count { - padding: 5px; +#pp::after { + content: ' pp'; + font-weight: 400; } -.hundred-count { +#hundred-count { color: var(--hundred-bg); } -.fifty-count { +#fifty-count { color: var(--fifty-bg); } -.zero-count { +#miss-count { color: var(--miss-bg); } \ No newline at end of file diff --git a/index.html b/index.html index ea5641b..21924db 100644 --- a/index.html +++ b/index.html @@ -8,11 +8,12 @@
- 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0
+ diff --git a/js/socket.js b/js/socket.js new file mode 100644 index 0000000..8279064 --- /dev/null +++ b/js/socket.js @@ -0,0 +1,24 @@ +let socket = new ReconnectingWebSocket('ws://localhost:24050/ws') +let pp = document.getElementById('pp') +let hundred = document.getElementById('hundred-count') +let fifty = document.getElementById('fifty-count') +let miss = document.getElementById('miss-count') + +socket.onopen = () => console.log('connected') +socket.onclose = event => { + console.log('socket closed:', event) + socket.send('Client Closed!') +} +socket.onerror = error => console.log('wtf just happened:', error) + +socket.onmessage = event => { + try { + let data = JSON.parse(event.data), menu = data.menu, play = data.gameplay + pp.innerHTML = play.pp.current + hundred.innerHTML = play.hits[100] + fifty.innerHTML = play.hits[50] + miss.innerHTML = play.hits[0] + } catch (err) { + console.log('WTF JSOI:KJmg;klfejgkldjsgk;ldfjkl:', error) + } +} \ No newline at end of file