diff options
| author | shpuld <shp@cock.li> | 2019-01-14 19:23:13 +0200 |
|---|---|---|
| committer | shpuld <shp@cock.li> | 2019-01-14 19:23:13 +0200 |
| commit | 17735943d5cdde1eb852d36f1c3bb699d23f7eb6 (patch) | |
| tree | d5a6b7f8d8c3512a6f262371f0038a2adb311288 /src/components/attachment/attachment.js | |
| parent | a51167fa72a64505080c9aea47b5d3bc97a529b0 (diff) | |
Add media viewer module and media module component, modify attachment behavior
Diffstat (limited to 'src/components/attachment/attachment.js')
| -rw-r--r-- | src/components/attachment/attachment.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index 97c4f283..5e672ef2 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -7,7 +7,8 @@ const Attachment = { 'attachment', 'nsfw', 'statusId', - 'size' + 'size', + 'setMedia' ], data () { return { @@ -17,13 +18,17 @@ const Attachment = { loopVideo: this.$store.state.config.loopVideo, showHidden: false, loading: false, - img: fileTypeService.fileType(this.attachment.mimetype) === 'image' && document.createElement('img') + img: fileTypeService.fileType(this.attachment.mimetype) === 'image' && document.createElement('img'), + modalOpen: false } }, components: { StillImage }, computed: { + usePlaceHolder () { + return this.size === 'hide' || this.type === 'unknown' + }, type () { return fileTypeService.fileType(this.attachment.mimetype) }, @@ -37,7 +42,7 @@ const Attachment = { return this.size === 'small' }, fullwidth () { - return fileTypeService.fileType(this.attachment.mimetype) === 'html' + return this.type === 'html' || this.type === 'audio' } }, methods: { @@ -62,6 +67,14 @@ const Attachment = { this.showHidden = !this.showHidden } }, + toggleModal (event) { + if (this.type !== 'image' && this.type !== 'video') { + return + } + event.preventDefault() + this.setMedia() + this.$store.dispatch('setCurrent', this.attachment) + }, onVideoDataLoad (e) { if (typeof e.srcElement.webkitAudioDecodedByteCount !== 'undefined') { // non-zero if video has audio track |
