attachment: implement optional blur + internationalized text for sensitive content

This commit is contained in:
Ariadne Conill 2019-09-27 00:22:11 +00:00
parent f6cb0e82fc
commit 2c3644f561
2 changed files with 42 additions and 2 deletions

View File

@ -24,6 +24,11 @@
:href="attachment.url" :href="attachment.url"
@click.prevent="toggleHidden" @click.prevent="toggleHidden"
> >
<div v-if="nsfwUseBlur && type !== 'video'" class="centered-hider">
<a href="#">
{{$t('general.sensitive')}}<br><small>{{$t('general.sensitive_hint')}}</small>
</a>
</div>
<img <img
v-if="!nsfwUseBlur" v-if="!nsfwUseBlur"
:key="nsfwImage" :key="nsfwImage"
@ -31,6 +36,19 @@
:src="nsfwImage" :src="nsfwImage"
:class="{'small': isSmall}" :class="{'small': isSmall}"
> >
<StillImage
v-else-if="type === 'image' || attachment.large_thumb_url"
class="nsfw-blur"
:referrerpolicy="referrerpolicy"
:mimetype="attachment.mimetype"
:src="attachment.large_thumb_url || attachment.url"
/>
<VideoAttachment
v-else-if="type === 'video'"
class="video nsfw-blur"
:attachment="attachment"
:controls="allowPlay"
/>
<i <i
v-if="type === 'video'" v-if="type === 'video'"
class="play-icon icon-play-circled" class="play-icon icon-play-circled"
@ -56,7 +74,6 @@
@click="openModal" @click="openModal"
> >
<StillImage <StillImage
:class="{'nsfw-blur': hidden && nsfwUseBlur}"
:referrerpolicy="referrerpolicy" :referrerpolicy="referrerpolicy"
:mimetype="attachment.mimetype" :mimetype="attachment.mimetype"
:src="attachment.large_thumb_url || attachment.url" :src="attachment.large_thumb_url || attachment.url"
@ -228,6 +245,28 @@
border-radius: var(--tooltipRadius, $fallback--tooltipRadius); border-radius: var(--tooltipRadius, $fallback--tooltipRadius);
} }
.centered-hider {
position: absolute;
width: 14em;
height: 2em;
top: calc(50% - 1em);
left: calc(50% - 7em);
text-align: center;
white-space: nowrap;
margin: auto;
padding: 5px;
background: rgba(230,230,230,0.6);
font-weight: bold;
z-index: 4;
line-height: 1;
border-radius: $fallback--tooltipRadius;
border-radius: var(--tooltipRadius, $fallback--tooltipRadius);
}
.hider a, .centered-hider a {
color: rgba(25,25,25,1.0);
}
video { video {
z-index: 0; z-index: 0;
} }

View File

@ -19,5 +19,6 @@
"noAttachmentLinks": false, "noAttachmentLinks": false,
"nsfwCensorImage": "", "nsfwCensorImage": "",
"showFeaturesPanel": true, "showFeaturesPanel": true,
"minimalScopesMode": false "minimalScopesMode": false,
"nsfwUseBlur": false
} }