Made attached images clickable — no more fiddling with the spyglass pictogram. Augmented the "Enlarge" button's function to retain it.

864859dd6bb5fa53d2c0fa0c4eebeb28f4892f1f

Gness Erquint <gness.na@gmail.com>

2 files changed, +14 -4Ignore whitespace
public/scripts/chats.js+10 -4
@@ -575,8 +575,8 @@ export function isExternalMediaAllowed() {
575575 return !power_user.forbid_external_media;
576576}
577577
578578async function enlargeMessageImageexpandMessageImage(event) {
579579 const mesBlock = $(thisevent.currentTarget).closest('.mes');
580580 const mesId = mesBlock.attr('mesid');
581581 const message = chat[mesId];
582582 const imgSrc = message?.extra?.image;
@@ -620,7 +620,12 @@ async function enlargeMessageImage() {
620620 popup.completeCancelled();
621621 });
622622
623623 await popup.show();
624+ return img;
625+}
626+
627+function expandAndZoomMessageImage(event) {
628+ expandMessageImage(event).click();
624629}
625630
626631async function deleteMessageImage() {
@@ -1603,7 +1608,8 @@ jQuery(function () {
16031608 reloadCurrentChat();
16041609 });
16051610
16061611 $(document).on('click', '.mes_img_enlargemes_img.img_inline', enlargeMessageImageexpandMessageImage);
1612+ $(document).on('click', '.mes_img_enlarge', expandAndZoomMessageImage);
16071613 $(document).on('click', '.mes_img_delete', deleteMessageImage);
16081614
16091615 $('#file_form_input').on('change', async () => {
public/style.css+4 -0
@@ -4990,6 +4990,10 @@ a:hover {
49904990 padding: 0.5rem;
49914991}
49924992
4993+.mes_img.img_inline {
4994+ cursor: pointer;
4995+}
4996+
49934997.mes_img {
49944998 border-radius: 10px;
49954999 max-width: 100%;