diff options
author | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-07-24 15:35:56 -0700 |
---|---|---|
committer | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-08-03 12:24:24 -0700 |
commit | 1ac883a40816f471e959e49c8fd2f4e41f5ae9d2 (patch) | |
tree | dfdbd6f7b7b3601faa9b11d8c7bc68ce8862965c /web | |
parent | 42c5d0d366cb38866dd6d2ce7e8485ac7a2746a4 (diff) | |
download | chat-1ac883a40816f471e959e49c8fd2f4e41f5ae9d2.tar.gz chat-1ac883a40816f471e959e49c8fd2f4e41f5ae9d2.tar.bz2 chat-1ac883a40816f471e959e49c8fd2f4e41f5ae9d2.zip |
Removes ability for the mention list to cycle from top to bottom and vice-versa
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/mention_list.jsx | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/web/react/components/mention_list.jsx b/web/react/components/mention_list.jsx index 71a6083d2..8eae4d3b1 100644 --- a/web/react/components/mention_list.jsx +++ b/web/react/components/mention_list.jsx @@ -31,24 +31,16 @@ module.exports = React.createClass({ e.stopPropagation(); e.preventDefault(); - var tempSelectedMention = -1; if (e.which === 38) { if (self.getSelection(self.state.selectedMention - 1)) self.setState({ selectedMention: self.state.selectedMention - 1, selectedUsername: self.refs['mention' + (self.state.selectedMention - 1)].props.username }); - else { - while (self.getSelection(++tempSelectedMention)) - ; //Need to find the top of the list - self.setState({ selectedMention: tempSelectedMention - 1, selectedUsername: self.refs['mention' + (tempSelectedMention - 1)].props.username }); - } } else if (e.which === 40) { if (self.getSelection(self.state.selectedMention + 1)) self.setState({ selectedMention: self.state.selectedMention + 1, selectedUsername: self.refs['mention' + (self.state.selectedMention + 1)].props.username }); - else - self.setState({ selectedMention: 0, selectedUsername: self.refs.mention0.props.username }); } - self.scrollToMention(e.which, tempSelectedMention); + self.scrollToMention(e.which); } } ); @@ -124,15 +116,15 @@ module.exports = React.createClass({ isEmpty: function() { return (!this.refs.mention0); }, - scrollToMention: function(keyPressed, ifLoopUp) { + scrollToMention: function(keyPressed) { var direction = keyPressed === 38 ? "up" : "down"; var scrollAmount = 0; - if (direction === "up" && ifLoopUp !== -1) + /*if (direction === "up" && ifLoopUp !== -1) scrollAmount = $("#mentionsbox").height() * 100; //Makes sure that it scrolls all the way to the bottom else if (direction === "down" && this.state.selectedMention === 0) - scrollAmount = 0; - else if (direction === "up") + scrollAmount = 0;*/ + if (direction === "up") scrollAmount = "-=" + ($('#'+this.refs['mention' + this.state.selectedMention].props.id +"_mentions").innerHeight() - 5); else if (direction === "down") scrollAmount = "+=" + ($('#'+this.refs['mention' + this.state.selectedMention].props.id +"_mentions").innerHeight() - 5); |