2023-02-08 05:14:48 +00:00
|
|
|
{% set layout = "no_wrapper" %}
|
2020-01-27 20:37:52 +00:00
|
|
|
{% extends "base.html" %}
|
2020-06-08 20:11:07 +00:00
|
|
|
{% block title_row %}{% endblock %}
|
|
|
|
{% block title_ruler %}{% endblock %}
|
2020-08-02 22:34:06 +00:00
|
|
|
{% block title %} {{_('Chat Box')}} {% endblock %}
|
2020-01-27 20:37:52 +00:00
|
|
|
{% block js_media %}
|
2020-06-08 20:11:07 +00:00
|
|
|
|
2023-01-27 23:11:10 +00:00
|
|
|
<script type="text/javascript" src="{{ static('mathjax3_config.js') }}"></script>
|
|
|
|
<script type="text/javascript" src="{{ static('event.js') }}"></script>
|
|
|
|
<script type="module" src="https://unpkg.com/emoji-picker-element@1"></script>
|
2023-08-28 19:20:35 +00:00
|
|
|
{% compress js %}
|
|
|
|
{% include "chat/chat_js.html" %}
|
|
|
|
{% endcompress %}
|
|
|
|
|
2023-01-27 23:11:10 +00:00
|
|
|
<script type="text/javascript">
|
2021-11-21 04:23:03 +00:00
|
|
|
window.limit_time = 24;
|
|
|
|
window.room_id = "{{room if room else ''}}";
|
|
|
|
window.unread_message = 0;
|
|
|
|
window.other_user_id = "{{other_user.id if other_user else ''}}";
|
|
|
|
window.lock = false;
|
2021-11-22 02:24:55 +00:00
|
|
|
window.lock_click_space = false;
|
2022-08-25 13:51:54 +00:00
|
|
|
window.pushed_messages = new Set();
|
2021-11-22 02:24:55 +00:00
|
|
|
let isMobile = window.matchMedia("only screen and (max-width: 799px)").matches;
|
2021-11-21 04:23:03 +00:00
|
|
|
|
2021-06-19 03:26:43 +00:00
|
|
|
window.load_dynamic_update = function (last_msg) {
|
2023-01-27 23:11:10 +00:00
|
|
|
var receiver = new EventReceiver(
|
|
|
|
"{{ EVENT_DAEMON_LOCATION }}", "{{ EVENT_DAEMON_POLL_LOCATION }}",
|
2023-08-28 19:20:35 +00:00
|
|
|
['{{chat_lobby_channel}}', '{{chat_channel}}'], last_msg, function (message) {
|
2023-01-27 23:11:10 +00:00
|
|
|
if (window.pushed_messages.has(message.message)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
window.pushed_messages.add(message.message);
|
|
|
|
var room = (message.type == 'lobby') ? '' : message.room;
|
|
|
|
if (message.author_id == {{request.profile.id}}) {
|
|
|
|
check_new_message(message.message, message.tmp_id, room);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
add_new_message(message.message, room, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2022-05-18 17:34:21 +00:00
|
|
|
|
2023-01-27 23:11:10 +00:00
|
|
|
return receiver;
|
2021-06-19 03:26:43 +00:00
|
|
|
}
|
2023-08-28 19:35:44 +00:00
|
|
|
let message_template = `
|
|
|
|
{% with message=message_template %}
|
|
|
|
{% include "chat/message.html" %}
|
|
|
|
{% endwith %}
|
|
|
|
`;
|
2021-06-19 03:26:43 +00:00
|
|
|
$(function() {
|
2023-01-27 23:11:10 +00:00
|
|
|
load_dynamic_update({{last_msg}});
|
2021-07-24 06:36:34 +00:00
|
|
|
});
|
2023-01-27 23:11:10 +00:00
|
|
|
</script>
|
2021-07-08 22:09:30 +00:00
|
|
|
|
2021-07-24 06:36:34 +00:00
|
|
|
{% endblock js_media %}
|
2020-06-10 18:31:53 +00:00
|
|
|
|
2021-07-24 06:36:34 +00:00
|
|
|
{% block media %}
|
2023-01-27 23:11:10 +00:00
|
|
|
{% include "chat/chat_css.html" %}
|
2021-07-24 06:36:34 +00:00
|
|
|
{% endblock media %}
|
2022-12-07 07:15:26 +00:00
|
|
|
|
2020-01-27 20:37:52 +00:00
|
|
|
{% block body %}
|
2023-01-27 23:11:10 +00:00
|
|
|
<div class="chat">
|
|
|
|
<div id="mobile" class="tabs">
|
|
|
|
<ul>
|
|
|
|
<li id="chat-tab" class="tab active"><a href="#">
|
|
|
|
<i class="tab-icon fa fa-comments"></i> {{ _('Chat') }}
|
|
|
|
</a></li>
|
|
|
|
<li id="online-tab" class="tab"><a href="#"><i class="tab-icon fa fa-wifi"></i> {{ _('Online Users') }}</a></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="chat-container">
|
|
|
|
<div id="chat-online" class="chat-right-panel sidebox">
|
2023-03-03 00:43:15 +00:00
|
|
|
<h3>
|
|
|
|
<i class="fa fa-users"></i>{{_('Online Users')}}
|
2023-01-27 23:11:10 +00:00
|
|
|
</h3>
|
|
|
|
<div id="chat-online-content">
|
|
|
|
<div id="search-container">
|
|
|
|
<center>
|
|
|
|
<form id="search-form" name="form" action="{{ url('get_or_create_room') }}" method="post">
|
|
|
|
{% csrf_token %}
|
|
|
|
<input id="search-handle" type="text" name="search"
|
|
|
|
placeholder="{{ _('Search by handle...') }}">
|
|
|
|
</form>
|
|
|
|
</center>
|
|
|
|
</div>
|
|
|
|
<div id="chat-online-list">
|
|
|
|
{% include "chat/online_status.html" %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="chat-area" class="chat-left-panel" style="width:100%">
|
2023-03-03 00:43:15 +00:00
|
|
|
<div id="chat-info" style="height: 10%">
|
2023-01-27 23:11:10 +00:00
|
|
|
{% include 'chat/user_online_status.html' %}
|
|
|
|
</div>
|
|
|
|
<div id="chat-box">
|
2023-08-28 19:20:35 +00:00
|
|
|
<img src="{{static('loading.gif')}}" id="loader">
|
2023-01-27 23:11:10 +00:00
|
|
|
<ul id="chat-log" style="display: none">
|
|
|
|
{% include 'chat/message_list.html' %}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div style="height: 15%">
|
|
|
|
<a id="emoji-button" href="#" title="{{_('Emoji')}}"><i class="icofont-slightly-smile"></i></a>
|
|
|
|
<textarea maxlength="5000" id="chat-input" placeholder="{{_('Enter your message')}}"></textarea>
|
2020-03-20 21:34:33 +00:00
|
|
|
</div>
|
2023-01-27 23:11:10 +00:00
|
|
|
<div class="tooltip" role="tooltip">
|
|
|
|
<emoji-picker></emoji-picker>
|
2021-07-24 06:36:34 +00:00
|
|
|
</div>
|
2023-01-27 23:11:10 +00:00
|
|
|
</div>
|
2020-03-16 07:56:55 +00:00
|
|
|
</div>
|
2023-01-27 23:11:10 +00:00
|
|
|
</div>
|
2021-06-19 06:09:16 +00:00
|
|
|
{% endblock body %}
|