forked from rDrama/rDrama
fix
parent
a58620f53c
commit
ce99250172
|
@ -1,7 +1,34 @@
|
|||
<style>
|
||||
html {
|
||||
scroll-padding-top: 75px;
|
||||
}
|
||||
.comment {
|
||||
overflow: hidden;
|
||||
}
|
||||
.comment .comment-body {
|
||||
padding: 3px 0;
|
||||
}
|
||||
.comment-anchor:target {
|
||||
transition: all 0.25s ease;
|
||||
animation: blink normal 1s ease;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
0% {
|
||||
background-color: rgba(0,0,0,0.1)
|
||||
}
|
||||
50% {
|
||||
background-color: rgba(0,0,0,0.2)
|
||||
}
|
||||
100% {
|
||||
background-color: rgba(0,0,0,0.1)
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
{% if v %}
|
||||
{% include "award_modal.html" %}
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/marked@3.0.8/lib/marked.min.js"></script>
|
||||
<script defer src="/assets/js/comments_v.js?v=74"></script>
|
||||
{% endif %}
|
||||
|
||||
|
@ -9,11 +36,110 @@
|
|||
<script defer src="/assets/js/comments_admin.js?v=54"></script>
|
||||
{% endif %}
|
||||
|
||||
<script defer src="/assets/js/popover.js?v=9"></script>
|
||||
<script defer src="/assets/js/comments.js?v=5"></script>
|
||||
|
||||
{% include "expanded_image_modal.html" %}
|
||||
|
||||
<script defer>
|
||||
function poll_vote(cid, parentid) {
|
||||
{% if v %}
|
||||
for(let el of document.getElementsByClassName('presult-'+parentid)) {
|
||||
el.classList.remove('hidden');
|
||||
}
|
||||
for(let el of document.getElementsByClassName('presult')) {
|
||||
el.classList.remove('hidden');
|
||||
}
|
||||
var type = document.getElementById(cid).checked;
|
||||
var scoretext = document.getElementById('poll-' + cid);
|
||||
var score = Number(scoretext.textContent);
|
||||
if (type == true) scoretext.textContent = score + 1;
|
||||
else scoretext.textContent = score - 1;
|
||||
post('/vote/poll/' + cid + '?vote=' + type);
|
||||
{% else %}
|
||||
var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
|
||||
myToast.show();
|
||||
document.getElementById('toast-post-error-text').innerText = "Only logged-in users can vote!";
|
||||
{% endif %}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
{% macro single_comment(c, level=1) %}
|
||||
|
||||
{% if p and not (v and v.id==c.author_id) and (not v or v.highlightcomments) %}
|
||||
<script defer>
|
||||
comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
|
||||
lastCount = comments['{{p.id}}']
|
||||
if (lastCount && {{c.created_utc*1000}} > lastCount.t) {
|
||||
document.getElementById("reddot-{{c.id}}").innerHTML = '<i style="color:red !important" class="text-admin fas fa-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Unread"></i>'
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
<script defer>
|
||||
(() => {
|
||||
const date = new Date({{c.created_utc*1000}});
|
||||
document.getElementById('timestamp-{{c.id}}').title = date.toString();
|
||||
|
||||
{% if c.is_pinned %}
|
||||
const pinned_info = document.getElementById('pinned-{{c.id}}')
|
||||
{% if c.is_pinned.startswith('t:') %}
|
||||
pinned_info.setAttribute("data-bs-original-title", `Pinned until ${new Date({{c.is_pinned[2:]}} * 1000).toString()}`)
|
||||
{% else %}
|
||||
pinned_info.setAttribute("data-bs-original-title", "Pinned by @{{c.is_pinned}}")
|
||||
{%endif%}
|
||||
{%endif%}
|
||||
})()
|
||||
</script>
|
||||
|
||||
<div style="display:none" id="popover-{{c.id}}">
|
||||
<div class="popover-user-profile" role="tooltip">
|
||||
<img class="w-100 h-64 object-cover lozad" src="{{c.author.banner_url}}">
|
||||
<div class="d-flex align-items-end px-3 mt-n6 mb-3">
|
||||
<img loading="lazy" class="avatar-72 rounded img-thumbnail shadow-sm lozad" src="{{c.author.profile_url}}">
|
||||
<div class="px-3 text-truncate">
|
||||
<h5 class="text-truncate text-black">{{c.author.username}}</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-3">
|
||||
<span class="popover-bio text-black">{% if c.author.bio_html %}{{c.author.bio_html_eager | safe}}{% endif %}</span>
|
||||
</div>
|
||||
|
||||
<div class="ml-3 mr-3 my-2">
|
||||
{% for b in c.author.badges %}
|
||||
{% if b.url %}
|
||||
<a rel="nofollow noopener noreferrer" href="{{b.url}}">
|
||||
<img width="32" loading="lazy" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{b.name}} - {{b.text}}">
|
||||
</a>
|
||||
{% else %}
|
||||
<img width="32" loading="lazy" class="lozad" src="{{b.path}}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{b.name}} - {{b.text}}">
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="border-top d-flex align-items-center p-3 gap-3 smol">
|
||||
<span>
|
||||
<strong class="text-black">{{c.author.post_count}}</strong>
|
||||
<span class="text-black">posts</span>
|
||||
</span>
|
||||
<span class="ml-3">
|
||||
<strong class="text-black">{{c.author.comment_count}}</strong>
|
||||
<span class="text-black">comments</span>
|
||||
</span>
|
||||
<span class="ml-3">
|
||||
<strong class="text-black">{{c.author.coins}}</strong>
|
||||
<span class="text-black">coins</span>
|
||||
</span>
|
||||
|
||||
<a {% if v %}href="{{c.author.url}}"{% else %}href="/logged_out{{c.author.url}}"{% endif %} target="_blank" class="ml-auto text-decoration-none">
|
||||
View
|
||||
<i class="fas fa-arrow-right fa-sm px-1"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% set ups=c.upvotes %}
|
||||
{% set downs=c.downvotes %}
|
||||
{% set score=ups-downs %}
|
||||
|
@ -45,7 +171,7 @@
|
|||
|
||||
|
||||
{% if render_replies %}
|
||||
{% if level<5 %}
|
||||
{% if level<10 %}
|
||||
<div id="replies-of-{{c.id}}" class="">
|
||||
{% set standalone=False %}
|
||||
{% for reply in replies %}
|
||||
|
@ -144,7 +270,109 @@
|
|||
|
||||
<div id="{% if comment_info and comment_info.id == c.id %}context{%else%}comment-{{c.id}}-only{% endif %}" class="comment-anchor relative {% if comment_info and comment_info.id == c.id %}context{%endif%}{% if c.is_banned %} banned{% endif %}{% if c.deleted_utc %} deleted{% endif %}">
|
||||
|
||||
<div class="user-info">
|
||||
|
||||
<span class="comment-collapse-icon" onclick="collapse_comment('{{c.id}}')"></span>
|
||||
|
||||
<span id="reddot-{{c.id}}"></span>
|
||||
|
||||
{% if c.awards %}
|
||||
{% for a in c.awards %}
|
||||
<i class="{{a.class_list}} px-1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{a.title}} Award given by @{{a.user.username}}"></i>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if c.post and c.post.award_count("ghosts") %}
|
||||
<span>👻</span>
|
||||
{% else %}
|
||||
<div class="flex items-center space-x-2 md:-ml-2 mb-1 text-sm text-gray-500 leading-normal">
|
||||
|
||||
<div class="relative md:hidden {{ 'santa' if c.author.patron else 'cap' }}">
|
||||
<img loading="lazy" src="{{ c.author.profile_url }}" class="w-9 h-9 p-[3px] bg-white border border-gray-300 object-cover lozad" alt="{{ c.author.username }} avatar"/>
|
||||
</div>
|
||||
|
||||
<a class="text-sm font-bold" data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="focus" data-content-id="popover-{{c.id}}" tabindex="0" style="color:#{{c.author.namecolor}};">
|
||||
{% if c.author.patron and not c.distinguish_level %}
|
||||
<span class="patron" style="background-color:#{{c.author.namecolor}};">
|
||||
{{c.author.username}}
|
||||
</span>
|
||||
{% elif c.distinguish_level and 'rama' in request.host %}
|
||||
<span class="mod" style="background-color:#{{c.author.namecolor}};">
|
||||
{{c.author.username}}
|
||||
</span>
|
||||
{% else %}
|
||||
<span>
|
||||
{{c.author.username}}
|
||||
</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
|
||||
{% if c.author.customtitle %}
|
||||
<bdi style="color: #{{c.author.titlecolor}}">
|
||||
{{c.author.customtitle | safe }}
|
||||
</bdi>
|
||||
{% endif %}
|
||||
|
||||
{% if c.author.verified %}
|
||||
<i class="fas fa-badge-check align-middle ml-1" style="color:{% if c.author.verifiedcolor %}#{{c.author.verifiedcolor}}{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{c.author.verified}}"></i>
|
||||
{% endif %}
|
||||
|
||||
{% if c.bannedfor and c.author.banned_by %}
|
||||
<a href="javascript:void(0)"><i class="fad fa-gavel text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="User was banned for this comment by @{{c.author.banned_by.username}}"></i></a>
|
||||
{% endif %}
|
||||
{% if c.active_flags %}
|
||||
<a class="btn btn-primary" style="padding:1px 5px; font-size:10px;" href="javascript:void(0)" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('hidden')">{{c.active_flags}} Reports</a>
|
||||
{% endif %}
|
||||
{% if c.over_18 %}
|
||||
<span class="badge badge-danger text-small-extra mr-1">+18</span>
|
||||
{% endif %}
|
||||
{% if v and v.admin_level==6 and c.author.shadowbanned %}
|
||||
<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Shadowbanned by @{{c.author.shadowbanned}}"></i>
|
||||
{% endif %}
|
||||
{% if c.is_pinned %}
|
||||
<i id='pinned-{{c.id}}' class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Pinned {% if c.is_pinned.startswith('t:') %}until {{c.is_pinned[2:]}}{% else %}by @{{c.is_pinned}}{%endif%}"></i>
|
||||
{% endif %}
|
||||
{% if c.distinguish_level %}
|
||||
<i class="fas fa-broom text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{'SITE_NAME' | app_config}} Admin, speaking officially"></i>
|
||||
{% endif %}
|
||||
{% if c.is_op %}
|
||||
<i class="fas fa-microphone-stand text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="OP"></i>
|
||||
{% endif %}
|
||||
{% if c.is_bot %}
|
||||
<i class="fad fa-robot text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Bot"></i>
|
||||
{% endif %}
|
||||
{% if c.is_blocking %}
|
||||
<i class="fas fa-user-minus text-warning" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="You're blocking this user, but you can see this comment because you're an admin"></i>
|
||||
{% endif %}
|
||||
{% if c.is_blocked %}
|
||||
<i class="fas fa-user-minus text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="This user is blocking you."></i>
|
||||
{% endif %}
|
||||
{% if c.parent_comment_id and not standalone and level<=7 %}
|
||||
<a href="#comment-{{ c.parent_comment_id }}-only" class="text-gray-500 hover:text-gray-400 user-name-reply">
|
||||
<i class="fas fa-reply fa-sm fa-fw fa-flip-horizontal"></i>
|
||||
<span class="hidden sm:inline-block">replying to</span>
|
||||
<span class="font-bold">
|
||||
{% if c.post and c.post.award_count("ghosts") %}
|
||||
👻
|
||||
{% else %}
|
||||
{{ c.parent_comment.author.username }}{% endif %}
|
||||
</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
<span onmouseover="timestamp('timestamp-{{c.id}}','{{c.created_utc}}')" id="timestamp-{{c.id}}" data-bs-toggle="tooltip" data-bs-placement="bottom" class="time-stamp">
|
||||
{{c.age_string}}
|
||||
</span>
|
||||
{% if c.edited_utc %}
|
||||
<span onmouseover="timestamp('time-edit-{{c.id}}','{{c.edited_utc}}')" id="time-edit-{{c.id}}" class="time-edited italic">
|
||||
Edited {{c.edited_string}}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
</div>
|
||||
{% if c.active_flags %}
|
||||
<div id="flaggers-{{c.id}}" class="flaggers hidden">
|
||||
<strong><i class="far fa-fw fa-flag"></i> Reported by:</strong>
|
||||
|
@ -178,12 +406,49 @@
|
|||
{{c.author.sig_html | safe}}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if not c.parent_submission and c.author_id!=NOTIFICATIONS_ID and c.author_id!=AUTOJANNY_ID and c.author_id!=v.id %}
|
||||
<a class="btn btn-primary" href="javascript:void(0)" onclick="document.getElementById('reply-m-{{c.id}}').classList.toggle('hidden')">Reply</a>
|
||||
<pre></pre>
|
||||
<div id="reply-m-{{c.id}}" class="hidden">
|
||||
<div id="comment-form-space-{{c.id}}" class="comment-write collapsed child">
|
||||
<form id="reply-to-message-{{c.id}}" action="/reply" method="post" class="input-group" enctype="multipart/form-data">
|
||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<textarea maxlength="10000" name="body" form="reply-to-t3_{{c.id}}" data-id="{{c.id}}" class="comment-box form-input" id="reply-form-body-{{c.id}}" aria-label="With textarea" rows="3"></textarea>
|
||||
<div class="comment-format" id="comment-format-bar-{{c.id}}">
|
||||
<label class="btn btn-secondary format d-inline-block m-0" for="gif-reply-btn-{{c.id}}">
|
||||
<i id="emoji-reply-btn-{{c.id}}" class="fas fa-smile-beam" onclick="loadEmojis('reply-form-body-{{c.id}}')" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Add Emoji"></i>
|
||||
</label>
|
||||
|
||||
<a href="javascript:void(0)" onclick="document.getElementById('reply-m-{{c.id}}').classList.add('hidden')" class="hidden d-md-block btn btn-link text-muted ml-auto cancel-form">Cancel</a>
|
||||
<a id="save-reply-to-{{c.id}}" class="hidden d-md-block btn btn-primary text-muted ml-2" onclick="post_reply('{{c.id}}');" href="javascript:void(0)">Reply</a>
|
||||
</div>
|
||||
<a href="javascript:void(0)" onclick="document.getElementById('reply-m-{{c.id}}').classList.add('hidden')" class="md:hidden btn btn-link text-muted ml-auto cancel-form">Cancel</a>
|
||||
<a id="save-reply-to-{{c.id}}" class="md:hidden btn btn-primary text-white ml-2" onclick="post_reply('{{c.id}}');" href="javascript:void(0)">Reply</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if c.parent_submission %}
|
||||
<!-- Author's edit comment form -->
|
||||
{% if v and v.id==c.author_id %}
|
||||
{% include "/comments/CommentEditForm.html" %}
|
||||
{% endif %}
|
||||
<!-- Comment actions -->
|
||||
<div id="comment-{{c.id}}-actions" class="py-3 {% if voted==1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}">
|
||||
{% include "/comments/CommentActions.html" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
<div id="reply-to-{{c.id}}" class="hidden">
|
||||
{% include "/comments/CommentReplyForm.html" %}
|
||||
</div>
|
||||
|
||||
{% if render_replies %}
|
||||
{% if level<5 %}
|
||||
{% if level<10 %}
|
||||
<div id="replies-of-{{c.id}}">
|
||||
{% for reply in replies %}
|
||||
{{single_comment(reply, level=level+1)}}
|
||||
|
@ -222,6 +487,40 @@
|
|||
|
||||
{% endfor %}
|
||||
|
||||
{% if v %}
|
||||
{% include "gif_modal.html" %}
|
||||
{% include "emoji_modal.html" %}
|
||||
{% if v.admin_level > 1 %}
|
||||
{% include "ban_modal.html" %}
|
||||
{% endif %}
|
||||
|
||||
<div class="modal fade" id="deleteCommentModal" tabindex="-1" role="dialog" aria-labelledby="deleteCommentModalTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Delete comment?</h5>
|
||||
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="far fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body text-center">
|
||||
|
||||
<div class="py-4">
|
||||
<i class="fad fa-trash-alt text-muted" style="font-size: 3.5rem;"></i>
|
||||
</div>
|
||||
|
||||
<p>Your comment will be removed everywhere on {{'SITE_NAME' | app_config}}. This action can be undone.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
|
||||
<button id="deleteCommentButton" class="btn btn-danger">Delete comment</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include "/modals/ModalReportComment.html" %}
|
||||
{% endif %}
|
||||
|
||||
<style>
|
||||
.mod:before {
|
||||
|
|
Loading…
Reference in New Issue