Last active
June 3, 2021 11:16
-
-
Save gprasanth/def5f14a7d08ce4869880025a174b200 to your computer and use it in GitHub Desktop.
Userscript to bind a keyboard shortcut for cmd/alt + e to bring up the emojis menu on twitter.
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
// ==UserScript== | |
// @name Emoji4Twitter | |
// @namespace https://gprasanth.in/ | |
// @version 0.1 | |
// @description Binds keyboard shortcut for `cmd/alt + e` to bring up emojis menu on twitter. | |
// @author gprasanth92 | |
// @match https://twitter.com/* | |
// @icon https://www.google.com/s2/favicons?domain=twitter.com | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
"use strict"; | |
// Please, somebody @Twitter show some love for the ~users~ emojis! | |
const _i = setInterval(function () { | |
const tweetText = document.querySelector('div[aria-label="Tweet text"]'); | |
const addEmoji = document.querySelector('div[aria-label="Add emoji"]'); | |
if (tweetText) { | |
clearInterval(_i); | |
tweetText.addEventListener( | |
"keydown", | |
function (e) { | |
if (e.key === "e" && e.metaKey) { | |
addEmoji.click(); | |
} | |
}, | |
false | |
); | |
} | |
}, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment