diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c31d2d31..296d6839 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,10 +28,17 @@ before_script: # - node_modules/ stages: + - lint - build - test - deploy +lint: + stage: lint + script: + - yarn + - npm run lint + test: stage: test script: diff --git a/package.json b/package.json index e7aa7241..74706389 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "babel-plugin-lodash": "^3.2.11", "diff": "^3.0.1", "karma-mocha-reporter": "^2.2.1", - "lz-string": "^1.4.4", + "localforage": "^1.5.0", "node-sass": "^3.10.1", "object-path": "^0.11.3", "sanitize-html": "^1.13.0", diff --git a/src/App.scss b/src/App.scss index 0945c76b..8a1942c6 100644 --- a/src/App.scss +++ b/src/App.scss @@ -109,8 +109,8 @@ main-router { .panel-heading { border-radius: 10px 10px 0 0; background-size: cover; - padding: 0.6em 0; - text-align: center; + padding: 0.6em 1.0em; + text-align: left; font-size: 1.3em; line-height: 24px; } diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index c3f52f57..7715add5 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -11,7 +11,9 @@ const Attachment = { return { nsfwImage, hideNsfwLocal: this.$store.state.config.hideNsfw, - showHidden: false + showHidden: false, + loading: false, + img: document.createElement('img') } }, computed: { @@ -20,6 +22,13 @@ const Attachment = { }, hidden () { return this.nsfw && this.hideNsfwLocal && !this.showHidden + }, + autoHeight () { + if (this.type === 'image' && this.nsfw) { + return { + 'min-height': '311px' + } + } } }, methods: { @@ -29,10 +38,15 @@ const Attachment = { } }, toggleHidden () { - let img = document.createElement('img') - img.src = this.attachment.url - img.onload = () => { - this.showHidden = !this.showHidden + 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 + } } } } diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index ad60acf9..8f51b891 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -1,15 +1,14 @@