diff --git a/routes/_components/status/Media.html b/routes/_components/status/Media.html index 027e334f..dd3ef3f9 100644 --- a/routes/_components/status/Media.html +++ b/routes/_components/status/Media.html @@ -2,7 +2,7 @@ @@ -20,7 +20,7 @@ @@ -107,8 +107,21 @@ import { ONE_TRANSPARENT_PIXEL } from '../../_static/media' import { store } from '../../_store/store' import LazyImage from '../LazyImage.html' + import { registerClickDelegate, unregisterClickDelegate } from '../../_utils/delegate' export default { + oncreate() { + registerClickDelegate(this.get('delegateKey'), () => { + if (this.get('media').type === 'video') { + this.onClickPlayVideoButton() + } else { + this.onClickShowImageButton() + } + }) + }, + ondestroy() { + unregisterClickDelegate(this.get('delegateKey')) + }, computed: { // width/height to show inline inlineWidth: smallWidth => smallWidth || DEFAULT_MEDIA_WIDTH, @@ -123,7 +136,8 @@ smallHeight: small => small && small.height, originalWidth: original => original && original.width, originalHeight: original => original && original.height, - noNativeWidthHeight: (smallWidth, smallHeight) => typeof smallWidth !== 'number' || typeof smallHeight !== 'number' + noNativeWidthHeight: (smallWidth, smallHeight) => typeof smallWidth !== 'number' || typeof smallHeight !== 'number', + delegateKey: (media) => `media-${media.id}` }, methods: { async onClickPlayVideoButton() { diff --git a/routes/_components/status/Status.html b/routes/_components/status/Status.html index 01c10dd4..be6e3bfa 100644 --- a/routes/_components/status/Status.html +++ b/routes/_components/status/Status.html @@ -1,7 +1,7 @@ {{#if originalStatus.spoiler_text}} + on:recalculateHeight /> {{/if}} {{#if !originalStatus.spoiler_text || spoilerShown}} {{/if}} {{#if originalStatus.media_attachments && originalStatus.media_attachments.length}} - + {{/if}} {{#if isStatusInOwnThread}} {{/if}} - +