diff options
Diffstat (limited to 'client/index.html')
-rw-r--r-- | client/index.html | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/client/index.html b/client/index.html deleted file mode 100644 index a03d777..0000000 --- a/client/index.html +++ /dev/null @@ -1,51 +0,0 @@ -<!DOCTYPE HTML> -<html> - <head> - <meta charset="UTF-8"> - <title>Client</title> - <link rel="stylesheet" type="text/css" href="$UPLCG_BASE/assets/style.css"> - <meta name="viewport" content="width=device-width"> - </head> - <body> - <div id="main"></div> - <script type="text/JavaScript" src="$UPLCG_BASE/assets/client.js"></script> - <script> - var app = Elm.Client.init({node: document.querySelector("main")}); - - function connect() { - var protocol = "ws:"; - if(document.location.protocol == "https:") { - protocol = "wss:" - } - var path = document.location.pathname; - if(path.startsWith("$UPLCG_BASE")) { - path = path.substr("$UPLCG_BASE".length); - } - var roomId = path.split("/")[2]; - var url = protocol + "//" + document.location.host + - "$UPLCG_BASE/rooms/" + roomId + "/events"; - - var socket = new WebSocket(url); - var socketSend = function(message) { - socket.send(message); - }; - app.ports.webSocketOut.subscribe(socketSend); - socket.onmessage = function(event) { - app.ports.webSocketIn.send(event.data); - }; - socket.onclose = function(event) { - app.ports.webSocketOut.unsubscribe(socketSend); - setTimeout(function() { - connect(); - }, 1000); - }; - socket.onerror = function(event) { - socket.close(); - }; - } - - connect(); - </script> - <footer>Untitled PL Card Game version $UPLCG_VERSION</footer> - </body> -</html> |