Last active
February 4, 2020 21:14
-
-
Save dvingerh/6b7a6ac302f5401c538a7d0e3e6a03b7 to your computer and use it in GitHub Desktop.
Discord Userscript: Adds functionality to edit messages by ctrl-clicking them. (Discord Quick Edit)
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 Discord Quick Edit Messages | |
// @description Adds functionality to edit messages by ctrl-clicking them | |
// @namespace Violentmonkey Scripts | |
// @grant GM_addStyle | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js | |
// @require https://raw.githubusercontent.com/MichaelZelensky/jsLibraries/master/macKeys.js | |
// @match *://discordapp.com/* | |
// ==/UserScript== | |
$('body').on('click', 'div[class*="cozyMessage-"]', function(e) { | |
if (e.ctrlKey || macKeys.ctrlKey) { | |
var dropdown; | |
if ( $(this).html().indexOf("embed") != -1) { | |
dropdown = $(this).find("div[aria-label^='More']"); | |
} | |
else { | |
dropdown = $(this).find("div[aria-label^='More']"); | |
} | |
e.stopPropagation(); // Prevent buggy behavior | |
e.preventDefault(); // Prevent showing up of context menu caused by above hotfix | |
dropdown.trigger( "click" ); | |
$("div[class='layer-v9HyYc']").css("opacity", 0); | |
$.each($("div[class^='contextMenu-']").find("div[class^='item-']"), (index, value) => { | |
var option = $(value); | |
if(option.html().indexOf("Edit") != -1) { | |
option.click(); | |
} | |
}); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment