From a710cb9d4f62ae7cab14d79811658d3d9493cc0c Mon Sep 17 00:00:00 2001 From: chylex <contact@chylex.com> Date: Thu, 8 Jun 2017 14:17:46 +0200 Subject: [PATCH] Make middle click on tweet reply icon open the compose drawer --- Resources/Scripts/code.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js index 31d5b3c2..3c0188de 100644 --- a/Resources/Scripts/code.js +++ b/Resources/Scripts/code.js @@ -595,6 +595,26 @@ }); }); + // + // Block: Make middle click on tweet reply icon open the compose drawer. + // + app.delegate(".js-reply-action", "mousedown", function(e){ + if (e.which === 2){ + if ($("[data-drawer='compose']").hasClass("is-hidden")){ + $(document).trigger("uiDrawerShowDrawer", { + drawer: "compose", + withAnimation: true + }); + + window.setTimeout(() => $(this).trigger("click"), 1); + } + + e.preventDefault(); + e.stopPropagation(); + e.stopImmediatePropagation(); + } + }); + // // Block: Work around clipboard HTML formatting. //