2020-04-05 16:00:48 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html >
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<meta name="description" content="pyramid web application">
|
|
|
|
<meta name="author" content="Pylons Project">
|
|
|
|
|
2020-12-06 21:56:16 +01:00
|
|
|
<title>Free Online Gambling</title>
|
2020-04-05 16:00:48 +02:00
|
|
|
|
|
|
|
<!-- Bootstrap core CSS -->
|
|
|
|
<link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
|
|
|
|
|
|
|
|
<!-- Custom styles for this scaffold -->
|
|
|
|
<link href="/css/theme.css" rel="stylesheet">
|
|
|
|
<link href="/css/docs.css" rel="stylesheet">
|
|
|
|
|
|
|
|
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
|
|
|
<!--[if lt IE 9]>
|
|
|
|
<script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
|
|
|
<script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
|
|
|
|
<![endif]-->
|
2020-04-19 17:14:25 +02:00
|
|
|
<script>
|
2020-12-14 23:07:03 +01:00
|
|
|
window.the_game = null
|
2020-11-26 00:44:27 +01:00
|
|
|
// let socket = new WebSocket("wss://cowiz.struppi.name/ws");
|
2020-12-11 22:12:27 +01:00
|
|
|
if (window.location.hostname == '127.0.0.1') {
|
|
|
|
ws_schema = 'ws://';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ws_schema = 'wss://';
|
|
|
|
}
|
|
|
|
let socket = new WebSocket(ws_schema+window.location.host+'/ws');
|
2020-05-21 19:54:39 +02:00
|
|
|
window.game_socket = socket
|
2020-04-19 17:14:25 +02:00
|
|
|
|
|
|
|
socket.onopen = function(e) {
|
|
|
|
//alert("[open] Connection established");
|
|
|
|
//alert("Sending to server");
|
|
|
|
//socket.send("My name is John");
|
2020-12-14 23:07:03 +01:00
|
|
|
let player = "{{player}}"
|
2020-12-06 22:28:45 +01:00
|
|
|
var msg = {
|
2020-12-14 23:07:03 +01:00
|
|
|
//type: "message",
|
|
|
|
//fct: "requestInit",
|
2020-12-06 22:28:45 +01:00
|
|
|
type: "message",
|
2020-12-14 23:07:03 +01:00
|
|
|
fct: "getHand",
|
|
|
|
player: player,
|
2020-12-06 22:28:45 +01:00
|
|
|
};
|
|
|
|
let t = JSON.stringify(msg);
|
|
|
|
window.game_socket.send(t);
|
2020-04-19 17:14:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
socket.onmessage = function(event) {
|
2020-12-06 22:28:45 +01:00
|
|
|
let msg = JSON.parse(event.data);
|
|
|
|
let fct = msg.fct;
|
2020-12-06 21:49:17 +01:00
|
|
|
if (fct == "reload") {
|
2020-05-21 20:17:24 +02:00
|
|
|
location.reload(true);
|
|
|
|
}
|
2020-12-14 23:07:03 +01:00
|
|
|
else if (fct == "getHand") {
|
|
|
|
window.hand = msg.cards;
|
|
|
|
var msg_out = {
|
|
|
|
type: "message",
|
|
|
|
fct: "requestInit",
|
|
|
|
};
|
|
|
|
let t = JSON.stringify(msg_out);
|
|
|
|
window.game_socket.send(t);
|
|
|
|
}
|
2020-12-06 21:49:17 +01:00
|
|
|
else if (fct == "startGame") {
|
2020-12-06 22:28:45 +01:00
|
|
|
let names = msg.names
|
2020-12-14 23:07:03 +01:00
|
|
|
setupGame(names, window.hand)
|
|
|
|
//alert('game is set up')
|
2020-12-06 21:21:51 +01:00
|
|
|
}
|
2020-05-21 20:17:24 +02:00
|
|
|
else {
|
|
|
|
alert('unknown command: '+event.data);
|
|
|
|
}
|
2020-04-19 17:14:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
socket.onclose = function(event) {
|
|
|
|
if (event.wasClean) {
|
2020-12-11 17:52:19 +01:00
|
|
|
alert(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
|
|
|
|
//alert('closed clean');
|
2020-04-19 17:14:25 +02:00
|
|
|
} else {
|
2020-12-11 17:52:19 +01:00
|
|
|
//alert('closed unclean');
|
2020-04-19 17:14:25 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
socket.onerror = function(error) {
|
2020-05-22 15:09:45 +02:00
|
|
|
alert("[error]: "+error.message);
|
2020-04-19 17:14:25 +02:00
|
|
|
};
|
|
|
|
</script>
|
2020-11-29 22:31:03 +01:00
|
|
|
|
|
|
|
<style>
|
|
|
|
* {padding: 0; margin: 0}
|
|
|
|
@font-face {
|
|
|
|
font-family: "Wizzta";
|
2020-12-01 22:13:14 +01:00
|
|
|
src: url("/js-cardgame/font/wizzta-vada-webfont.woff2") format("woff2"),
|
|
|
|
url("/js-cardgame/font/wizzta-vada-webfont.woff") format("woff");
|
2020-11-29 22:31:03 +01:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
2020-04-05 16:00:48 +02:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div class="starter-template">
|
|
|
|
<div class="container">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-2">
|
|
|
|
</div>
|
|
|
|
<div class="col-md-10">
|
|
|
|
<div>{% block content %}{% endblock %}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-04-19 00:38:57 +02:00
|
|
|
<!--
|
2020-04-05 16:00:48 +02:00
|
|
|
<div class="row">
|
|
|
|
<div class="links">
|
|
|
|
<ul>
|
|
|
|
<li><i class="glyphicon glyphicon-cog icon-muted"></i><a
|
|
|
|
href="https://github.com/mikeckennedy/python-jumpstart-course-demos"
|
|
|
|
target="_blank">Github Project</a></li>
|
|
|
|
<li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="https://twitter.com/talkpython"
|
|
|
|
target="_blank">Twitter</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="copyright">
|
|
|
|
Copyright © Talk Python Training
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-04-19 00:38:57 +02:00
|
|
|
-->
|
2020-04-05 16:00:48 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Bootstrap core JavaScript
|
|
|
|
================================================== -->
|
|
|
|
<!-- Placed at the end of the document so the pages load faster -->
|
2020-11-29 22:31:03 +01:00
|
|
|
<!-- <script src="https://oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js"></script> -->
|
|
|
|
<script src="/js-cardgame/jquery-3.5.1.min.js"></script>
|
|
|
|
<script src="https://oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
|
2020-04-05 16:00:48 +02:00
|
|
|
</body>
|