2022-11-21 08:52:22 +00:00
{%- extends 'root.html' -%}
2023-01-20 04:42:30 +00:00
{% block pagetitle -%}
{%- if request.path == '/admin/chat' -%}
Admin Chat
{%- else -%}
Chat
{%- endif -%}
{%- endblock %}
2022-11-21 08:52:22 +00:00
{% block pagetype %}chat{% endblock %}
{% block body %}
2022-03-24 19:44:12 +00:00
{% include "header.html" %}
2022-11-15 19:14:29 +00:00
{% include "modals/expanded_image.html" %}
{% include "modals/emoji.html" %}
2023-01-22 03:17:14 +00:00
{% set vlink = '< a href = "/id/' ~ v.id ~ '" > ' %}
2023-01-21 10:36:21 +00:00
< div class = "container pb-4" >
< div class = "row justify-content-around" id = "main-content-row" >
< div class = "col h-100 {% block customPadding %}{% if request.path.startswith('/@') %}user-gutters{% else %}custom-gutters{% endif %}{% endblock %}" id = "main-content-col" >
< div class = "border-right pb-1 pt-2 px-3" >
< span id = "online2" data-bs-html = "true" data-bs-toggle = "tooltip" data-bs-placement = "bottom" title = "Users Online" class = "text-muted" >
< i class = "far fa-user fa-sm mr-1" > < / i >
< span class = "board-chat-count" > 0< / span >
< / span >
< / div >
2023-01-22 02:43:28 +00:00
{% macro chat_group_template(id, m) %}
< div class = "chat-group" >
< div class = "avatar profile-pic-20-wrapper" >
< img class = "avatar-pic pp20 mr-1" { % if m % } src = "/pp/{{m['user_id']}}" { % endif % } >
< img class = "avatar-hat profile-pic-20-hat hat" loading = "lazy" { % if m % } src = "{{m['hat']}}" { % endif % } >
< / div >
< a class = "font-weight-bold text-black userlink" target = "_blank" { % if m % } style = "color:#{{m['namecolor']}}" href = "/@{{m['username']}}" { % endif % } >
{% if m %}{{m['username']}}{% endif %}
< / a >
< span class = "text-black time ml-1 mb-3 text-center" > {% if m %}{{m['time'] | timestamp}}{% else %}just now{% endif %}< / span >
2023-01-22 05:30:57 +00:00
< input hidden class = "user_id" { % if m % } value = "{{m['user_id']}}" { % endif % } >
2023-01-22 02:43:28 +00:00
{% endmacro %}
{% macro chat_line_template(id, m) %}
2023-01-22 05:30:57 +00:00
< div class = "chat-line {% if m and (vlink in m['text_html'] or (m['quotes'] and messages[m['quotes']]['user_id'] == v.id)) %}chat-mention{% endif %}" { % if m % } id = "{{id}}" { % endif % } >
2023-01-21 10:36:21 +00:00
< div class = "d-flex align-items-center" >
2023-01-22 02:43:28 +00:00
< div class = "text-muted chat-line-content" >
< div class = "{% if not (m and m['quotes']) %}d-none{% endif %} quotes" style = "font-size:12px" >
< a class = "QuotedMessageLink" { % if m and m [ ' quotes ' ] % } href = "#{{m['quotes']}}" { % endif % } >
< i class = "fas fa-reply" > < / i >
2023-01-22 04:22:49 +00:00
< span class = "text-primary" > @< span class = "QuotedUser" > {% if m and m['quotes'] %}{{messages[m['quotes']]['username']}}{% endif %}< / span > < / span > :
2023-01-22 02:43:28 +00:00
< em class = "QuotedMessage" >
{% if m and m['quotes'] %}{{messages[m['quotes']]['text']}}{% endif %}
< / em >
< / a >
2023-01-21 10:36:21 +00:00
< / div >
2023-01-22 02:43:28 +00:00
< span class = "chat-message text-black text-break" >
{% if m %}
{% if v.slurreplacer %}
{{m['text_censored'] | safe}}
{% else %}
{{m['text_html'] | safe}}
{% endif %}
2023-01-21 10:36:21 +00:00
{% endif %}
2023-01-22 02:43:28 +00:00
< / span >
< span class = "text d-none" > {% if m %}{{m['text']}}{% endif %}< / span >
{% if v.admin_level > 1 %}
< i class = "btn del fas fa-trash-alt" > < / i >
< i class = "btn d-none del delmsg fas fa-trash-alt text-danger" data-nonce = "{{g.nonce}}" data-onclick = "del(this)" > < / i >
{% endif %}
< i class = "quote btn fas fa-reply" data-nonce = "{{g.nonce}}" data-onclick = "quote(this)" > < / i >
2023-01-21 10:36:21 +00:00
< / div >
< / div >
< / div >
2023-01-22 02:43:28 +00:00
{% endmacro %}
< div id = "chat-group-template" class = "d-none" >
{{chat_group_template()}}
< / div >
< / div >
< div id = "chat-line-template" class = "d-none" >
{{chat_line_template()}}
2023-01-21 10:36:21 +00:00
< / div >
2023-01-22 02:43:28 +00:00
2023-01-21 10:36:21 +00:00
< div id = "shrink" >
< div id = "chat-window" class = "container pl-0 py-0" >
2023-01-22 03:16:37 +00:00
{% set messages_list = messages.items()|list %}
{% for id, m in messages_list %}
{% set same = loop.index > 1 and m['user_id'] == messages_list[loop.index-2][1]['user_id'] %}
{% if not same %}
2023-01-22 02:43:28 +00:00
{% if loop.index > 1 %}
< / div >
{% endif %}
{{chat_group_template(id, m)}}
{% endif %}
{{chat_line_template(id, m)}}
{% endfor %}
< / div >
2023-01-21 10:36:21 +00:00
< / div >
< div class = "mt-3" > < / div >
2023-01-21 11:14:55 +00:00
< div id = "quotes" class = "mt-3 ml-3 mb-2 d-none" style = "font-size:12px" >
2023-01-21 10:36:21 +00:00
< a id = "QuotedMessageLink" >
< i class = "fas fa-reply" > < / i > < span class = "text-primary" > @< span id = "QuotedUser" > < / span > < / span > : < em id = "QuotedMessage" > < / em >
< button type = "button" id = "cancel" class = "btn btn-secondary" > Cancel< / button >
< input hidden id = "quotes_id" >
< / a >
< / div >
< div id = 'message' class = "d-none position-relative form-group d-flex" >
< div class = "position-absolute text-muted text-small ml-1" style = "bottom: -1.5rem; line-height: 1;" >
< span id = "typing-indicator" > < / span >
< span id = "loading-indicator" class = "d-none" > < / span >
< / div >
2023-01-22 00:14:45 +00:00
< span class = "my-auto" >
2023-01-21 11:39:42 +00:00
< i class = "btn btn-secondary fas fa-smile-beam" style = "font-size:1.3rem!important" data-nonce = "{{g.nonce}}" data-onclick = "loadEmojis('input-text')" data-bs-toggle = "modal" data-bs-target = "#emojiModal" > < / i >
< / span >
2023-01-21 10:36:21 +00:00
2023-01-22 00:14:45 +00:00
< span class = "my-auto ml-1" >
2023-01-21 11:39:42 +00:00
< label class = "btn btn-secondary format mb-0" >
< div id = "filename" class = "mr-3" style = "font-size:12px" > < i class = "fas fa-image" style = "font-size:1.3rem!important" > < / i > < / div >
< input autocomplete = "off" id = "file" accept = "image/*" type = "file" multiple = "multiple" name = "file" { % if g . is_tor % } disabled { % endif % } data-nonce = "{{g.nonce}}" data-onchange = "changename('filename','file')" hidden >
< / label >
< / span >
2023-01-21 10:36:21 +00:00
2023-01-22 02:43:28 +00:00
< textarea id = "input-text" minlength = "1" maxlength = "{% if SITE == 'rdrama.net' %}200{% else %}1000{% endif %}" { % if g . browser = = " apple " % } style = "font-size:16px!important" { % endif % } class = "form-control" placeholder = "Message" autocomplete = "off" autofocus rows = "1" > < / textarea >
2023-01-21 10:36:21 +00:00
2023-01-22 00:14:45 +00:00
< i id = "chatsend" data-nonce = "{{g.nonce}}" data-onclick = "send()" class = "btn btn-secondary fas fa-reply ml-3 my-auto" type = "submit" data-nonce = "{{g.nonce}}" data-onclick = "disable(this)" style = "transform:rotateY(180deg);font-size:1.3rem!important" > < / i >
2023-01-21 10:36:21 +00:00
< / div >
< / div >
< / div >
< div class = "col text-left d-none d-lg-block pt-3" style = "max-width:300px" >
< h5 > Users Online< / h5 >
< div id = "online" class = "mt-3" > < / div >
< / div >
2022-03-22 02:35:12 +00:00
< / div >
2023-01-21 10:36:21 +00:00
< input id = "vid" type = "hidden" value = "{{v.id}}" >
< input id = "site_name" type = "hidden" value = "{{SITE_NAME}}" >
< input id = "slurreplacer" type = "hidden" value = "{{v.slurreplacer}}" >
< script defer src = "{{'js/vendor/socketio.js' | asset}}" > < / script >
2023-01-20 04:27:38 +00:00
< script defer src = "{{'js/chat.js' | asset}}" > < / script >
2022-11-18 19:16:40 +00:00
< script defer src = "{{'js/vendor/lozad.js' | asset}}" > < / script >
< script defer src = "{{'js/vendor/lite-youtube.js' | asset}}" > < / script >
2022-11-21 08:52:22 +00:00
{% endblock %}