From a675cfbb3ebd9c4c093a4535cc5cd0e672a45500 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Wed, 12 Apr 2017 18:25:19 +0300 Subject: Goto-original-arrow button now sets conversation highlight/focus even when inline, setting focus now scrolls you to the focused post smoothly. Hide the arrow button when not expanded. --- src/components/conversation/conversation.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 281b0183..fa042d23 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -8,6 +8,11 @@ const sortAndFilterConversation = (conversation) => { } const conversation = { + data() { + return { + highlight: this.statusoid.id + } + }, props: [ 'statusoid', 'collapsable' @@ -54,6 +59,9 @@ const conversation = { } else { return (id === this.statusoid.id) } + }, + setHighlight(id) { + this.highlight = id } } } -- cgit v1.2.3-70-g09d2 From c9891703219607c19069ff26a4956a7636e5ab3a Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Wed, 12 Apr 2017 19:07:55 +0300 Subject: lint fixes --- src/components/conversation/conversation.js | 6 +++--- src/components/status/status.js | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index fa042d23..f3aeb216 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -8,7 +8,7 @@ const sortAndFilterConversation = (conversation) => { } const conversation = { - data() { + data () { return { highlight: this.statusoid.id } @@ -60,8 +60,8 @@ const conversation = { return (id === this.statusoid.id) } }, - setHighlight(id) { - this.highlight = id + setHighlight (id) { + this.highlight = Number(id) } } } diff --git a/src/components/status/status.js b/src/components/status/status.js index 11e4430f..82de0fd2 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -57,12 +57,13 @@ const Status = { }, isFocused () { // retweet or root of an expanded conversation - if(this.focused) + if (this.focused) { return true - // use conversation highlight only when in conversation - else if(!this.inConversation) + } else if (!this.inConversation) { return false - return this.highlight == this.status.id + } + // use conversation highlight only when in conversation + return this.status.id === this.highlight } }, components: { @@ -100,14 +101,16 @@ const Status = { } }, watch: { - 'highlight': function (newfocus) { - if(this.status.id == newfocus) { + 'highlight': function (id) { + id = Number(id) + if (this.status.id === id) { let rect = this.$el.getBoundingClientRect() - if(rect.top < 100) + if (rect.top < 100) { window.scrollBy(0, rect.top - 200) - // will be useful when scrolling down to replies or root posts is in - else if(rect.bottom > window.innerHeight - 100) + } else if(rect.bottom > window.innerHeight - 100) { + // will be useful when scrolling down to replies or root posts is in window.scrollBy(0, rect.bottom + 200) + } } } } -- cgit v1.2.3-70-g09d2 From c708ebb5d2467d601d7cbcffa2459e745ef02d0a Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Fri, 14 Apr 2017 15:58:34 +0300 Subject: Fix statusoid == undefined bug that prevented conversation opening in new tabs. --- src/components/conversation/conversation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/conversation/conversation.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index f3aeb216..e89fa84f 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -10,7 +10,7 @@ const sortAndFilterConversation = (conversation) => { const conversation = { data () { return { - highlight: this.statusoid.id + highlight: null } }, props: [ -- cgit v1.2.3-70-g09d2