diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-20 06:38:19 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-20 06:38:19 +0900 |
| commit | ff3a97f6cf7f0a4d42b6083c3a6e5e1a6905b487 (patch) | |
| tree | 2fb1ad450a9836584f56ea994b1ff2293f0ac6d5 /src | |
| parent | :art: (diff) | |
| download | sharkey-ff3a97f6cf7f0a4d42b6083c3a6e5e1a6905b487.tar.gz sharkey-ff3a97f6cf7f0a4d42b6083c3a6e5e1a6905b487.tar.bz2 sharkey-ff3a97f6cf7f0a4d42b6083c3a6e5e1a6905b487.zip | |
Fix #5943
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/components/user-preview.vue | 3 | ||||
| -rw-r--r-- | src/client/directives/user-preview.ts | 13 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/client/components/user-preview.vue b/src/client/components/user-preview.vue index 7637f700dc..89150eaacc 100644 --- a/src/client/components/user-preview.vue +++ b/src/client/components/user-preview.vue @@ -53,6 +53,7 @@ export default Vue.extend({ return { u: null, show: false, + closed: false, top: 0, left: 0, }; @@ -68,6 +69,7 @@ export default Vue.extend({ { userId: this.user }; this.$root.api('users/show', query).then(user => { + if (this.closed) return; this.u = user; this.show = true; }); @@ -83,6 +85,7 @@ export default Vue.extend({ methods: { close() { + this.closed = true; this.show = false; if (this.$refs.content) (this.$refs.content as any).style.pointerEvents = 'none'; } diff --git a/src/client/directives/user-preview.ts b/src/client/directives/user-preview.ts index 3c5bd3510a..4db0d67c4a 100644 --- a/src/client/directives/user-preview.ts +++ b/src/client/directives/user-preview.ts @@ -39,11 +39,15 @@ export default { self.hideTimer = setTimeout(self.close, 500); }); + document.body.appendChild(self.tag.$el); + self.checkTimer = setInterval(() => { - if (!document.body.contains(el)) self.close(); + if (!document.body.contains(el)) { + clearTimeout(self.showTimer); + clearTimeout(self.hideTimer); + self.close(); + } }, 1000); - - document.body.appendChild(self.tag.$el); }; el.addEventListener('mouseover', () => { @@ -66,9 +70,6 @@ export default { unbind(el, binding, vn) { const self = el._userPreviewDirective_; - clearTimeout(self.showTimer); - clearTimeout(self.hideTimer); clearInterval(self.checkTimer); - self.close(); } }; |