Merge pull request #3793 from Erquint/staging Clickable image attachments — no more fiddling with the spyglass button.

0a521d7a35aa7731f939a1f38438cefce40aa6b5

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
2 files changed, +11 -4Showing whitespace changes
public/scripts/chats.js+10 -4
@@ -575,8 +575,8 @@ export function isExternalMediaAllowed() {
575 return !power_user.forbid_external_media;575 return !power_user.forbid_external_media;
576}576}
577577
578async function enlargeMessageImage() {578function expandMessageImage(event) {
579 const mesBlock = $(this).closest('.mes');579 const mesBlock = $(event.currentTarget).closest('.mes');
580 const mesId = mesBlock.attr('mesid');580 const mesId = mesBlock.attr('mesid');
581 const message = chat[mesId];581 const message = chat[mesId];
582 const imgSrc = message?.extra?.image;582 const imgSrc = message?.extra?.image;
@@ -620,7 +620,12 @@ async function enlargeMessageImage() {
620 popup.completeCancelled();620 popup.completeCancelled();
621 });621 });
622622
623 await popup.show();623 popup.show();
624 return img;
625}
626
627function expandAndZoomMessageImage(event) {
628 expandMessageImage(event).click();
624}629}
625630
626async function deleteMessageImage() {631async function deleteMessageImage() {
@@ -1603,7 +1608,8 @@ jQuery(function () {
1603 reloadCurrentChat();1608 reloadCurrentChat();
1604 });1609 });
16051610
1606 $(document).on('click', '.mes_img_enlarge', enlargeMessageImage);1611 $(document).on('click', '.mes_img', expandMessageImage);
1612 $(document).on('click', '.mes_img_enlarge', expandAndZoomMessageImage);
1607 $(document).on('click', '.mes_img_delete', deleteMessageImage);1613 $(document).on('click', '.mes_img_delete', deleteMessageImage);
16081614
1609 $('#file_form_input').on('change', async () => {1615 $('#file_form_input').on('change', async () => {
public/style.css+1 -0
@@ -4995,6 +4995,7 @@ a:hover {
4995 max-width: 100%;4995 max-width: 100%;
4996 max-height: 40vh;4996 max-height: 40vh;
4997 image-rendering: -webkit-optimize-contrast;4997 image-rendering: -webkit-optimize-contrast;
4998 cursor: pointer;
4998}4999}
49995000
5000.mes_img_swipes,5001.mes_img_swipes,