94 lines
3.8 KiB
HTML
94 lines
3.8 KiB
HTML
<!DOCTYPE html>
|
|
<!--<html lang="en">-->
|
|
<html lang="pl-PL">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Python Flask App</title>
|
|
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
|
<link rel="stylesheet" type="text/css" href="signup.css">
|
|
<!-- <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"> -->
|
|
|
|
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
|
|
<link href="../static/css/signup.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="../static/css/calendar.css">
|
|
|
|
|
|
<script type="text/javascript" src="//code.jquery.com/jquery-1.4.2.min.js"></script>
|
|
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.6/socket.io.min.js"></script>
|
|
<script type="text/javascript" charset="utf-8">
|
|
var socket;
|
|
$(document).ready(function(){
|
|
socket = io.connect('http://' + document.domain + ':' + location.port + '/chat');
|
|
socket.on('connect', function() {
|
|
socket.emit('joined', {});
|
|
});
|
|
socket.on('status', function(data) {
|
|
$('#chat').val($('#chat').val() + '<' + data.msg + '>\n');
|
|
$('#chat').scrollTop($('#chat')[0].scrollHeight);
|
|
});
|
|
socket.on('message', function(data) {
|
|
if (data.msg != "") {
|
|
$('#chat').val($('#chat').val() + data.msg + '\n');
|
|
$('#chat').scrollTop($('#chat')[0].scrollHeight);
|
|
}
|
|
});
|
|
$('#text').keypress(function(e) {
|
|
var code = e.keyCode || e.which;
|
|
if (code == 13) {
|
|
text = $('#text').val();
|
|
$('#text').val('');
|
|
socket.emit('text', {msg: text});
|
|
}
|
|
});
|
|
});
|
|
function leave_room() {
|
|
socket.emit('left', {}, function() {
|
|
socket.disconnect();
|
|
|
|
// go back to the login page
|
|
window.location.href = "{{ url_for('userHome') }}";
|
|
});
|
|
}
|
|
</script>
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="container">
|
|
<div class="header">
|
|
<nav>
|
|
<ul class="nav nav-pills pull-left">
|
|
<!--<form><input type="button" value="Back" onClick="history.go(-1);return true;"></form>-->
|
|
<!--<li role="presentation" class="active"><input type="button" value="Back" onClick="history.go(-1);return true;">
|
|
</li>-->
|
|
<!--<li role="presentation" class="active"><form action="http://google.com"><input type="button" value="Wstecz" onClick="history.go(-1);return true;"></form></li>-->
|
|
<li role="presentation" class="active"><a href="/userHome">Wstecz</a>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav nav-pills pull-right">
|
|
<li role="presentation" class="active"><a href="/logout">Wyloguj</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
<h3 class="text-muted"><center>Python Flask</center></h3>
|
|
</div>
|
|
|
|
<div class="jumbotron" style="height: 550px;">
|
|
<h1>{{ room }}</h1>
|
|
<textarea readonly id="chat" cols="80" rows="15"></textarea><br><br>
|
|
<input id="text" size="80" placeholder="Tutaj wpisz swoją wiadomość"><br><br>
|
|
<a href="#" onclick="leave_room();" style="border:1px;">Wyjdź z czatu</a>
|
|
|
|
|
|
|
|
|
|
</div><footer class="footer">
|
|
<p>© UAM 2018</p>
|
|
</footer>
|
|
</body>
|
|
|
|
</html> |