[Pkg-mozext-commits] [tabmixplus] 09/44: Drag-n-drop url from location bar to a locked tab loading url in that tab

David Prévot taffit at moszumanska.debian.org
Fri Mar 18 20:57:14 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository tabmixplus.

commit 4fc25c29954ac71df8444d93d593de0ae8779e89
Author: onemen <tabmix.onemen at gmail.com>
Date:   Fri Feb 26 14:51:49 2016 +0200

    Drag-n-drop url from location bar to a locked tab loading url in that tab
---
 chrome/content/minit/minit.js | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/chrome/content/minit/minit.js b/chrome/content/minit/minit.js
index a9fa0cc..a86ebec 100644
--- a/chrome/content/minit/minit.js
+++ b/chrome/content/minit/minit.js
@@ -821,8 +821,28 @@ var TMP_tabDNDObserver = {
       // Dragging bookmark or livemark from the Bookmarks toolbar, or dragging
       // data from external source, always have 'copy' dropEffect
       let isCtrlKey = ((event.ctrlKey || event.metaKey) && !event.shiftKey && !event.altKey);
-      let move = !isCtrlKey && (dt.effectAllowed == "copyLink" &&
-          dt.mozSourceNode && dt.mozSourceNode._placesNode || !dt.mozSourceNode);
+      let sourceNode = dt.effectAllowed == "copyLink" &&
+          dt.mozSourceNode ? dt.mozSourceNode : {};
+
+      // return true when user drag text from the urlbar
+      let isUrlbar = node => {
+        let result;
+        // when user drag text from the address bar to another tab
+        // node.parentNode is null after selected tab changed
+        // save _tabmix_isUrlbar on the first run of this function
+        if (typeof sourceNode._tabmix_isUrlbar == "boolean") {
+          return sourceNode._tabmix_isUrlbar;
+        }
+        while (!result && node.parentNode) {
+          node = node.parentNode;
+          result = node.classList.contains("urlbar-input");
+        }
+        if (typeof sourceNode._tabmix_isUrlbar == "undefined") {
+          sourceNode._tabmix_isUrlbar = result;
+        }
+        return result;
+      };
+      let move = !isCtrlKey && (!dt.mozSourceNode || sourceNode._placesNode || isUrlbar(sourceNode));
       return !move;
     }
     return isCopy;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git



More information about the Pkg-mozext-commits mailing list