diff --git a/files/assets/CHRISTMAS/js/default.js b/files/assets/CHRISTMAS/js/default.js index ad73b9fec..a9568a776 100644 --- a/files/assets/CHRISTMAS/js/default.js +++ b/files/assets/CHRISTMAS/js/default.js @@ -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-link").href = image; document.getElementById("desktop-expanded-image-wrap-link").href=image; -}; \ No newline at end of file +}; + +// 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 \ No newline at end of file diff --git a/files/assets/CHRISTMAS/js/popover.js b/files/assets/CHRISTMAS/js/popover.js index 509d11cea..1667977ae 100644 --- a/files/assets/CHRISTMAS/js/popover.js +++ b/files/assets/CHRISTMAS/js/popover.js @@ -15,7 +15,6 @@ function popovertrigger() { popovertrigger() function userPopover(author) { - console.log(author) let popfix = document.getElementById("popover-fix") if (popfix) document.body.removeChild(popfix); @@ -47,6 +46,12 @@ function userPopover(author) { document.body.appendChild(popover_new); 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(){ diff --git a/files/templates/CHRISTMAS/ProfilePopover.html b/files/templates/CHRISTMAS/ProfilePopover.html index e4fbb9dfb..be35dfd2f 100644 --- a/files/templates/CHRISTMAS/ProfilePopover.html +++ b/files/templates/CHRISTMAS/ProfilePopover.html @@ -45,7 +45,7 @@ - + Message diff --git a/files/templates/CHRISTMAS/default.html b/files/templates/CHRISTMAS/default.html index c1fbc2726..596c2b10b 100644 --- a/files/templates/CHRISTMAS/default.html +++ b/files/templates/CHRISTMAS/default.html @@ -297,7 +297,6 @@ {% if v %} {% include "CHRISTMAS/modals/ModalThemePicker.html" %} {% include "CHRISTMAS/modals/ModalDirectMessage.html" %} - {% include "CHRISTMAS/modals/ModalGiftCoins.html" %} {% endif %} {% block popovers %}{% endblock %} @@ -336,7 +335,7 @@ - + @@ -358,7 +357,7 @@ } {% endif %} - + diff --git a/files/templates/CHRISTMAS/modals/ModalDirectMessage.html b/files/templates/CHRISTMAS/modals/ModalDirectMessage.html index 423e82a70..77b9fb055 100644 --- a/files/templates/CHRISTMAS/modals/ModalDirectMessage.html +++ b/files/templates/CHRISTMAS/modals/ModalDirectMessage.html @@ -2,29 +2,29 @@