aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxj9 <xj9@heropunch.io>2017-03-02 20:01:19 -0700
committerxj9 <xj9@heropunch.io>2017-03-02 20:01:19 -0700
commit9107facaca414f5f3ea6cf5cb306fb0fa241e1bd (patch)
tree9f24845d7fc73564e3b321a7220f65765381b385
parent6075915223e26fc0b535d87a3cdf26435245937e (diff)
issue #1 - better nsfw image loading
preload the image when it is toggled, but wait to replace it until it has loaded.
-rw-r--r--.gitignore1
-rw-r--r--src/components/attachment/attachment.js6
2 files changed, 6 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index bc9103de..faf39252 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ npm-debug.log
test/unit/coverage
test/e2e/reports
selenium-debug.log
+.idea/
diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js
index f4f6aebf..c3f52f57 100644
--- a/src/components/attachment/attachment.js
+++ b/src/components/attachment/attachment.js
@@ -29,7 +29,11 @@ const Attachment = {
}
},
toggleHidden () {
- this.showHidden = !this.showHidden
+ let img = document.createElement('img')
+ img.src = this.attachment.url
+ img.onload = () => {
+ this.showHidden = !this.showHidden
+ }
}
}
}