addons/firefox-addons/tab-mover

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 Feb 20 17:40:31 2017 +0100 (2017-02-20)
parents 2a87d7a3863f
children e32b90567f39
files README background.js
line diff
     1.1 --- a/README	Mon Feb 20 17:00:03 2017 +0100
     1.2 +++ b/README	Mon Feb 20 17:40:31 2017 +0100
     1.3 @@ -4,9 +4,9 @@
     1.4  Tab Mover is a Firefox Addon for quickly moving tabs between windows via the
     1.5  context menu. It can move tabs between two normal windows, two windows in
     1.6  incognito mode and from a normal window to an window in incognito mode. Since
     1.7 -it is not possible to directly move a tab from a window in incognito mode to a
     1.8 -normal window, Tab Mover can optionally close such a tab and reopen its URL in
     1.9 -a normal window.
    1.10 +it is not possible to directly move tabs between normal windows and windows in
    1.11 +incognito mode, Tab Mover can perform the equivalent of moving a tab by
    1.12 +closing and reopening such tabs in another window.
    1.13  
    1.14  Usage
    1.15  -----
    1.16 @@ -16,10 +16,10 @@
    1.17  "Tab Mover", and finally select a window from the submenu named "Move to
    1.18  Window".
    1.19  
    1.20 -In order to close a tab from a window in incognito mode and to reopen its URL
    1.21 -in a normal window, open the tab context menu by clicking the tab using the
    1.22 -right mouse button, then open the submenu named "Tab Mover", and finally
    1.23 -select a window from the submenu named "Close and Reopen in Window".
    1.24 +In order to close a tab in a window in incognito mode and to reopen its URL
    1.25 +in a normal window or vice versa, open the tab context menu by clicking the
    1.26 +tab using the right mouse button, then open the submenu named "Tab Mover", and
    1.27 +finally select a window from the submenu named "Close and Reopen in Window".
    1.28  
    1.29  When using Firefox version 52 or earlier the "Tab Mover" submenu is located in
    1.30  the page context menu instead of the tab context menu. The page context menu
     2.1 --- a/background.js	Mon Feb 20 17:00:03 2017 +0100
     2.2 +++ b/background.js	Mon Feb 20 17:40:31 2017 +0100
     2.3 @@ -182,7 +182,7 @@
     2.4          let windowInfo = this.model.getWindow(windowId);
     2.5          let incognito = this.model.getWindow(focusedWindowId).incognito;
     2.6  
     2.7 -        if (incognito && !windowInfo.incognito) {
     2.8 +        if (incognito !== windowInfo.incognito) {
     2.9              this.reopenMenuIds.add(menuId);
    2.10          } else {
    2.11              this.moveMenuIds.add(menuId);
    2.12 @@ -192,7 +192,7 @@
    2.13              id: menuId,
    2.14              title: windowInfo.title,
    2.15              contexts: this.menuContexts,
    2.16 -            parentId: (incognito && !windowInfo.incognito) ?
    2.17 +            parentId: (incognito !== windowInfo.incognito) ?
    2.18                  'reopen-menu' : 'move-menu'
    2.19          }).then(() => {
    2.20              return this.enableMenus();
    2.21 @@ -255,7 +255,7 @@
    2.22                  }
    2.23  
    2.24                  let menuId = String(windowInfo.id);
    2.25 -                if (incognito && !windowInfo.incognito) {
    2.26 +                if (incognito !== windowInfo.incognito) {
    2.27                      this.reopenMenuIds.add(menuId);
    2.28                  } else {
    2.29                      this.moveMenuIds.add(menuId);
    2.30 @@ -266,7 +266,7 @@
    2.31                      id: menuId,
    2.32                      title: windowInfo.title,
    2.33                      contexts: this.menuContexts,
    2.34 -                    parentId: (incognito && !windowInfo.incognito) ?
    2.35 +                    parentId: (incognito !== windowInfo.incognito) ?
    2.36                          'reopen-menu' : 'move-menu'
    2.37                  }));
    2.38              }