Merge branch 'dev_vald_fe/nsfw_preload' into 'develop'
preload nsfw image Closes #193 See merge request pleroma/pleroma-fe!411
This commit is contained in:
commit
7325ff2e7a
|
@ -13,6 +13,7 @@ const Attachment = {
|
||||||
return {
|
return {
|
||||||
nsfwImage,
|
nsfwImage,
|
||||||
hideNsfwLocal: this.$store.state.config.hideNsfw,
|
hideNsfwLocal: this.$store.state.config.hideNsfw,
|
||||||
|
preloadImage: this.$store.state.config.preloadImage,
|
||||||
loopVideo: this.$store.state.config.loopVideo,
|
loopVideo: this.$store.state.config.loopVideo,
|
||||||
showHidden: false,
|
showHidden: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@ -46,7 +47,7 @@ const Attachment = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggleHidden () {
|
toggleHidden () {
|
||||||
if (this.img) {
|
if (this.img && !this.preloadImage) {
|
||||||
if (this.img.onload) {
|
if (this.img.onload) {
|
||||||
this.img.onload()
|
this.img.onload()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
<div class="hider" v-if="nsfw && hideNsfwLocal && !hidden">
|
<div class="hider" v-if="nsfw && hideNsfwLocal && !hidden">
|
||||||
<a href="#" @click.prevent="toggleHidden()">Hide</a>
|
<a href="#" @click.prevent="toggleHidden()">Hide</a>
|
||||||
</div>
|
</div>
|
||||||
|
<a v-if="type === 'image' && (!hidden || preloadImage)" class="image-attachment" :class="{'hidden': hidden && preloadImage}" :href="attachment.url" target="_blank" :title="attachment.description">
|
||||||
<a v-if="type === 'image' && !hidden" class="image-attachment" :href="attachment.url" target="_blank" :title="attachment.description">
|
|
||||||
<StillImage :class="{'small': isSmall}" referrerpolicy="no-referrer" :mimetype="attachment.mimetype" :src="attachment.large_thumb_url || attachment.url"/>
|
<StillImage :class="{'small': isSmall}" referrerpolicy="no-referrer" :mimetype="attachment.mimetype" :src="attachment.large_thumb_url || attachment.url"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -161,6 +160,10 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
||||||
|
&.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.still-image {
|
.still-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
|
@ -14,6 +14,7 @@ const settings = {
|
||||||
hideAttachmentsInConvLocal: user.hideAttachmentsInConv,
|
hideAttachmentsInConvLocal: user.hideAttachmentsInConv,
|
||||||
hideNsfwLocal: user.hideNsfw,
|
hideNsfwLocal: user.hideNsfw,
|
||||||
hideISPLocal: user.hideISP,
|
hideISPLocal: user.hideISP,
|
||||||
|
preloadImage: user.preloadImage,
|
||||||
hidePostStatsLocal: typeof user.hidePostStats === 'undefined'
|
hidePostStatsLocal: typeof user.hidePostStats === 'undefined'
|
||||||
? instance.hidePostStats
|
? instance.hidePostStats
|
||||||
: user.hidePostStats,
|
: user.hidePostStats,
|
||||||
|
@ -84,6 +85,9 @@ const settings = {
|
||||||
hideNsfwLocal (value) {
|
hideNsfwLocal (value) {
|
||||||
this.$store.dispatch('setOption', { name: 'hideNsfw', value })
|
this.$store.dispatch('setOption', { name: 'hideNsfw', value })
|
||||||
},
|
},
|
||||||
|
preloadImage (value) {
|
||||||
|
this.$store.dispatch('setOption', { name: 'preloadImage', value })
|
||||||
|
},
|
||||||
hideISPLocal (value) {
|
hideISPLocal (value) {
|
||||||
this.$store.dispatch('setOption', { name: 'hideISP', value })
|
this.$store.dispatch('setOption', { name: 'hideISP', value })
|
||||||
},
|
},
|
||||||
|
|
|
@ -118,6 +118,12 @@
|
||||||
<input type="checkbox" id="hideNsfw" v-model="hideNsfwLocal">
|
<input type="checkbox" id="hideNsfw" v-model="hideNsfwLocal">
|
||||||
<label for="hideNsfw">{{$t('settings.nsfw_clickthrough')}}</label>
|
<label for="hideNsfw">{{$t('settings.nsfw_clickthrough')}}</label>
|
||||||
</li>
|
</li>
|
||||||
|
<ul class="setting-list suboptions" >
|
||||||
|
<li>
|
||||||
|
<input :disabled="!hideAttachmentsInConvLocal" type="checkbox" id="preloadImage" v-model="preloadImage">
|
||||||
|
<label for="preloadImage">{{$t('settings.preload_images')}}</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="stopGifs" v-model="stopGifs">
|
<input type="checkbox" id="stopGifs" v-model="stopGifs">
|
||||||
<label for="stopGifs">{{$t('settings.stop_gifs')}}</label>
|
<label for="stopGifs">{{$t('settings.stop_gifs')}}</label>
|
||||||
|
|
|
@ -125,6 +125,7 @@
|
||||||
"hide_attachments_in_convo": "Hide attachments in conversations",
|
"hide_attachments_in_convo": "Hide attachments in conversations",
|
||||||
"hide_attachments_in_tl": "Hide attachments in timeline",
|
"hide_attachments_in_tl": "Hide attachments in timeline",
|
||||||
"hide_isp": "Hide instance-specific panel",
|
"hide_isp": "Hide instance-specific panel",
|
||||||
|
"preload_images": "Preload images",
|
||||||
"hide_post_stats": "Hide post statistics (e.g. the number of favorites)",
|
"hide_post_stats": "Hide post statistics (e.g. the number of favorites)",
|
||||||
"hide_user_stats": "Hide user statistics (e.g. the number of followers)",
|
"hide_user_stats": "Hide user statistics (e.g. the number of followers)",
|
||||||
"import_followers_from_a_csv_file": "Import follows from a csv file",
|
"import_followers_from_a_csv_file": "Import follows from a csv file",
|
||||||
|
|
|
@ -9,6 +9,7 @@ const defaultState = {
|
||||||
hideAttachments: false,
|
hideAttachments: false,
|
||||||
hideAttachmentsInConv: false,
|
hideAttachmentsInConv: false,
|
||||||
hideNsfw: true,
|
hideNsfw: true,
|
||||||
|
preloadImage: true,
|
||||||
loopVideo: true,
|
loopVideo: true,
|
||||||
loopVideoSilentOnly: true,
|
loopVideoSilentOnly: true,
|
||||||
autoLoad: true,
|
autoLoad: true,
|
||||||
|
|
Loading…
Reference in New Issue