From: Damyan Ivanov Date: Thu, 26 Feb 2009 13:13:19 +0000 (+0200) Subject: open in new tab on middle-click X-Git-Tag: 0.2~2 X-Git-Url: https://git.ktnx.net/?p=icedeb.git;a=commitdiff_plain;h=08b3820c088861dddf37a67ffc1ff93a78aad265 open in new tab on middle-click --- diff --git a/chrome/button.js b/chrome/button.js index 3dadd3e..823c2af 100644 --- a/chrome/button.js +++ b/chrome/button.js @@ -26,14 +26,28 @@ function getClipboardText() { return text; } -function lookup_bts() { +function lookup_bts(in_new) { var bug = getClipboardText(); - loadURI("http://bugs.debian.org/" + bug); + if (!bug) return null; + bug = bug.replace(/^#/, ''); + var uri="http://bugs.debian.org/" + bug; + + if (in_new) { + var b = getBrowser(); + var new_tab = b.addTab(uri); + b.selectedTab = new_tab; + } + else { + loadURI(uri); + } } Debian = { btsButton: function (e) { - lookup_bts(); + if ( e.button == 0 ) + lookup_bts(false) + else if ( e.button == 1 ) + lookup_bts(true); } }