🎉 Initial Commit

main
Nichole Mattera 3 years ago
commit 0d8b61d359
  1. 1
      .gitignore
  2. 1
      1f95a.svg
  3. 20
      editor.html
  4. 51
      index.html
  5. 10
      server/app.js
  6. 13
      server/package-lock.json
  7. 14
      server/package.json

1
.gitignore vendored

@ -0,0 +1 @@
server/node_modules

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#F7DECE" d="M23.142 3.403C21.492 1.899 19.712 1 18 1 12.375 1 6 10.611 6 20c0 .975.079 1.899.202 2.791C7.261 30.484 12.623 35 18 35c6 0 12-5.611 12-15 0-6.531-3.086-13.161-6.858-16.597z"/><path fill="#E0AA94" d="M23.142 3.403c2.908 3.519 5.108 9.018 5.108 14.453 0 9.009-5.672 14.393-11.344 14.393-4.541 0-9.075-3.459-10.705-9.459C7.261 30.484 12.623 35 18 35c6 0 12-5.611 12-15 0-6.531-3.086-13.161-6.858-16.597z"/></svg>

After

Width:  |  Height:  |  Size: 494 B

@ -0,0 +1,20 @@
<html>
<head>
<title>Egg Count Editor</title>
</head>
<body>
<input type="text" id="amount" value="0" />
<button id="send">
Send
</button>
<script type="text/javascript">
const amount = document.querySelector('#amount')
const button = document.querySelector('#send')
const socket = new WebSocket('ws://10.0.1.11:8080')
button.addEventListener('click', () => {
socket.send(amount.value)
})
</script>
</body>
</html>

@ -0,0 +1,51 @@
<html>
<head>
<title>Egg Count</title>
<style>
body, html {
background-color: transparent;
margin: 0;
padding: 0;
}
.container {
height: 185px;
position: relative;
width: 128px;
}
.egg, .count {
height: 100%;
left: 0;
position: absolute;
text-align: center;
top: 0;
width: 100%;
}
.count {
font-size: 64px;
padding: 16px 0 0;
}
</style>
</head>
<body>
<div class="container">
<div class="egg">
<img src="./1f95a.svg" height="128" />
</div>
<div class="count" id="count">
0
</div>
</div>
<script type="text/javascript">
const count = document.querySelector('#count')
const socket = new WebSocket('ws://10.0.1.11:8080')
socket.onmessage = (event) => {
count.innerHTML = event.data
}
</script>
</body>
</html>

@ -0,0 +1,10 @@
const WebSocket = require('ws')
const server = new WebSocket.Server({
port: 8080
})
server.on('connection', (socket) => {
socket.on('message', function(message) {
server.clients.forEach((client) => client.send(message))
})
})

@ -0,0 +1,13 @@
{
"name": "server",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"ws": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.0.tgz",
"integrity": "sha512-kyFwXuV/5ymf+IXhS6f0+eAFvydbaBW3zjpT6hUdAh/hbVjTIB5EHBGi0bPoCLSK2wcuz3BrEkB9LrYv1Nm4NQ=="
}
}
}

@ -0,0 +1,14 @@
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"ws": "^7.4.0"
}
}
Loading…
Cancel
Save