Skip to content

Instantly share code, notes, and snippets.

@himalay
Last active January 28, 2017 15:34
Show Gist options
  • Save himalay/e5ca035d679c25fce68bab82d29053a2 to your computer and use it in GitHub Desktop.
Save himalay/e5ca035d679c25fce68bab82d29053a2 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Twitter Mobile - Enter to send message
// @version 0.4
// @description This script allows user to send message by pressing the enter key on Twitter Mobile DM
// @author himalay
// @namespace https://himalay.com.np
// @include *://mobile.twitter.com/messages/*
// @run-at document-end
// ==/UserScript==
document.addEventListener('keydown', function(e) {
if (e.keyCode === 13 && !e.shiftKey) {
document.querySelector('[data-testid="dmComposerSendButton"]').click();
setTimeout(() => {
document.querySelector('textarea').focus();
}, 200);
e.preventDefault();
}
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment