Last active
March 4, 2016 13:48
-
-
Save xbenjii/85bbb5047ec064e385bb to your computer and use it in GitHub Desktop.
Tab Reply
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const input = $('#input'); | |
const yourName = $('#active-user .avatar img').attr('title').replace(/\s/g,""); | |
const mention = `@${yourName}`; | |
$(document).on('keydown', (e) => { | |
if(e.which === 9) { | |
if($('#autocomplete').children().length) { | |
return false; | |
} | |
e.preventDefault(); | |
const messages = $('.message'); | |
$(messages.get().reverse()).each((i, message) => { | |
const $message = $(message); | |
if($message.find('.mention').text() === mention) { | |
$message.find('.newreply').click(); | |
return false; | |
} | |
}); | |
} | |
}); |
rlemon
commented
Mar 4, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment