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/components/settings/settings.vue | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/components/settings/settings.vue') diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue index 39125009..e84bd3f6 100644 --- a/src/components/settings/settings.vue +++ b/src/components/settings/settings.vue @@ -131,15 +131,6 @@
  • -
  • -- cgit v1.2.3-70-g09d2 From 3978aaef84cc023908155343af76983f2715cf90 Mon Sep 17 00:00:00 2001 From: shpuld Date: Sat, 26 Jan 2019 17:45:03 +0200 Subject: Redo everything in the MR --- src/App.scss | 8 +- src/assets/nsfw.png | Bin 39603 -> 35104 bytes src/components/attachment/attachment.js | 47 +++++- src/components/attachment/attachment.vue | 94 ++++++----- src/components/gallery/gallery.js | 55 +++++++ src/components/gallery/gallery.vue | 60 +++++++ src/components/media_modal/media_modal.js | 7 +- src/components/media_modal/media_modal.vue | 13 +- src/components/registration/registration.vue | 2 +- src/components/settings/settings.js | 25 ++- src/components/settings/settings.vue | 21 +++ src/components/status/status.js | 25 ++- src/components/status/status.vue | 21 ++- .../video_attachment/video_attachment.js | 31 ++++ .../video_attachment/video_attachment.vue | 11 ++ src/i18n/en.json | 3 + src/i18n/fi.json | 182 ++++++++++++++++++++- src/services/file_type/file_type.service.js | 31 ++-- .../specs/services/file_type/file_type.spec.js | 19 +++ 19 files changed, 563 insertions(+), 92 deletions(-) create mode 100644 src/components/gallery/gallery.js create mode 100644 src/components/gallery/gallery.vue create mode 100644 src/components/video_attachment/video_attachment.js create mode 100644 src/components/video_attachment/video_attachment.vue create mode 100644 test/unit/specs/services/file_type/file_type.spec.js (limited to 'src/components/settings/settings.vue') diff --git a/src/App.scss b/src/App.scss index ed06bbbc..425c8e01 100644 --- a/src/App.scss +++ b/src/App.scss @@ -499,7 +499,7 @@ nav { } .main { - flex-basis: 60%; + flex-basis: 50%; flex-grow: 1; flex-shrink: 1; } @@ -533,7 +533,7 @@ nav { } } -@media all and (min-width: 960px) { +@media all and (min-width: 800px) { body { overflow-y: scroll; } @@ -617,7 +617,7 @@ nav { color: $fallback--faint; color: var(--faint, $fallback--faint); } -@media all and (min-width: 959px) { +@media all and (min-width: 800px) { .logo { opacity: 1 !important; } @@ -654,7 +654,7 @@ nav { border-radius: var(--inputRadius, $fallback--inputRadius); } -@media all and (max-width: 959px) { +@media all and (max-width: 800px) { .mobile-hidden { display: none; } diff --git a/src/assets/nsfw.png b/src/assets/nsfw.png index 972bcb4c..d2513776 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 d16e5086..0ae8f71a 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -1,4 +1,5 @@ import StillImage from '../still-image/still-image.vue' +import VideoAttachment from '../video_attachment/video_attachment.vue' import nsfwImage from '../../assets/nsfw.png' import fileTypeService from '../../services/file_type/file_type.service.js' @@ -8,6 +9,7 @@ const Attachment = { 'nsfw', 'statusId', 'size', + 'allowPlay', 'setMedia' ], data () { @@ -16,11 +18,14 @@ const Attachment = { hideNsfwLocal: this.$store.state.config.hideNsfw, preloadImage: this.$store.state.config.preloadImage, loading: false, - modalOpen: false + img: fileTypeService.fileType(this.attachment.mimetype) === 'image' && document.createElement('img'), + modalOpen: false, + showHidden: false } }, components: { - StillImage + StillImage, + VideoAttachment }, computed: { usePlaceHolder () { @@ -33,7 +38,7 @@ const Attachment = { return fileTypeService.fileType(this.attachment.mimetype) }, hidden () { - return this.nsfw && this.hideNsfwLocal + return this.nsfw && this.hideNsfwLocal && !this.showHidden }, isEmpty () { return (this.type === 'html' && !this.attachment.oembed) || this.type === 'unknown' @@ -51,14 +56,38 @@ const Attachment = { window.open(target.href, '_blank') } }, - toggleModal (event) { - if (this.type !== 'image' && this.type !== 'video') { + openModal (event) { + const modalTypes = this.$store.state.config.playVideosInline + ? ['image'] + : ['image', 'video'] + if (fileTypeService.fileMatchesSomeType(modalTypes, this.attachment) || + this.usePlaceHolder + ) { + event.stopPropagation() + event.preventDefault() + this.setMedia() + this.$store.dispatch('setCurrent', this.attachment) + } + }, + toggleHidden (event) { + if (this.$store.state.config.useOneClickNsfw && !this.showHidden) { + this.openModal(event) return } - event.stopPropagation() - event.preventDefault() - this.setMedia() - this.$store.dispatch('setCurrent', this.attachment) + 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 + } } } } diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index ad5120c0..56a49d2d 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -1,34 +1,43 @@