changeset 11:5d7914307782

Allow reopening tabs from normal windows in incognito windows Moving a tab from a normal window to a window in incognito mode does not work, it result in a new empty tab. Thus, allow reopening instead of moving such tabs.
author Guido Berhoerster <guido+tab-mover@berhoerster.name>
date Mon, 20 Feb 2017 17:40:31 +0100
parents 2a87d7a3863f
children e32b90567f39
files README background.js
diffstat 2 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/README	Mon Feb 20 17:00:03 2017 +0100
+++ b/README	Mon Feb 20 17:40:31 2017 +0100
@@ -4,9 +4,9 @@
 Tab Mover is a Firefox Addon for quickly moving tabs between windows via the
 context menu. It can move tabs between two normal windows, two windows in
 incognito mode and from a normal window to an window in incognito mode. Since
-it is not possible to directly move a tab from a window in incognito mode to a
-normal window, Tab Mover can optionally close such a tab and reopen its URL in
-a normal window.
+it is not possible to directly move tabs between normal windows and windows in
+incognito mode, Tab Mover can perform the equivalent of moving a tab by
+closing and reopening such tabs in another window.
 
 Usage
 -----
@@ -16,10 +16,10 @@
 "Tab Mover", and finally select a window from the submenu named "Move to
 Window".
 
-In order to close a tab from a window in incognito mode and to reopen its URL
-in a normal window, open the tab context menu by clicking the tab using the
-right mouse button, then open the submenu named "Tab Mover", and finally
-select a window from the submenu named "Close and Reopen in Window".
+In order to close a tab in a window in incognito mode and to reopen its URL
+in a normal window or vice versa, open the tab context menu by clicking the
+tab using the right mouse button, then open the submenu named "Tab Mover", and
+finally select a window from the submenu named "Close and Reopen in Window".
 
 When using Firefox version 52 or earlier the "Tab Mover" submenu is located in
 the page context menu instead of the tab context menu. The page context menu
--- a/background.js	Mon Feb 20 17:00:03 2017 +0100
+++ b/background.js	Mon Feb 20 17:40:31 2017 +0100
@@ -182,7 +182,7 @@
         let windowInfo = this.model.getWindow(windowId);
         let incognito = this.model.getWindow(focusedWindowId).incognito;
 
-        if (incognito && !windowInfo.incognito) {
+        if (incognito !== windowInfo.incognito) {
             this.reopenMenuIds.add(menuId);
         } else {
             this.moveMenuIds.add(menuId);
@@ -192,7 +192,7 @@
             id: menuId,
             title: windowInfo.title,
             contexts: this.menuContexts,
-            parentId: (incognito && !windowInfo.incognito) ?
+            parentId: (incognito !== windowInfo.incognito) ?
                 'reopen-menu' : 'move-menu'
         }).then(() => {
             return this.enableMenus();
@@ -255,7 +255,7 @@
                 }
 
                 let menuId = String(windowInfo.id);
-                if (incognito && !windowInfo.incognito) {
+                if (incognito !== windowInfo.incognito) {
                     this.reopenMenuIds.add(menuId);
                 } else {
                     this.moveMenuIds.add(menuId);
@@ -266,7 +266,7 @@
                     id: menuId,
                     title: windowInfo.title,
                     contexts: this.menuContexts,
-                    parentId: (incognito && !windowInfo.incognito) ?
+                    parentId: (incognito !== windowInfo.incognito) ?
                         'reopen-menu' : 'move-menu'
                 }));
             }