From 485a061287149fe0ff5c4a188d21d775ff271f6d Mon Sep 17 00:00:00 2001 From: shpuld Date: Sun, 20 Jan 2019 12:46:11 +0200 Subject: Polish for videos, smaller sizes, remove gif-looping options --- src/assets/nsfw.png | Bin 17071 -> 39603 bytes src/components/attachment/attachment.js | 39 +---------------- src/components/attachment/attachment.vue | 67 ++++++++++++++++++++--------- src/components/media_modal/media_modal.js | 28 ++---------- src/components/media_modal/media_modal.vue | 1 - src/components/settings/settings.js | 13 +----- src/components/settings/settings.vue | 9 ---- 7 files changed, 52 insertions(+), 105 deletions(-) (limited to 'src') diff --git a/src/assets/nsfw.png b/src/assets/nsfw.png index 42749033..972bcb4c 100644 Binary files a/src/assets/nsfw.png and b/src/assets/nsfw.png differ diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index 5e672ef2..2698fb67 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -15,10 +15,7 @@ const Attachment = { nsfwImage: this.$store.state.config.nsfwCensorImage || nsfwImage, hideNsfwLocal: this.$store.state.config.hideNsfw, preloadImage: this.$store.state.config.preloadImage, - loopVideo: this.$store.state.config.loopVideo, - showHidden: false, loading: false, - img: fileTypeService.fileType(this.attachment.mimetype) === 'image' && document.createElement('img'), modalOpen: false } }, @@ -33,7 +30,7 @@ const Attachment = { return fileTypeService.fileType(this.attachment.mimetype) }, hidden () { - return this.nsfw && this.hideNsfwLocal && !this.showHidden + return this.nsfw && this.hideNsfwLocal }, isEmpty () { return (this.type === 'html' && !this.attachment.oembed) || this.type === 'unknown' @@ -51,46 +48,14 @@ const Attachment = { window.open(target.href, '_blank') } }, - toggleHidden () { - if (this.img && !this.preloadImage) { - if (this.img.onload) { - this.img.onload() - } else { - this.loading = true - this.img.src = this.attachment.url - this.img.onload = () => { - this.loading = false - this.showHidden = !this.showHidden - } - } - } else { - this.showHidden = !this.showHidden - } - }, toggleModal (event) { if (this.type !== 'image' && this.type !== 'video') { return } + event.stopPropagation() 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 - if (e.srcElement.webkitAudioDecodedByteCount > 0) { - this.loopVideo = this.loopVideo && !this.$store.state.config.loopVideoSilentOnly - } - } else if (typeof e.srcElement.mozHasAudio !== 'undefined') { - // true if video has audio track - if (e.srcElement.mozHasAudio) { - this.loopVideo = this.loopVideo && !this.$store.state.config.loopVideoSilentOnly - } - } else if (typeof e.srcElement.audioTracks !== 'undefined') { - if (e.srcElement.audioTracks.length > 0) { - this.loopVideo = this.loopVideo && !this.$store.state.config.loopVideoSilentOnly - } - } } } } diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index 1c6b84df..74993fd9 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -4,16 +4,15 @@
- - + + + -
- Hide -
+ - + + + + @@ -44,13 +50,17 @@