Created
January 28, 2015 05:33
-
-
Save BobVul/9cb2aa62a11c073d5ae8 to your computer and use it in GitHub Desktop.
Makes the enter key work properly on mobile chat
This file contains hidden or 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
// ==UserScript== | |
// @name SEMobileChatEnter | |
// @namespace http://vulpin.com/ | |
// @description Makes the enter key work properly on mobile chat | |
// @match *://chat.stackexchange.com/* | |
// @match *://chat.stackoverflow.com/* | |
// @version 1.0.0 | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
var Program = { | |
main: function() { | |
window.removeEventListener('load', mainEventListener, false); | |
// only activate on mobile chat | |
if (!$('body.mob').length) { | |
return; | |
} | |
$('#input').keydown(function(e) { | |
if (e.keyCode == 13 && !e.shiftKey) { | |
$('#sayit-button').click(); | |
e.preventDefault(); | |
} | |
}); | |
} | |
}; | |
var mainEventListener = Program.main.bind(Program); | |
window.addEventListener('load', mainEventListener, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment