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 %}
|
2023-01-27 23:11:10 +00:00
|
|
|
<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-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
|
|
|
}
|
2024-06-24 19:56:00 +00:00
|
|
|
function message_template() {
|
|
|
|
return`
|
2023-08-28 19:35:44 +00:00
|
|
|
{% with message=message_template %}
|
|
|
|
{% include "chat/message.html" %}
|
|
|
|
{% endwith %}
|
2024-06-24 19:56:00 +00:00
|
|
|
`};
|
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="chat-container">
|
2023-09-25 07:12:06 +00:00
|
|
|
<div id="chat-online" class="chat-left-panel sidebox">
|
2023-01-27 23:11:10 +00:00
|
|
|
<div id="chat-online-content">
|
|
|
|
<div id="search-container">
|
2023-08-29 23:36:01 +00:00
|
|
|
<form id="chat-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>
|
2023-01-27 23:11:10 +00:00
|
|
|
</div>
|
|
|
|
<div id="chat-online-list">
|
|
|
|
{% include "chat/online_status.html" %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-09-25 07:12:06 +00:00
|
|
|
<div id="chat-area" class="chat-right-panel">
|
2023-08-30 02:50:33 +00:00
|
|
|
<div id="chat-info">
|
2023-01-27 23:11:10 +00:00
|
|
|
{% include 'chat/user_online_status.html' %}
|
|
|
|
</div>
|
|
|
|
<div id="chat-box">
|
2024-04-13 22:02:54 +00:00
|
|
|
<span id="loader" style="font-size: 2em; display: none;">
|
|
|
|
<i class="fa fa-spinner fa-pulse"></i>
|
|
|
|
</span>
|
2023-08-30 02:50:33 +00:00
|
|
|
<ul id="chat-log">
|
2023-01-27 23:11:10 +00:00
|
|
|
{% include 'chat/message_list.html' %}
|
|
|
|
</ul>
|
|
|
|
</div>
|
2023-08-30 02:50:33 +00:00
|
|
|
<div id="chat-input-container">
|
2024-01-28 21:39:27 +00:00
|
|
|
<textarea maxlength="{{5000 if room else 200}}" id="chat-input" placeholder="{{_('Enter your message')}}"></textarea>
|
2023-08-30 02:50:33 +00:00
|
|
|
<div class="chat-input-icon" id="emoji-button" href="#" title="{{_('Emoji')}}"><i class="icofont-slightly-smile"></i>
|
|
|
|
</div>
|
|
|
|
<div class="chat-input-icon" id="submit-button">
|
2023-09-25 07:12:06 +00:00
|
|
|
<i class="fa fa-arrow-right"></i>
|
2023-08-30 02:50:33 +00:00
|
|
|
</div>
|
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 %}
|