Skip to content

Instantly share code, notes, and snippets.

@BobVul
Created January 28, 2015 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BobVul/9cb2aa62a11c073d5ae8 to your computer and use it in GitHub Desktop.
Save BobVul/9cb2aa62a11c073d5ae8 to your computer and use it in GitHub Desktop.
Makes the enter key work properly on mobile chat
// ==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