From 0030858521fc9c076220d3462c1afca8211122c5 Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 3 Aug 2023 10:33:57 +0300 Subject: [PATCH] change "quote selection" to "reply" when we're done --- files/assets/js/comments_v.js | 26 +++++++++++++++++++++++--- files/templates/comments.html | 10 +++++----- files/templates/util/macros.html | 2 +- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index 240946658..638b6f4ec 100644 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -164,14 +164,14 @@ function post_reply(id) { ta.value = '' document.getElementById('message-reply-'+id).innerHTML = '' - document.getElementById('reply-message-c_'+id).classList.add('d-none') + document.getElementById('reply-to-c_'+id).classList.add('d-none') const input = ta.parentElement.querySelector('input[type="file"]') input.previousElementSibling.innerHTML = ''; input.value = null; oldfiles[ta.id] = [] - remove_dialog(); + restore_reply_buttons(`c_${id}`) } else { showToast(false, getMessageFromJsonData(false, data)); } @@ -298,7 +298,7 @@ function post_comment(fullname, hide){ const ghost_town_box = document.getElementById('ghost-town-box') if (ghost_town_box) ghost_town_box.remove() - remove_dialog(); + restore_reply_buttons(fullname) } else { showToast(false, getMessageFromJsonData(false, data)); @@ -347,3 +347,23 @@ function handle_action(type, cid, thing) { } xhr.send(form) } + +function restore_reply_buttons(fullname) { + const reply_buttons = [document.getElementById(`toggle-reply-${fullname}`)] + const mobile_reply_button = document.getElementById(`toggle-reply-${fullname}-mobile`) + if (mobile_reply_button) reply_buttons.push(mobile_reply_button) + for (const t of reply_buttons) { + let newHTML = '' + if (t.innerHTML.includes('' + if (t.innerText) + newHTML += 'Reply' + t.innerHTML = newHTML + } + remove_dialog(); +} + +function cancel(fullname) { + document.getElementById(`reply-to-${fullname}`).classList.add('d-none') + restore_reply_buttons(fullname) +} diff --git a/files/templates/comments.html b/files/templates/comments.html index f746aa67a..e0220b71f 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -303,7 +303,7 @@ {% if v and not c.deleted_utc %} - + {% endif %}
  • @@ -394,7 +394,7 @@ {% if v %} {% if not c.deleted_utc %} - + {% endif %} @@ -541,9 +541,9 @@ {% endif %} - + -
    +