From 0f24266740d7227058df519af1c8669df51879ea Mon Sep 17 00:00:00 2001 From: Ali Movahedi Date: Wed, 22 Apr 2015 23:46:53 +0430 Subject: [PATCH] Open and close tab with middle button on mouse --- js/chrome-tabs.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/chrome-tabs.js b/js/chrome-tabs.js index 39a8834..0f2299f 100644 --- a/js/chrome-tabs.js +++ b/js/chrome-tabs.js @@ -86,12 +86,19 @@ $shell.unbind('dblclick').bind('dblclick', function() { return chromeTabs.addNewTab($shell); }); + $shell.unbind('mouseup').bind('mouseup', function(e) { + if(e.which == 2 && e.target.className != 'chrome-tab-title') + return chromeTabs.addNewTab($shell); + }); return $shell.find('.chrome-tab').each(function() { var $tab; $tab = $(this); $tab.unbind('click').click(function() { return chromeTabs.setCurrentTab($shell, $tab); }); + $tab.unbind('mouseup').mouseup(function(e) { + if(e.which == 2) return chromeTabs.closeTab($shell, $tab); + }); return $tab.find('.chrome-tab-close').unbind('click').click(function() { return chromeTabs.closeTab($shell, $tab); });