mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-14 11:53:08 +02:00
81 lines
1.6 KiB
Vue
81 lines
1.6 KiB
Vue
<template>
|
|
<div class="ldwbgwstjsdgcjruamauqdrffetqudry" v-if="image.isSensitive && hide && !$store.state.device.alwaysShowNsfw" @click="hide = false">
|
|
<div>
|
|
<b><fa icon="exclamation-triangle"/> {{ $t('sensitive') }}</b>
|
|
<span>{{ $t('click-to-show') }}</span>
|
|
</div>
|
|
</div>
|
|
<a class="lcjomzwbohoelkxsnuqjiaccdbdfiazy" v-else
|
|
:href="image.url"
|
|
@click.prevent="onClick"
|
|
:style="style"
|
|
:title="image.name"
|
|
></a>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import Vue from 'vue';
|
|
import i18n from '../../../i18n';
|
|
import ImageViewer from '../../../common/views/components/image-viewer.vue';
|
|
|
|
export default Vue.extend({
|
|
i18n: i18n('desktop/views/components/media-image.vue'),
|
|
props: {
|
|
image: {
|
|
type: Object,
|
|
required: true
|
|
},
|
|
raw: {
|
|
default: false
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
hide: true
|
|
};
|
|
},
|
|
computed: {
|
|
style(): any {
|
|
return {
|
|
'background-color': this.image.properties.avgColor && this.image.properties.avgColor.length == 3 ? `rgb(${this.image.properties.avgColor.join(',')})` : 'transparent',
|
|
'background-image': this.raw ? `url(${this.image.url})` : `url(${this.image.thumbnailUrl})`
|
|
};
|
|
}
|
|
},
|
|
methods: {
|
|
onClick() {
|
|
this.$root.new(ImageViewer, {
|
|
image: this.image
|
|
});
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style lang="stylus" scoped>
|
|
.lcjomzwbohoelkxsnuqjiaccdbdfiazy
|
|
display block
|
|
cursor zoom-in
|
|
overflow hidden
|
|
width 100%
|
|
height 100%
|
|
background-position center
|
|
background-size contain
|
|
background-repeat no-repeat
|
|
|
|
.ldwbgwstjsdgcjruamauqdrffetqudry
|
|
display flex
|
|
justify-content center
|
|
align-items center
|
|
background #111
|
|
color #fff
|
|
|
|
> div
|
|
display table-cell
|
|
text-align center
|
|
font-size 12px
|
|
|
|
> *
|
|
display block
|
|
|
|
</style>
|