diff options
| author | Henry Jameson <me@hjkos.com> | 2018-08-15 11:20:40 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2018-08-15 11:20:40 +0300 |
| commit | d2ec70c3237844333b914c2d26b88f4afc9e0875 (patch) | |
| tree | c755229c5761f7a99d15862f977c04d0c0789b61 /src | |
| parent | 87eee191b8eaa8b7c8a396f9c6ca976c280d44af (diff) | |
added pointer cursor for nsfw placeholder. fixed nsfw videos requiring double-click
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/attachment/attachment.js | 22 | ||||
| -rw-r--r-- | src/components/attachment/attachment.vue | 6 |
2 files changed, 18 insertions, 10 deletions
diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index d9bc4477..775207c0 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -15,7 +15,7 @@ const Attachment = { hideNsfwLocal: this.$store.state.config.hideNsfw, showHidden: false, loading: false, - img: document.createElement('img') + img: this.type === 'image' && document.createElement('img') } }, components: { @@ -45,15 +45,19 @@ const Attachment = { } }, toggleHidden () { - if (this.img.onload) { - this.img.onload() - } else { - this.loading = true - this.img.src = this.attachment.url - this.img.onload = () => { - this.loading = false - this.showHidden = !this.showHidden + if (this.img) { + if (this.img.onload) { + this.img.onload() + } else { + this.loading = true + this.img.src = this.attachment.url + this.img.onload = () => { + this.loading = false + this.showHidden = !this.showHidden + } } + } else { + this.showHidden = !this.showHidden } } } diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index c48fb16b..66110de4 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -2,7 +2,7 @@ <div v-if="size==='hide'"> <a class="placeholder" v-if="type !== 'html'" target="_blank" :href="attachment.url">[{{nsfw ? "NSFW/" : ""}}{{type.toUpperCase()}}]</a> </div> - <div v-else class="attachment" :class="{[type]: true, loading, 'small-attachment': isSmall, 'fullwidth': fullwidth}" v-show="!isEmpty"> + <div v-else class="attachment" :class="{[type]: true, loading, 'small-attachment': isSmall, 'fullwidth': fullwidth, 'nsfw-placeholder': hidden}" v-show="!isEmpty"> <a class="image-attachment" v-if="hidden" @click.prevent="toggleHidden()"> <img :key="nsfwImage" :src="nsfwImage"/> </a> @@ -50,6 +50,10 @@ margin-right: 0.5em; } + .nsfw-placeholder { + cursor: pointer; + } + .small-attachment { &.image, &.video { max-width: 35%; |
