From 3f5ffc9e10b6b05de173c1d15edf4d4504036067 Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Sat, 9 Sep 2017 19:16:08 +0200
Subject: [PATCH] Fix t.co bypass when middle-clicking links in tweets

---
 Resources/Scripts/code.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js
index f9eeb068..17d32254 100644
--- a/Resources/Scripts/code.js
+++ b/Resources/Scripts/code.js
@@ -409,9 +409,11 @@
   //
   // Block: Bypass t.co when clicking links and media.
   //
-  $(document.body).delegate("a[data-full-url]", "click", function(e){
-    $TD.openBrowser($(this).attr("data-full-url"));
-    e.preventDefault();
+  $(document.body).delegate("a[data-full-url]", "click auxclick", function(e){
+    if (e.button === 0 || e.button === 1){ // event.which seems to be borked in auxclick
+      $TD.openBrowser($(this).attr("data-full-url"));
+      e.preventDefault();
+    }
   });
   
   if (ensurePropertyExists(TD, "services", "TwitterUser", "prototype", "fromJSONObject")){