Skip to content

Commit

Permalink
Refactor: add checkForDlClick() function
Browse files Browse the repository at this point in the history
(related to #18)
  • Loading branch information
Infocatcher committed Nov 24, 2014
1 parent 9db0e85 commit 95f71de
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions downloadsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,8 @@ var downloadsPanel = {
panelClick: function(e) {
if(e.button == 0)
this.checkForReopenPanel(e);
if(e.button != 1)
return;
if(this.checkForFooterClick(e))
return;
if(!prefs.get("middleClickToRemoveFromPanel"))
return;
var dlController = this.dpt.da.getDlController(e.target);
if(!dlController)
return;
this.dpt.da.removeFromPanel(dlController, prefs.get("middleClickToRemoveFromPanel.clearHistory"));
this.dpt.stopEvent(e);
else if(e.button == 1)
this.checkForFooterClick(e) || this.checkForDlClick(e);
},
checkForReopenPanel: function(e) {
var trg = e.originalTarget;
Expand All @@ -244,6 +235,16 @@ var downloadsPanel = {
}
return false;
},
checkForDlClick: function(e) {
if(!prefs.get("middleClickToRemoveFromPanel"))
return false;
var dlController = this.dpt.da.getDlController(e.target);
if(!dlController)
return false;
this.dpt.da.removeFromPanel(dlController, prefs.get("middleClickToRemoveFromPanel.clearHistory"));
this.dpt.stopEvent(e);
return true;
},
reopenPanel: function(window) {
window.setTimeout(function() {
var stopTime = Date.now() + prefs.get("reopenPanel.delayFallback");
Expand Down

0 comments on commit 95f71de

Please sign in to comment.