aboutsummaryrefslogtreecommitdiff
path: root/src/components/attachment/attachment.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/attachment/attachment.js')
-rw-r--r--src/components/attachment/attachment.js22
1 files changed, 13 insertions, 9 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
}
}
}