diff --git a/content/treestyletab/res/tabsDragUtils.js b/content/treestyletab/res/tabsDragUtils.js index 2f98ab92..b9b28464 100644 --- a/content/treestyletab/res/tabsDragUtils.js +++ b/content/treestyletab/res/tabsDragUtils.js @@ -13,7 +13,7 @@ http://github.com/piroor/fxaddonlibs/blob/master/tabsDragUtils.js */ (function() { - const currentRevision = 2; + const currentRevision = 3; if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {}; @@ -166,6 +166,42 @@ return true; }, + getSelectedTabs : function TDU_getSelectedTabs(aEvent) + { + var b = this.getTabBrowserFromChild(aEvent.target); + var w = b.ownerDocument.defaultView; + + var isMultipleDragEvent = this.isTabsDragging(aEvent); + var selectedTabs; + var isMultipleDrag = ( + ( + isMultipleDragEvent && + (selectedTabs = this.getDraggedTabs(aEvent)) && + selectedTabs.length + ) || + ( // Firefox 4.x (https://bugzilla.mozilla.org/show_bug.cgi?id=566510) + 'visibleTabs' in b && + (selectedTabs = b.visibleTabs.filter(function(aTab) { + return aTab.multiselected; + })) && + selectedTabs.length + ) || + ( // Tab Utilities + 'selectedTabs' in b && + (selectedTabs = b.selectedTabs) && + selectedTabs.length + ) || + ( // Multiple Tab Handler + 'MultipleTabService' in w && + w.MultipleTabService.isSelected(aTab) && + MultipleTabService.allowMoveMultipleTabs && + (selectedTabs = w.MultipleTabService.getSelectedTabs(b)) && + selectedTabs.length + ) + ); + return isMultipleDrag ? selectedTabs : [] ; + }, + getDraggedTabs : function TDU_getDraggedTabs(aEvent) { var dt = aEvent.dataTransfer; diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 1fd945d2..e7151511 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -3676,22 +3676,8 @@ TreeStyleTabBrowser.prototype = { var sourceWindow = aTab.ownerDocument.defaultView; var sourceBrowser = this.getTabBrowserFromChild(aTab); - - var dt = aInfo.event && aInfo.event.dataTransfer; - var isMultipleDragEvent = window['piro.sakura.ne.jp'].tabsDragUtils.isTabsDragging(aInfo.event); - var isMultipleMove = ( - isMultipleDragEvent || - ( - 'MultipleTabService' in sourceWindow && - sourceWindow.MultipleTabService.isSelected(aTab) && - MultipleTabService.allowMoveMultipleTabs - ) - ); - - if (isMultipleMove) { - draggedTabs = isMultipleDragEvent ? - window['piro.sakura.ne.jp'].tabsDragUtils.getDraggedTabs(aInfo.event) : - sourceWindow.MultipleTabService.getSelectedTabs(sourceBrowser); + var draggedTabs = window['piro.sakura.ne.jp'].tabsDragUtils.getSelectedTabs(aInfo.event); + if (draggedTabs.length > 1) { if (!(aInfo.action & this.kACTIONS_FOR_DESTINATION)) { draggedRoots = []; draggedTabs.forEach(function(aTab) {