forked from rDrama/rDrama
allow ppl to click on the reply icon again to hide the reply box
parent
46786e117b
commit
29a2bc0123
|
@ -62,9 +62,13 @@ function getSelectionTextHtml() {
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function openReplyBox(id) {
|
function ToggleReplyBox(id) {
|
||||||
const element = document.getElementById(id);
|
const element = document.getElementById(id);
|
||||||
const textarea = element.getElementsByTagName('textarea')[0]
|
const textarea = element.getElementsByTagName('textarea')[0]
|
||||||
|
element.classList.toggle('d-none')
|
||||||
|
|
||||||
|
if (!element.classList.contains('d-none'))
|
||||||
|
{
|
||||||
let text = getSelection().toString().trim()
|
let text = getSelection().toString().trim()
|
||||||
if (text)
|
if (text)
|
||||||
{
|
{
|
||||||
|
@ -72,9 +76,9 @@ function openReplyBox(id) {
|
||||||
textarea.value = textarea.value.replace(/\n/g,"\n> ").replace(/\*/g,"\\*")
|
textarea.value = textarea.value.replace(/\n/g,"\n> ").replace(/\*/g,"\\*")
|
||||||
if (!textarea.value.endsWith('\n')) textarea.value += '\n'
|
if (!textarea.value.endsWith('\n')) textarea.value += '\n'
|
||||||
}
|
}
|
||||||
element.classList.remove('d-none')
|
|
||||||
textarea.focus()
|
textarea.focus()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function toggleEdit(id){
|
function toggleEdit(id){
|
||||||
comment=document.getElementById("comment-text-"+id);
|
comment=document.getElementById("comment-text-"+id);
|
||||||
|
|
|
@ -352,7 +352,7 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<a class="list-inline-item mr-3" role="button" onclick="openReplyBox('reply-to-{{c.id}}')"><i class="fas fa-reply" style="margin-top:0.35rem"></i></a>
|
<a class="list-inline-item mr-3" role="button" onclick="ToggleReplyBox('reply-to-{{c.id}}')"><i class="fas fa-reply" style="margin-top:0.35rem"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<li class="list-inline-item">
|
<li class="list-inline-item">
|
||||||
|
@ -449,7 +449,7 @@
|
||||||
<button class="btn caction py-0 nobackground px-1 text-muted copy-link" data-clipboard-text="{% if SITE == 'rdrama.net' %}https://rdrama.co{{c.shortlink}}{% else %}{{c.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</button>
|
<button class="btn caction py-0 nobackground px-1 text-muted copy-link" data-clipboard-text="{% if SITE == 'rdrama.net' %}https://rdrama.co{{c.shortlink}}{% else %}{{c.permalink}}{% endif %}"><i class="fas fa-copy"></i>Copy link</button>
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<button class="btn caction py-0 nobackground px-1 text-muted" role="button" onclick="openReplyBox('reply-to-{{c.id}}')"><i class="fas fa-reply" aria-hidden="true"></i>Reply</button>
|
<button class="btn caction py-0 nobackground px-1 text-muted" role="button" onclick="ToggleReplyBox('reply-to-{{c.id}}')"><i class="fas fa-reply" aria-hidden="true"></i>Reply</button>
|
||||||
|
|
||||||
<button class="btn caction py-0 nobackground px-1 text-muted" data-bs-toggle="modal" data-bs-target="#reportCommentModal" onclick="report_commentModal('{{c.id}}','{{c.author_name}}',)"><i class="fas fa-flag fa-fw"></i>Report</button>
|
<button class="btn caction py-0 nobackground px-1 text-muted" data-bs-toggle="modal" data-bs-target="#reportCommentModal" onclick="report_commentModal('{{c.id}}','{{c.author_name}}',)"><i class="fas fa-flag fa-fw"></i>Report</button>
|
||||||
|
|
||||||
|
@ -611,7 +611,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if request.path.startswith('/notifications') and c.level == 1 and c.sentto and not c.parent_submission and c.author_id != AUTOJANNY_ID %}
|
{% if request.path.startswith('/notifications') and c.level == 1 and c.sentto and not c.parent_submission and c.author_id != AUTOJANNY_ID %}
|
||||||
<a class="btn btn-primary mt-2" role="button" onclick="openReplyBox('reply-message-{{c.id}}')">Reply</a>
|
<a class="btn btn-primary mt-2" role="button" onclick="ToggleReplyBox('reply-message-{{c.id}}')">Reply</a>
|
||||||
<div id="reply-message-{{c.id}}" class="d-none">
|
<div id="reply-message-{{c.id}}" class="d-none">
|
||||||
<div id="comment-form-space-{{c.id}}" class="comment-write collapsed child">
|
<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">
|
<form id="reply-to-message-{{c.id}}" action="/reply" method="post" class="input-group" enctype="multipart/form-data">
|
||||||
|
@ -864,7 +864,7 @@
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<script src="{{asset('js/marked.js')}}"></script>
|
<script src="{{asset('js/marked.js')}}"></script>
|
||||||
<script src="/assets/js/comments_v.js?v=284"></script>
|
<script src="/assets/js/comments_v.js?v=285"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script src="/assets/js/clipboard.js?v=250"></script>
|
<script src="/assets/js/clipboard.js?v=250"></script>
|
||||||
|
|
Loading…
Reference in New Issue