Animate recaption image

4828bd95f31a5d874609bb8f9be24d156331b31d

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

1 files changed, +5 -0Showing whitespace changes
public/scripts/extensions/caption/index.js+5 -0
@@ -515,12 +515,17 @@ jQuery(async function () {
515515 eventSource.on(event_types.MESSAGE_FILE_EMBEDDED, onMessageEvent);
516516
517517 $(document).on('click', '.mes_img_caption', async function () {
518+ const animationClass = 'fa-fade';
518519 const messageBlock = $(this).closest('.mes');
520+ const messageImg = messageBlock.find('.mes_img');
521+ if (messageImg.hasClass(animationClass)) return;
522+ messageImg.addClass(animationClass);
519523 const index = Number(messageBlock.attr('mesid'));
520524 const data = getContext().chat[index];
521525 await captionExistingMessage(data);
522526 appendMediaToMessage(data, messageBlock, false);
523527 await saveChatConditional();
528+ messageImg.removeClass(animationClass);
524529 });
525530
526531 SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'caption',