[Pkg-mozext-commits] [tabmixplus] 39/51: Follow uo bug 821724 - Implement a menuitem for places/bookmarks to open them in a private window
David Prévot
taffit at moszumanska.debian.org
Mon Feb 2 18:36:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 23cd8109a273bbb42abc5bf72a9846a85a7cc56b
Author: onemen <tabmix.onemen at gmail.com>
Date: Mon Jan 19 00:46:48 2015 +0200
Follow uo bug 821724 - Implement a menuitem for places/bookmarks to open them in a private window
---
chrome/content/extensions/sage.js | 2 +-
chrome/content/places/places.js | 17 ++++++++++++-----
modules/Places.jsm | 10 +++++++---
3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/chrome/content/extensions/sage.js b/chrome/content/extensions/sage.js
index baa85db..b9f1a7d 100644
--- a/chrome/content/extensions/sage.js
+++ b/chrome/content/extensions/sage.js
@@ -52,7 +52,7 @@ var TMP_Sage = {
var _open = document.getElementById("rssOpenItem");
var _openInWindow = document.getElementById("rssOpenNewWindowItem");
var _openInTab = document.getElementById("rssOpenNewTabItem");
- TMP_Places.contextMenu.update(_open, _openInWindow, _openInTab, this.openTabPref);
+ TMP_Places.contextMenu.update(_open, _openInWindow, {hidden: true}, _openInTab, this.openTabPref);
},
get openTabPref() {
diff --git a/chrome/content/places/places.js b/chrome/content/places/places.js
index f0ae7cb..eeb60ea 100644
--- a/chrome/content/places/places.js
+++ b/chrome/content/places/places.js
@@ -644,20 +644,27 @@ TMP_Places.contextMenu = {
buildContextMenu: function TMP_PC_buildContextMenu() {
var _open = document.getElementById("placesContext_open");
var _openInWindow = document.getElementById("placesContext_open:newwindow");
+ var _openInPrivateWindow =
+ document.getElementById("placesContext_open:newprivatewindow") || {hidden: true};
var _openInTab = document.getElementById("placesContext_open:newtab");
- this.update(_open, _openInWindow, _openInTab, TMP_Places.getPrefByDocumentURI(window));
+ this.update(_open, _openInWindow, _openInPrivateWindow, _openInTab, TMP_Places.getPrefByDocumentURI(window));
},
// update context menu for bookmarks manager and sidebar
// for bookmarks/places, history, sage and more.....
- update: function TMP_contextMenu_update(open, openInWindow, openInTab, pref) {
- // if all 3 was hidden ... probably "Open all in Tabs" is visible
- if (open.hidden && openInWindow.hidden && openInTab.hidden)
+ update: function TMP_contextMenu_update(open, openInWindow, openInPrivateWindow,
+ openInTab, pref) {
+ // if all 4 is hidden... probably "Open all in Tabs" is visible
+ if (open.hidden && openInWindow.hidden && openInPrivateWindow.hidden &&
+ openInTab.hidden) {
return;
+ }
var w = Tabmix.getTopWin();
if (w) {
- var where = w.Tabmix.whereToOpen(pref);
+ let where = w.Tabmix.whereToOpen(pref);
+ if (!openInPrivateWindow.hidden && !Tabmix.isNewWindowAllow(true))
+ openInPrivateWindow.hidden = true;
if (!openInWindow.hidden && w.Tabmix.singleWindowMode)
openInWindow.hidden = true;
diff --git a/modules/Places.jsm b/modules/Places.jsm
index d6fa7a4..20df90a 100644
--- a/modules/Places.jsm
+++ b/modules/Places.jsm
@@ -144,15 +144,19 @@ var PlacesUtilsInternal = {
}
Tabmix.changeCode(PlacesUIUtils, "PlacesUIUtils.openNodeWithEvent")._replace(
- /whereToOpenLink\(aEvent[,\s\w]*\), window/, '$&, aEvent'
+ /window.whereToOpenLink\(aEvent[,\s\w]*\)/, '{where: $&, event: aEvent}'
).toCode();
// Don't change "current" when user click context menu open (callee is PC_doCommand and aWhere is current)
// we disable the open menu when the tab is lock
// the 2nd check for aWhere == "current" is for non Firefox code that may call this function
Tabmix.changeCode(PlacesUIUtils, "PlacesUIUtils._openNodeIn")._replace(
- /(function[^\(]*\([^\)]+)(\))/,
- '$1, TMP_Event$2' /* event argument exist when this function called from openNodeWithEvent */
+ '{', '$&\n' +
+ ' var TMP_Event;\n' +
+ ' if (arguments.length > 1 && typeof aWhere == "object") {\n' +
+ ' aWhere = aWhere.where;\n' +
+ ' TMP_Event = aWhere.event;\n' +
+ ' }\n'
)._replace(
'aWindow.openUILinkIn',
'let browserWindow = this._getTopBrowserWin();\n' +
--
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