Option to hide revealed sensitive media (#6209)

* Option to hide revealed sensitive media

This PR commit adds a button on sensitive images and videos
to to hide them without refreshing the page.

* fix position with multiple images

* Fixing some lint problems

Not related to this PR, but "Node.js CI / lint" failed on it.
This commit is contained in:
Balazs Nadasdi 2020-04-11 11:32:55 +02:00 committed by GitHub
parent 3c351d8300
commit cb631d4abb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 91 additions and 45 deletions

View file

@ -5,19 +5,22 @@
<span>{{ $t('clickToShow') }}</span> <span>{{ $t('clickToShow') }}</span>
</div> </div>
</div> </div>
<a class="gqnyydlzavusgskkfvwvjiattxdzsqlf" v-else <div class="gqnyydlzavusgskkfvwvjiattxdzsqlf" v-else>
:href="image.url" <i><fa :icon="faEyeSlash" @click="hide = true"></fa></i>
:style="style" <a
:title="image.name" :href="image.url"
@click.prevent="onClick" :style="style"
> :title="image.name"
<div v-if="image.type === 'image/gif'">GIF</div> @click.prevent="onClick"
</a> >
<div v-if="image.type === 'image/gif'">GIF</div>
</a>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; import { faExclamationTriangle, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
import i18n from '../i18n'; import i18n from '../i18n';
import { getStaticImageUrl } from '../scripts/get-static-image-url'; import { getStaticImageUrl } from '../scripts/get-static-image-url';
import ImageViewer from './image-viewer.vue'; import ImageViewer from './image-viewer.vue';
@ -36,7 +39,8 @@ export default Vue.extend({
data() { data() {
return { return {
hide: true, hide: true,
faExclamationTriangle faExclamationTriangle,
faEyeSlash
}; };
}, },
computed: { computed: {
@ -78,28 +82,47 @@ export default Vue.extend({
<style lang="scss" scoped> <style lang="scss" scoped>
.gqnyydlzavusgskkfvwvjiattxdzsqlf { .gqnyydlzavusgskkfvwvjiattxdzsqlf {
display: block; position: relative;
cursor: zoom-in;
overflow: hidden;
width: 100%;
height: 100%;
background-position: center;
background-size: contain;
background-repeat: no-repeat;
> div { > i {
background-color: var(--fg); display: block;
position: absolute;
border-radius: 6px; border-radius: 6px;
background-color: var(--fg);
color: var(--accentLighten); color: var(--accentLighten);
display: inline-block;
font-size: 14px; font-size: 14px;
font-weight: bold;
left: 12px;
opacity: .5; opacity: .5;
padding: 0 6px; padding: 3px 6px;
text-align: center; text-align: center;
cursor: pointer;
top: 12px; top: 12px;
pointer-events: none; right: 12px;
}
> a {
display: block;
cursor: zoom-in;
overflow: hidden;
width: 100%;
height: 100%;
background-position: center;
background-size: contain;
background-repeat: no-repeat;
> div {
background-color: var(--fg);
border-radius: 6px;
color: var(--accentLighten);
display: inline-block;
font-size: 14px;
font-weight: bold;
left: 12px;
opacity: .5;
padding: 0 6px;
text-align: center;
top: 12px;
pointer-events: none;
}
} }
} }

View file

@ -5,20 +5,23 @@
<span>{{ $t('clickToShow') }}</span> <span>{{ $t('clickToShow') }}</span>
</div> </div>
</div> </div>
<a class="kkjnbbplepmiyuadieoenjgutgcmtsvu" v-else <div class="kkjnbbplepmiyuadieoenjgutgcmtsvu" v-else>
:href="video.url" <i><fa :icon="faEyeSlash" @click="hide = true"></fa></i>
rel="nofollow noopener" <a
target="_blank" :href="video.url"
:style="imageStyle" rel="nofollow noopener"
:title="video.name" target="_blank"
> :style="imageStyle"
<fa :icon="faPlayCircle"/> :title="video.name"
</a> >
<fa :icon="faPlayCircle"/>
</a>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import { faPlayCircle } from '@fortawesome/free-regular-svg-icons'; import { faPlayCircle, faEyeSlash } from '@fortawesome/free-regular-svg-icons';
import i18n from '../i18n'; import i18n from '../i18n';
export default Vue.extend({ export default Vue.extend({
@ -32,7 +35,8 @@ export default Vue.extend({
data() { data() {
return { return {
hide: true, hide: true,
faPlayCircle faPlayCircle,
faEyeSlash
}; };
}, },
computed: { computed: {
@ -47,16 +51,35 @@ export default Vue.extend({
<style lang="scss" scoped> <style lang="scss" scoped>
.kkjnbbplepmiyuadieoenjgutgcmtsvu { .kkjnbbplepmiyuadieoenjgutgcmtsvu {
display: flex; position: relative;
justify-content: center;
align-items: center;
font-size: 3.5em; > i {
overflow: hidden; display: block;
background-position: center; position: absolute;
background-size: cover; border-radius: 6px;
width: 100%; background-color: var(--fg);
height: 100%; color: var(--accentLighten);
font-size: 14px;
opacity: .5;
padding: 3px 6px;
text-align: center;
cursor: pointer;
top: 12px;
right: 12px;
}
> a {
display: flex;
justify-content: center;
align-items: center;
font-size: 3.5em;
overflow: hidden;
background-position: center;
background-size: cover;
width: 100%;
height: 100%;
}
} }
.icozogqfvdetwohsdglrbswgrejoxbdj { .icozogqfvdetwohsdglrbswgrejoxbdj {