change the "reply" button to "quote selection" button when clicked to clue ppl in of this feature

pull/175/head
Aevann 2023-08-02 10:43:38 +03:00
parent 7618b5e1b9
commit e08003d7b4
3 changed files with 13 additions and 4 deletions

View File

@ -208,6 +208,7 @@
.fa-shield-virus:before{content:"\e06c"}
.fa-at:before{content:"\40"}
.fa-ankh:before{content:"\f644"}
.fa-quotes:before{content:"\e234"}
button {
background: none;

View File

@ -51,7 +51,7 @@ function getSelectionTextHtml() {
return html;
}
function toggleReplyBox(id) {
function toggleReplyBox(t, id) {
const element = document.getElementById(id);
const ta = element.getElementsByTagName('textarea')[0]
element.classList.remove('d-none')
@ -72,6 +72,14 @@ function toggleReplyBox(id) {
ta.focus()
autoExpand(ta);
let newHTML = ''
if (t.innerHTML.includes('<i class="fas fa-'))
newHTML += '<i class="fas fa-quotes"></i>'
if (t.innerText)
newHTML += 'Quote selection'
t.innerHTML = newHTML
}
function toggleEdit(id){

View File

@ -303,7 +303,7 @@
</li>
{% if v and not c.deleted_utc %}
<button type="button" class="list-inline-item mr-3 btn nobackground" data-nonce="{{g.nonce}}" data-onclick="toggleReplyBox('reply-to-{{c.fullname}}')"><i class="fas fa-reply" style="margin-top:0.35rem"></i></button>
<button type="button" class="list-inline-item mr-3 btn nobackground" data-nonce="{{g.nonce}}" data-onclick="toggleReplyBox(this, 'reply-to-{{c.fullname}}')"><i class="fas fa-reply"></i></button>
{% endif %}
<li class="list-inline-item">
@ -394,7 +394,7 @@
{% if v %}
{% if not c.deleted_utc %}
<button type="button" class="btn caction py-0 nobackground px-1 text-muted" data-nonce="{{g.nonce}}" data-onclick="toggleReplyBox('reply-to-{{c.fullname}}')"><i class="fas fa-reply"></i>Reply</button>
<button type="button" class="btn caction py-0 nobackground px-1 text-muted" data-nonce="{{g.nonce}}" data-onclick="toggleReplyBox(this, 'reply-to-{{c.fullname}}')"><i class="fas fa-reply"></i>Reply</button>
{% endif %}
<button type="button" class="btn caction py-0 nobackground px-1 text-muted" data-bs-toggle="modal" data-bs-target="#reportCommentModal" data-nonce="{{g.nonce}}" data-onclick="report_commentModal('{{c.id}}','{{c.author_name}}',)"><i class="fas fa-flag fa-fw"></i>Report</button>
@ -541,7 +541,7 @@
<button type="button" class="btn btn-primary mt-2 mr-3 {% if not c.author.is_muted %}d-none{% endif %}" id="unmute-user-{{c.id}}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/unmute_user/{{c.author.id}}','mute-user-{{c.id}}','unmute-user-{{c.id}}','d-none')">Unmute</button>
{% endif %}
<button type="button" class="btn btn-primary nobackground mt-2" data-nonce="{{g.nonce}}" data-onclick="toggleReplyBox('reply-message-{{c.fullname}}')">Reply</button>
<button type="button" class="btn btn-primary nobackground mt-2" data-nonce="{{g.nonce}}" data-onclick="toggleReplyBox(this, 'reply-message-{{c.fullname}}')">Reply</button>
<div id="reply-message-{{c.fullname}}" class="d-none">
<div id="comment-form-space-{{c.id}}" class="comment-write collapsed child">