From 7b4e08dd93520e3dc1113d76e097b998d12b0f3c Mon Sep 17 00:00:00 2001 From: ValD Date: Wed, 12 Dec 2018 03:33:53 +0530 Subject: [PATCH] added config for preload and made attachment responsive to it --- src/components/attachment/attachment.js | 3 ++- src/components/attachment/attachment.vue | 3 +-- src/components/settings/settings.js | 4 ++++ src/components/settings/settings.vue | 4 ++++ src/i18n/en.json | 1 + src/modules/config.js | 1 + 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index 41730720..71ef2ca4 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -13,6 +13,7 @@ const Attachment = { return { nsfwImage, hideNsfwLocal: this.$store.state.config.hideNsfw, + preloadNsfwImage: this.$store.state.config.preloadNsfwImage, loopVideo: this.$store.state.config.loopVideo, showHidden: false, loading: false, @@ -27,7 +28,7 @@ const Attachment = { return fileTypeService.fileType(this.attachment.mimetype) }, hidden () { - return this.nsfw && this.hideNsfwLocal && !this.showHidden + return (this.nsfw && this.hideNsfwLocal && !this.showHidden) }, isEmpty () { return (this.type === 'html' && !this.attachment.oembed) || this.type === 'unknown' diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index 6c8a04ed..1b1956e0 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -9,8 +9,7 @@
Hide
- - + diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js index 19bd2e5b..4d8744da 100644 --- a/src/components/settings/settings.js +++ b/src/components/settings/settings.js @@ -14,6 +14,7 @@ const settings = { hideAttachmentsInConvLocal: user.hideAttachmentsInConv, hideNsfwLocal: user.hideNsfw, hideISPLocal: user.hideISP, + preloadNsfwImage: user.preloadNsfwImage, hidePostStatsLocal: typeof user.hidePostStats === 'undefined' ? instance.hidePostStats : user.hidePostStats, @@ -84,6 +85,9 @@ const settings = { hideNsfwLocal (value) { this.$store.dispatch('setOption', { name: 'hideNsfw', value }) }, + preloadNsfwImage(value) { + this.$store.dispatch('setOption', { name: 'preloadNsfwImage', value }) + }, hideISPLocal (value) { this.$store.dispatch('setOption', { name: 'hideISP', value }) }, diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue index dec33505..60b70227 100644 --- a/src/components/settings/settings.vue +++ b/src/components/settings/settings.vue @@ -118,6 +118,10 @@ +
  • + + +
  • diff --git a/src/i18n/en.json b/src/i18n/en.json index 97dfcb77..dc47788c 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -125,6 +125,7 @@ "hide_attachments_in_convo": "Hide attachments in conversations", "hide_attachments_in_tl": "Hide attachments in timeline", "hide_isp": "Hide instance-specific panel", + "preload_sensitive": "Preload Sensitive Images", "hide_post_stats": "Hide post statistics (e.g. the number of favorites)", "hide_user_stats": "Hide user statistics (e.g. the number of followers)", "import_followers_from_a_csv_file": "Import follows from a csv file", diff --git a/src/modules/config.js b/src/modules/config.js index 45ac8f65..7b0b2cf4 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -9,6 +9,7 @@ const defaultState = { hideAttachments: false, hideAttachmentsInConv: false, hideNsfw: true, + preloadNsfwImage: true, loopVideo: true, loopVideoSilentOnly: true, autoLoad: true,