Last active
January 28, 2017 15:34
-
-
Save himalay/e5ca035d679c25fce68bab82d29053a2 to your computer and use it in GitHub Desktop.
Twitter mobile: send message on enter https://greasyfork.org/en/scripts/20454-twitter-mobile-enter-to-send-message
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 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