|
|
|
|
@ -3,41 +3,43 @@ |
|
|
|
|
<!doctype html> |
|
|
|
|
<html> |
|
|
|
|
<head> |
|
|
|
|
<meta charset='utf-8'> |
|
|
|
|
<meta http-equiv='X-UA-Compatible' content='IE=edge, chrome=1'> |
|
|
|
|
<meta name='viewport' content='width=device-width, initial-scale=1'> |
|
|
|
|
<!--<meta name='viewport' content='initial-scale=1.0, user-scalable=no, maximum-scale=1'>--> |
|
|
|
|
|
|
|
|
|
<title>Archilance</title> |
|
|
|
|
{% load compress %} |
|
|
|
|
|
|
|
|
|
{% compress css %} |
|
|
|
|
<link rel='stylesheet' href='{% static "css/bootstrap.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/font-awesome.min.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/reset.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/bootstrap-select/css/bootstrap-select.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/select2/select2.css" %}'> <!-- Tmp --> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/swiper.min.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/jquery.fileupload/css/jquery.fileupload.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "js/magnific-popup.css" %}'> |
|
|
|
|
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/jquery-jgrowl/1.4.1/jquery.jgrowl.min.css" /> |
|
|
|
|
|
|
|
|
|
<link rel='stylesheet' href='{% static "css/main.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/extra.css" %}'> <!-- Our additional CSS --> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/dev-colors.css" %}'> <!-- Dev-time only, temporary!!! --> |
|
|
|
|
{% endcompress %} |
|
|
|
|
<meta charset='utf-8'> |
|
|
|
|
<meta http-equiv='X-UA-Compatible' content='IE=edge, chrome=1'> |
|
|
|
|
<meta name='viewport' content='width=device-width, initial-scale=1'> |
|
|
|
|
<!--<meta name='viewport' content='initial-scale=1.0, user-scalable=no, maximum-scale=1'>--> |
|
|
|
|
|
|
|
|
|
<title>Archilance</title> |
|
|
|
|
{% load compress %} |
|
|
|
|
|
|
|
|
|
{% compress css %} |
|
|
|
|
<link rel='stylesheet' href='{% static "css/bootstrap.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/font-awesome.min.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/reset.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/bootstrap-select/css/bootstrap-select.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/select2/select2.css" %}'> <!-- Tmp --> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/swiper.min.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/jquery.fileupload/css/jquery.fileupload.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "js/magnific-popup.css" %}'> |
|
|
|
|
<link rel="stylesheet" type="text/css" |
|
|
|
|
href="//cdnjs.cloudflare.com/ajax/libs/jquery-jgrowl/1.4.1/jquery.jgrowl.min.css"/> |
|
|
|
|
|
|
|
|
|
<link rel='stylesheet' href='{% static "css/main.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/extra.css" %}'> <!-- Our additional CSS --> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/dev-colors.css" %}'> <!-- Dev-time only, temporary!!! --> |
|
|
|
|
{% endcompress %} |
|
|
|
|
</head> |
|
|
|
|
|
|
|
|
|
<body> |
|
|
|
|
{% if messages %} |
|
|
|
|
{% for message in messages %} |
|
|
|
|
<div class="c" style="position: relative; padding: 10px; margin-bottom: 6px; z-index: 100">{{ message|safe }}</div> |
|
|
|
|
<div class="c" |
|
|
|
|
style="position: relative; padding: 10px; margin-bottom: 6px; z-index: 100">{{ message|safe }}</div> |
|
|
|
|
{% endfor %} |
|
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
|
<div style="position: absolute; left: 0; top: 0; padding: 6px; color: black; background-color: #BADA55; z-index: 50"> |
|
|
|
|
{{ request.user }}<br> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{% if request.user.is_authenticated %} |
|
|
|
|
<b>PK:</b> {{ request.user.pk }}<br> |
|
|
|
|
<b>Groups:</b> {{ request.user.groups.all }} |
|
|
|
|
@ -73,8 +75,14 @@ |
|
|
|
|
{% endblock %} |
|
|
|
|
<script type="text/javascript"> |
|
|
|
|
|
|
|
|
|
var SocketHandlerMain = function (userId) { |
|
|
|
|
var url = 'ws://127.0.0.1:8888/chat/' + userId + '/'; |
|
|
|
|
var SocketHandlerMain = function (userId) { |
|
|
|
|
var domain = '{{ request.META.HTTP_HOST }}'; |
|
|
|
|
var port = '{{ request.META.SERVER_PORT }}'; |
|
|
|
|
var queryString = '{{ request.get_full_path }}'; |
|
|
|
|
|
|
|
|
|
if (queryString.indexOf('/chat') != 0) { |
|
|
|
|
domain = domain.replace(':' + port, ''); |
|
|
|
|
var url = 'ws://' + domain + ':8888/chat/' + userId + '/'; |
|
|
|
|
var sock = new WebSocket(url); |
|
|
|
|
var intervalId; |
|
|
|
|
sock.onopen = function () { |
|
|
|
|
@ -88,14 +96,14 @@ |
|
|
|
|
var notificationData = JSON.parse(event.data); |
|
|
|
|
$.jGrowl("Вам пришло новое сообщение!" + notificationData.msg, {sticky: true}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
$(function () { |
|
|
|
|
var userId = '{{ request.user.pk }}'; |
|
|
|
|
if (userId) { |
|
|
|
|
var socketMain = new SocketHandlerMain(userId); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
$(function () { |
|
|
|
|
var userId = '{{ request.user.pk }}'; |
|
|
|
|
if (userId) { |
|
|
|
|
var socketMain = new SocketHandlerMain(userId); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
</script> |
|
|
|
|
</body> |
|
|
|
|
</html> |
|
|
|
|
|