This commit is contained in:
kek7198 2022-01-02 21:02:21 -06:00
parent 1746565f2c
commit baca218d5e
6 changed files with 34 additions and 12 deletions

View file

@ -203,4 +203,21 @@ function expandDesktopImage(image) {
document.getElementById("desktop-expanded-image").src = image.replace("200w_d.webp", "giphy.webp"); document.getElementById("desktop-expanded-image").src = image.replace("200w_d.webp", "giphy.webp");
document.getElementById("desktop-expanded-image-link").href = image; document.getElementById("desktop-expanded-image-link").href = image;
document.getElementById("desktop-expanded-image-wrap-link").href=image; document.getElementById("desktop-expanded-image-wrap-link").href=image;
}; };
// Send Direct Message
const messageModal = document.getElementById('directMessageModal')
messageModal.addEventListener('show.bs.modal', function (event) {
// Button that triggered the modal
const button = event.relatedTarget
// Extract info from data-bs-* attributes
const recipient = button.getAttribute('data-bs-recipient')
// Update the modal's content.
const modalTitle = messageModal.querySelector('.modal-title')
//
messageModal.querySelector('form').action = `/@${recipient}/message`
modalTitle.textContent = 'New message to ' + recipient
})
// Send coins

View file

@ -15,7 +15,6 @@ function popovertrigger() {
popovertrigger() popovertrigger()
function userPopover(author) { function userPopover(author) {
console.log(author)
let popfix = document.getElementById("popover-fix") let popfix = document.getElementById("popover-fix")
if (popfix) document.body.removeChild(popfix); if (popfix) document.body.removeChild(popfix);
@ -47,6 +46,12 @@ function userPopover(author) {
document.body.appendChild(popover_new); document.body.appendChild(popover_new);
document.body.removeChild(popover_old); document.body.removeChild(popover_old);
} }
// Button and modal for sending direct messages
const messageModal = document.getElementById('directMessageModal');
const messageButton = document.getElementById('popoverMessageButton');
// Pass our author (the recipient) to the button
messageButton.dataset.bsRecipient = author["username"];
} }
document.addEventListener("click", function(){ document.addEventListener("click", function(){

View file

@ -45,7 +45,7 @@
<a href="#" class="btn btn-gray" data-bs-toggle="modal" data-bs-target="#giftCoinsModal"> <a href="#" class="btn btn-gray" data-bs-toggle="modal" data-bs-target="#giftCoinsModal">
<i class="fas fa-gift fa-fw fa-sm"></i> <i class="fas fa-gift fa-fw fa-sm"></i>
</a> </a>
<a href="#" class="btn btn-gray" data-bs-toggle="modal" data-bs-target="#directMessageModal"> <a id="popoverMessageButton" href="#" class="btn btn-gray" data-bs-toggle="modal" data-bs-target="#directMessageModal" data-bs-recipient="">
<i class="fas fa-paper-plane fa-fw fa-sm mr-2"></i> <i class="fas fa-paper-plane fa-fw fa-sm mr-2"></i>
Message Message
</a> </a>

View file

@ -297,7 +297,6 @@
{% if v %} {% if v %}
{% include "CHRISTMAS/modals/ModalThemePicker.html" %} {% include "CHRISTMAS/modals/ModalThemePicker.html" %}
{% include "CHRISTMAS/modals/ModalDirectMessage.html" %} {% include "CHRISTMAS/modals/ModalDirectMessage.html" %}
{% include "CHRISTMAS/modals/ModalGiftCoins.html" %}
{% endif %} {% endif %}
{% block popovers %}{% endblock %} {% block popovers %}{% endblock %}
@ -336,7 +335,7 @@
<script src="/static/assets/CHRISTMAS/js/gif_modal.js?a=1"></script> <script src="/static/assets/CHRISTMAS/js/gif_modal.js?a=1"></script>
<script src="/static/assets/CHRISTMAS/js/emoji_modal.js?a=16"></script> <script src="/static/assets/CHRISTMAS/js/emoji_modal.js?a=16"></script>
<script defer src="/static/assets/CHRISTMAS/js/popover.js?a=21"></script> <script defer src="/static/assets/CHRISTMAS/js/popover.js?a=22"></script>
<script src="/static/assets/CHRISTMAS/js/mobile_navigation_bar.js?a=1"></script> <script src="/static/assets/CHRISTMAS/js/mobile_navigation_bar.js?a=1"></script>
@ -358,7 +357,7 @@
} }
</script> </script>
{% endif %} {% endif %}
<script src="/static/assets/CHRISTMAS/js/default.js?a=2"></script> <script src="/static/assets/CHRISTMAS/js/default.js?a=3"></script>
</body> </body>
</html> </html>

View file

@ -2,29 +2,29 @@
<div class="modal-dialog modal-dialog-centered mx-auto max-w-xl" role="document"> <div class="modal-dialog modal-dialog-centered mx-auto max-w-xl" role="document">
<div class="modal-content mx-auto max-w-xl bg-gray-100 dark:bg-gray-700 rounded-md shadow-lg"> <div class="modal-content mx-auto max-w-xl bg-gray-100 dark:bg-gray-700 rounded-md shadow-lg">
<div class="modal-header"> <div class="modal-header">
<h5 class="font-bold text-xl font-heading leading-normal">Send message to @{{u.username}}</h5> <h5 class="modal-title font-bold text-xl font-heading leading-normal">Send message</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="far fa-times"></i></span> <span aria-hidden="true"><i class="far fa-times"></i></span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="message" action="/@{{u.username}}/message" method="post" enctype="multipart/form-data"> <form id="message" action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="formkey" value="{{v.formkey}}"> <input type="hidden" name="formkey" value="{{v.formkey}}">
<div class="relative rounded border border-gray-300 dark:border-gray-900 bg-white dark:bg-white/[.05] w-full"> <div class="relative rounded border border-gray-300 dark:border-gray-900 bg-white dark:bg-white/[.05] w-full">
<textarea maxlength="1000" id="input-message" name="message" form="message" class="rounded-t bg-transparent p-2 shadow-inner w-full" aria-label="With textarea" placeholder="Write your message..." rows="3"></textarea> <textarea maxlength="1000" id="direct-message-input" name="message" form="message" class="rounded-t bg-transparent p-2 shadow-inner w-full" aria-label="With textarea" placeholder="Write your message..." rows="3"></textarea>
<ul class="-mt-1 flex space-x-4 px-3 py-2 border-t border-dashed border-gray-300 dark:border-white/[.05] mb-0"> <ul class="-mt-1 flex space-x-4 px-3 py-2 border-t border-dashed border-gray-300 dark:border-white/[.05] mb-0">
<li> <li>
<button type="button" class="text-gray-400 hover:text-gray-500" onclick="makeBold('input-message')"> <button type="button" class="text-gray-400 hover:text-gray-500" onclick="makeBold('direct-message-input')">
<i class="fas fa-bold fa-fw fa-sm" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Bold"></i> <i class="fas fa-bold fa-fw fa-sm" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Bold"></i>
</button> </button>
</li> </li>
<li> <li>
<button type="button" class="text-gray-400 hover:text-gray-500" onclick="makeItalics('input-message')"> <button type="button" class="text-gray-400 hover:text-gray-500" onclick="makeItalics('direct-message-input')">
<i class="fas fa-italic fa-fw fa-sm" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Italicize"></i> <i class="fas fa-italic fa-fw fa-sm" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Italicize"></i>
</button> </button>
</li> </li>
<li> <li>
<button type="button" class="text-gray-400 hover:text-gray-500" onclick="makeQuote('input-message')"> <button type="button" class="text-gray-400 hover:text-gray-500" onclick="makeQuote('direct-message-input')">
<i class="fas fa-quote-right fa-fw fa-sm" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Quote"></i> <i class="fas fa-quote-right fa-fw fa-sm" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Quote"></i>
</button> </button>
</li> </li>

View file

@ -396,6 +396,7 @@
{% if v %} {% if v %}
{% include "CHRISTMAS/emoji_modal.html" %} {% include "CHRISTMAS/emoji_modal.html" %}
{% include "CHRISTMAS/gif_modal.html" %} {% include "CHRISTMAS/gif_modal.html" %}
{% include "CHRISTMAS/modals/ModalGiftCoins.html" %}
{% if v.admin_level > 1 %} {% if v.admin_level > 1 %}
{% include "CHRISTMAS/modals/ModalAdminManageUser.html" %} {% include "CHRISTMAS/modals/ModalAdminManageUser.html" %}
{% endif %} {% endif %}