Skip to content
Permalink
Browse files

Add "rightClickToUndoCloseTab" option

  • Loading branch information...
Infocatcher committed Nov 24, 2013
1 parent bdfd245 commit 9f83c41d944525587ecf87252743c307b52c6df4
Showing with 17 additions and 3 deletions.
  1. +17 −3 Undo_Close_Tabs/undoCloseTabs.js
@@ -43,7 +43,8 @@ var options = {
},
accesskeyPostfix: " ", // <accesskey><postfix><label>
openMenuOnMouseover: false,
useMenu: false
useMenu: false,
rightClickToUndoCloseTab: false // Useful with "useMenu: true"
};

function _localize(sid) {
@@ -143,8 +144,15 @@ this.onclick = function(e) {
return;
if(e.button == 1 || e.button == 0 && (e.ctrlKey || e.shiftKey || e.altKey || e.metaKey))
this.undoCloseTabsList.clearAllLists();
else if(e.button == 0) {
if(!this.undoCloseTabsList.options.useMenu) {
else if(
e.button == 0
|| e.button == 2 && !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey
&& this.undoCloseTabsList.options.rightClickToUndoCloseTab
) {
if(
e.button == 0 && !this.undoCloseTabsList.options.useMenu
|| e.button == 2 && this.undoCloseTabsList.options.rightClickToUndoCloseTab
) {
if(this.undoCloseTabsList.closedTabCount)
this.undoCloseTabsList.undoCloseTab();
else
@@ -811,6 +819,12 @@ if(!this.undoCloseTabsList.options.useMenu && this.undoCloseTabsList.cm) {
this.undoCloseTabsList.showMenu(e); // Show menu without "context" flag
};
}
if(this.undoCloseTabsList.options.rightClickToUndoCloseTab) {
this.oncontextmenu = function(e) {
if(e.target == this && !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey)
e.preventDefault();
};
}

this.disabled = true;
setTimeout(function(_this) {

0 comments on commit 9f83c41

Please sign in to comment.
You can’t perform that action at this time.