[Pkg-mozext-commits] [tabmixplus] 16/107: Apply Eslint indent
David Prévot
taffit at moszumanska.debian.org
Tue Dec 29 19:02:45 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 3f05cdbf8da3a9a7d1e6ade9b7756cc74a5acd1c
Author: onemen <tabmix.onemen at gmail.com>
Date: Mon Oct 19 13:32:37 2015 +0300
Apply Eslint indent
---
chrome/content/click/click.js | 2 +-
chrome/content/content.js | 6 +-
chrome/content/extensions/extensions.js | 102 +--
chrome/content/extensions/sage.js | 90 +--
chrome/content/flst/lasttab.js | 696 ++++++++++-----------
chrome/content/links/setup.js | 253 ++++----
chrome/content/links/userInterface.js | 291 ++++-----
chrome/content/minit/minit.js | 120 ++--
chrome/content/minit/tabView.js | 3 +-
chrome/content/minit/tablib.js | 102 +--
chrome/content/places/places.js | 590 ++++++++---------
.../preferences/overlay/preferencesOverlay.js | 90 +--
chrome/content/preferences/preferences.js | 60 +-
.../preferences/subdialogs/pref-filetype.js | 208 +++---
chrome/content/session/promptservice.js | 460 +++++++-------
chrome/content/tab/tab.js | 166 ++---
modules/ContentClick.jsm | 14 +-
modules/DynamicRules.jsm | 12 +-
modules/MergeWindows.jsm | 2 +-
modules/Shortcuts.jsm | 48 +-
20 files changed, 1659 insertions(+), 1656 deletions(-)
diff --git a/chrome/content/click/click.js b/chrome/content/click/click.js
index 7f2e11d..5522f51 100644
--- a/chrome/content/click/click.js
+++ b/chrome/content/click/click.js
@@ -282,7 +282,7 @@ var TabmixTabClickOptions = {
gBrowser.pinTab(aTab);
break;
case 32:
- gBrowser.previousTab(gBrowser.selectedTab);
+ gBrowser.previousTab(gBrowser.selectedTab);
break;
default:
return false;
diff --git a/chrome/content/content.js b/chrome/content/content.js
index 917f7b7..f0b9d14 100644
--- a/chrome/content/content.js
+++ b/chrome/content/content.js
@@ -146,9 +146,9 @@ var TabmixClickEventHandler = {
handleEvent: function(event) {
switch (event.type) {
- case "click":
- this.contentAreaClick(event);
- break;
+ case "click":
+ this.contentAreaClick(event);
+ break;
}
},
diff --git a/chrome/content/extensions/extensions.js b/chrome/content/extensions/extensions.js
index 3619155..abb5416 100644
--- a/chrome/content/extensions/extensions.js
+++ b/chrome/content/extensions/extensions.js
@@ -457,50 +457,50 @@ var TMP_extensionsCompatibility = {
};
TMP_extensionsCompatibility.RSSTICKER = {
- init: function() {
- Tabmix.changeCode(RSSTICKER, "RSSTICKER.writeFeed")._replace(
- 'tbb.setAttribute("onclick"',
- 'tbb.setAttribute("onclick", "this.onClick(event);");\
- tbb.setAttribute("_onclick"'
- )._replace(
- 'tbb.onContextOpen =',
- 'tbb.onContextOpen = TMP_extensionsCompatibility.RSSTICKER.onContextOpen; \
- tbb.onClick = TMP_extensionsCompatibility.RSSTICKER.onClick; \
- tbb._onContextOpen ='
- ).toCode();
- },
-
- onClick: function(event) {
- if (event.ctrlKey) {
- this.markAsRead(true);
- }
- else if ((this.parent.alwaysOpenInNewTab && (event.which == 1)) || (event.which == 2)) {
- this.onContextOpen("tab");
- }
- else if (event.which == 1) {
- this.onContextOpen();
- }
- },
-
- onContextOpen: function(target) {
- if (!target) {
- if (Tabmix.whereToOpen(null).lock)
- this.parent.browser.openInNewTab(this.href);
- else
- window.loadURI(this.href);
- }
- else if (target == "window") {
- if (Tabmix.singleWindowMode)
- this.parent.browser.openInNewTab(this.href);
- else
- window.open(this.href);
- }
- else if (target == "tab") {
- this.parent.browser.openInNewTab(this.href);
- }
-
- this.markAsRead();
- }
+ init: function() {
+ Tabmix.changeCode(RSSTICKER, "RSSTICKER.writeFeed")._replace(
+ 'tbb.setAttribute("onclick"',
+ 'tbb.setAttribute("onclick", "this.onClick(event);");\
+ tbb.setAttribute("_onclick"'
+ )._replace(
+ 'tbb.onContextOpen =',
+ 'tbb.onContextOpen = TMP_extensionsCompatibility.RSSTICKER.onContextOpen; \
+ tbb.onClick = TMP_extensionsCompatibility.RSSTICKER.onClick; \
+ tbb._onContextOpen ='
+ ).toCode();
+ },
+
+ onClick: function(event) {
+ if (event.ctrlKey) {
+ this.markAsRead(true);
+ }
+ else if ((this.parent.alwaysOpenInNewTab && (event.which == 1)) || (event.which == 2)) {
+ this.onContextOpen("tab");
+ }
+ else if (event.which == 1) {
+ this.onContextOpen();
+ }
+ },
+
+ onContextOpen: function(target) {
+ if (!target) {
+ if (Tabmix.whereToOpen(null).lock)
+ this.parent.browser.openInNewTab(this.href);
+ else
+ window.loadURI(this.href);
+ }
+ else if (target == "window") {
+ if (Tabmix.singleWindowMode)
+ this.parent.browser.openInNewTab(this.href);
+ else
+ window.open(this.href);
+ }
+ else if (target == "tab") {
+ this.parent.browser.openInNewTab(this.href);
+ }
+
+ this.markAsRead();
+ }
};
// prevent Wizz RSS from load pages in locked tabs
@@ -538,13 +538,13 @@ TMP_extensionsCompatibility.wizzrss = {
// prevent Newsfox from load pages in locked tabs
TMP_extensionsCompatibility.newsfox = {
- init: function() {
- Tabmix.changeCode(window, "openNewsfox")._replace(
- /if \(newTab\) {/,
- 'newTab = newTab || Tabmix.whereToOpen(null).lock; \
- $&'
- ).toCode();
- }
+ init: function() {
+ Tabmix.changeCode(window, "openNewsfox")._replace(
+ /if \(newTab\) {/,
+ 'newTab = newTab || Tabmix.whereToOpen(null).lock; \
+ $&'
+ ).toCode();
+ }
};
/**
diff --git a/chrome/content/extensions/sage.js b/chrome/content/extensions/sage.js
index cea588b..55a062a 100644
--- a/chrome/content/extensions/sage.js
+++ b/chrome/content/extensions/sage.js
@@ -5,60 +5,60 @@
// last updated for sage version 1.5.2 - 2013-08-12
var TMP_Sage = {
- OPEN_TAB_FOR_SAGE: "extensions.tabmix.opentabfor.sage",
- init: function() {
- TMP_Places.contextMenu.toggleEventListener(true);
+ OPEN_TAB_FOR_SAGE: "extensions.tabmix.opentabfor.sage",
+ init: function() {
+ TMP_Places.contextMenu.toggleEventListener(true);
- Tabmix.changeCode(window, "updateItemContextMenu")._replace(
- 'readStateController.onCommandUpdate();',
- '$& TMP_Sage.buildContextMenu();'
- ).toCode();
+ Tabmix.changeCode(window, "updateItemContextMenu")._replace(
+ 'readStateController.onCommandUpdate();',
+ '$& TMP_Sage.buildContextMenu();'
+ ).toCode();
- if ("bookmarksTreeClick" in window) // for older sage version
+ if ("bookmarksTreeClick" in window) // for older sage version
Tabmix.changeCode(window, "bookmarksTreeClick")._replace(
- 'const BOOKMARK_SEPARATOR',
- 'var where = TMP_Places.fixWhereToOpen(aEvent, CreateHTML._tabbed ? "tab" : "current", TMP_Sage.openTabPref); \
- CreateHTML.tabbed = where == "tab"; \
- $&'
+ 'const BOOKMARK_SEPARATOR',
+ 'var where = TMP_Places.fixWhereToOpen(aEvent, CreateHTML._tabbed ? "tab" : "current", TMP_Sage.openTabPref); \
+ CreateHTML.tabbed = where == "tab"; \
+ $&'
).toCode();
- if ("bookmarksOpen" in window) // for older sage version
+ if ("bookmarksOpen" in window) // for older sage version
Tabmix.changeCode(window, "bookmarksOpen")._replace(
- 'getContentBrowser().loadURI(lastResource.url);',
- 'if (CreateHTML._tabbed) getContentBrowser().addTab(lastResource.url); \
- else $&'
+ 'getContentBrowser().loadURI(lastResource.url);',
+ 'if (CreateHTML._tabbed) getContentBrowser().addTab(lastResource.url); \
+ else $&'
).toCode();
- var fn = openURI.toString();
- if (fn.indexOf("switch (windowType)") > -1) {
- Tabmix.changeCode(window, "openURI")._replace(
- 'switch (windowType)',
- 'windowType = TMP_Places.fixWhereToOpen((oType instanceof Event)? oType : null, !windowType ? "current" : windowType, TMP_Sage.openTabPref); \
- $&'
- ).toCode();
- }
- else {
- Tabmix.changeCode(window, "openURI")._replace(
- 'switch (getWindowType(aEvent))',
- 'var windowType = getWindowType(aEvent);\
- windowType = TMP_Places.fixWhereToOpen(aEvent, typeof (windowType) != "string" || !windowType ? "current" : windowType, TMP_Sage.openTabPref); \
- switch (windowType)'
- ).toCode();
- }
- },
+ var fn = openURI.toString();
+ if (fn.indexOf("switch (windowType)") > -1) {
+ Tabmix.changeCode(window, "openURI")._replace(
+ 'switch (windowType)',
+ 'windowType = TMP_Places.fixWhereToOpen((oType instanceof Event)? oType : null, !windowType ? "current" : windowType, TMP_Sage.openTabPref); \
+ $&'
+ ).toCode();
+ }
+ else {
+ Tabmix.changeCode(window, "openURI")._replace(
+ 'switch (getWindowType(aEvent))',
+ 'var windowType = getWindowType(aEvent);\
+ windowType = TMP_Places.fixWhereToOpen(aEvent, typeof (windowType) != "string" || !windowType ? "current" : windowType, TMP_Sage.openTabPref); \
+ switch (windowType)'
+ ).toCode();
+ }
+ },
- buildContextMenu: function() {
- var _open = document.getElementById("rssOpenItem");
- var _openInWindow = document.getElementById("rssOpenNewWindowItem");
- var _openInTab = document.getElementById("rssOpenNewTabItem");
- TMP_Places.contextMenu.update(_open, _openInWindow, {hidden: true}, _openInTab, this.openTabPref);
- },
+ buildContextMenu: function() {
+ var _open = document.getElementById("rssOpenItem");
+ var _openInWindow = document.getElementById("rssOpenNewWindowItem");
+ var _openInTab = document.getElementById("rssOpenNewTabItem");
+ TMP_Places.contextMenu.update(_open, _openInWindow, {hidden: true}, _openInTab, this.openTabPref);
+ },
- get openTabPref() {
- if (Services.prefs.prefHasUserValue(this.OPEN_TAB_FOR_SAGE))
- return this.OPEN_TAB_FOR_SAGE;
- else
- return TMP_Places.prefBookmark;
- }
+ get openTabPref() {
+ if (Services.prefs.prefHasUserValue(this.OPEN_TAB_FOR_SAGE))
+ return this.OPEN_TAB_FOR_SAGE;
+ else
+ return TMP_Places.prefBookmark;
+ }
};
diff --git a/chrome/content/flst/lasttab.js b/chrome/content/flst/lasttab.js
index 8060b10..8ab9832 100644
--- a/chrome/content/flst/lasttab.js
+++ b/chrome/content/flst/lasttab.js
@@ -6,368 +6,368 @@
// The Initial Developer of the Original Code is Timothy Humphrey. //
//////////////////////////////////////////////////////////////////////
var TMP_LastTab = {
- CtrlKey: false,
- handleCtrlTab: true,
- KeyboardNavigating: true,
- KeyLock: false,
- respondToMouseInTabList: true,
- showTabList: true,
- SuppressTabListReset: false,
- TabHistory: [],
- TabIndex: 0,
- TabList: null,
- TabListLock: false,
- _inited: false,
-
- DisplayTabList: function() {
- var element = document.documentElement;
- var tablist = this.TabList;
-
- TabmixAllTabs.createCommonList(tablist, this.handleCtrlTab ? 3 : 2);
- var item = this.tabs[this.TabIndex].mCorrespondingMenuitem;
- item.setAttribute("_moz-menuactive", "true");
- TabmixAllTabs.updateMenuItemActive(null, item);
-
- // show offscreen to get popup measurements
- tablist.showPopup(element, -element.boxObject.screenX, 10000, "popup", null, null);
- var width = tablist.boxObject.width;
- var height = tablist.boxObject.height;
- this.SuppressTabListReset = true;
- tablist.hidePopup();
- this.SuppressTabListReset = false;
-
- // show at the center of the screen
- tablist.openPopupAtScreen(screen.availLeft + (screen.availWidth - width) / 2,
- screen.availTop + (screen.availHeight - height) / 2,
- false);
-
- var ietab = "chrome://ietab/content/reloaded.html?url=";
- if (gBrowser.currentURI.spec.startsWith(ietab))
- tablist.focus();
-
- this.TabListLock = true;
- },
-
- init: function() {
- this._inited = true;
-
- this.TabList = document.getElementById("lasttabTabList");
-
- let tabBox = gBrowser.mTabBox;
- let els = Cc["@mozilla.org/eventlistenerservice;1"]
- .getService(Ci.nsIEventListenerService);
- if (Tabmix.isVersion(320)) {
- els.removeSystemEventListener(tabBox._eventNode, "keydown", tabBox, false);
- }
- else {
- tabBox._eventNode.removeEventListener("keypress", tabBox, false);
- els.addSystemEventListener(tabBox._eventNode, "keypress", this, false);
- }
- els.addSystemEventListener(tabBox._eventNode, "keydown", this, false);
- els.addSystemEventListener(tabBox._eventNode, "keyup", this, false);
-
- // if session manager select other tab then the first one we need to build
- // TabHistory in two steps to maintain natural Ctrl-Tab order.
- this.TabHistory = [];
- var currentIndex = gBrowser.mCurrentTab._tPos;
- for (let i = currentIndex; i < gBrowser.tabs.length; i++)
- this.TabHistory.unshift(gBrowser.tabs[i]);
- for (let i = 0; i < currentIndex; i++)
- this.TabHistory.unshift(gBrowser.tabs[i]);
-
- this.ReadPreferences();
- },
-
- deinit: function() {
- if (!this._inited)
- return;
-
- let tabBox = gBrowser.mTabBox;
- let els = Cc["@mozilla.org/eventlistenerservice;1"]
- .getService(Ci.nsIEventListenerService);
- els.removeSystemEventListener(tabBox._eventNode, "keydown", this, false);
- els.removeSystemEventListener(tabBox._eventNode, "keyup", this, false);
- if (!Tabmix.isVersion(320))
- els.removeSystemEventListener(tabBox._eventNode, "keypress", this, false);
- },
-
- handleEvent: function(event) {
- switch (event.type) {
- case "keydown":
- this.OnKeyDown(event);
- break;
- case "keypress":
- this.OnKeyPress(event);
- break;
- case "keyup":
- this.OnKeyUp(event);
- break;
- case "DOMMenuItemActive":
- this.ItemActive(event);
- break;
- case "DOMMenuItemInactive":
- this.ItemInactive(event);
- break;
- }
- },
-
- ItemActive: function(event) {
- TabmixAllTabs.updateMenuItemActive(event);
- if (this.respondToMouseInTabList) {
- if (this.KeyboardNavigating) {
- if (event.target.value != this.inverseIndex(this.TabIndex))
- this.tabs[this.TabIndex].mCorrespondingMenuitem.setAttribute("_moz-menuactive", "false");
- this.KeyboardNavigating = false;
- }
- this.TabIndex = this.inverseIndex(event.target.value);
- }
- else if (event.target.value != this.inverseIndex(this.TabIndex)) {
- event.target.setAttribute("_moz-menuactive", "false");
- }
- },
-
- ItemInactive: function(event) {
- TabmixAllTabs.updateMenuItemInactive(event);
- if (!this.respondToMouseInTabList && event.target.value == this.inverseIndex(this.TabIndex))
- event.target.setAttribute("_moz-menuactive", "true");
- },
-
- attachTab: function TMP_LastTab_attachTab(aTab, lastRelatedTab) {
- if (!this._inited)
- return;
-
- this.detachTab(aTab);
- let index = this.TabHistory.indexOf(lastRelatedTab);
- if (index < 0)
- index = this.TabHistory.length - 1;
- this.TabHistory.splice(index, 0, aTab);
- },
-
- detachTab: function TMP_LastTab_detachTab(aTab) {
- var i = this.TabHistory.indexOf(aTab);
- if (i >= 0)
- this.TabHistory.splice(i, 1);
- },
-
- isCtrlTab: function(event) {
- return (this.handleCtrlTab || this.showTabList) &&
- event.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_TAB &&
- event.ctrlKey && !event.altKey && !event.metaKey;
- },
-
- OnKeyDown: function(event) {
- this.CtrlKey = event.ctrlKey && !event.altKey && !event.metaKey;
- Tabmix.keyModifierDown = event.shiftKey || event.ctrlKey || event.altKey || event.metaKey;
- if (Tabmix.isVersion(320))
- this.OnKeyPress(event);
- },
-
- set tabs(val) {
- if (val !== null)
- return;
-
- this._tabs = null;
- },
-
- get tabs() {
- if (this._tabs)
- return this._tabs;
- let list = this.handleCtrlTab ? this.TabHistory : gBrowser.tabs;
- this._tabs = Array.filter(list, function(tab) {
- return !tab.hidden && !tab.closing;
- });
- return this._tabs;
- },
-
- OnKeyPress: function _LastTab_OnKeyPress(event) {
- if (this.isCtrlTab(event)) {
- let tabCount = this.tabs.length;
- if (!this.KeyLock) {
- if (this.handleCtrlTab) {
- this.TabIndex = tabCount - 1;
- } else {
- this.TabIndex = this.tabs.indexOf(gBrowser.mCurrentTab);
- }
- this.KeyLock = true;
- }
-
- if (this.TabListLock) {
- let tab = this.tabs[this.TabIndex];
- if (tab)
- tab.mCorrespondingMenuitem.setAttribute("_moz-menuactive", "false");
- }
-
- if ((this.handleCtrlTab && event.shiftKey) || (!this.handleCtrlTab && !event.shiftKey)) {
- this.TabIndex++;
- if (this.TabIndex >= tabCount)
- this.TabIndex = 0;
- }
- else {
- this.TabIndex--;
- if (this.TabIndex < 0)
- this.TabIndex = tabCount - 1;
- }
-
- if (this.showTabList) {
- this.KeyboardNavigating = true;
- if (!this.TabListLock) {
- if (tabCount > 1) {
- if (!this._timer) {
- this._timer = setTimeout(() => {
- this._timer = null;
- if (!this.TabListLock)
- this.DisplayTabList();
- }, 200);
- }
- else
- this.DisplayTabList();
- }
- }
- else {
- let item = this.tabs[this.TabIndex].mCorrespondingMenuitem;
- item.setAttribute("_moz-menuactive", "true");
- TabmixAllTabs.updateMenuItemActive(null, item);
- }
- }
- else
- TabmixAllTabs._tabSelectedFromList(this.tabs[this.TabIndex]);
- event.stopPropagation();
- event.preventDefault();
+ CtrlKey: false,
+ handleCtrlTab: true,
+ KeyboardNavigating: true,
+ KeyLock: false,
+ respondToMouseInTabList: true,
+ showTabList: true,
+ SuppressTabListReset: false,
+ TabHistory: [],
+ TabIndex: 0,
+ TabList: null,
+ TabListLock: false,
+ _inited: false,
+
+ DisplayTabList: function() {
+ var element = document.documentElement;
+ var tablist = this.TabList;
+
+ TabmixAllTabs.createCommonList(tablist, this.handleCtrlTab ? 3 : 2);
+ var item = this.tabs[this.TabIndex].mCorrespondingMenuitem;
+ item.setAttribute("_moz-menuactive", "true");
+ TabmixAllTabs.updateMenuItemActive(null, item);
+
+ // show offscreen to get popup measurements
+ tablist.showPopup(element, -element.boxObject.screenX, 10000, "popup", null, null);
+ var width = tablist.boxObject.width;
+ var height = tablist.boxObject.height;
+ this.SuppressTabListReset = true;
+ tablist.hidePopup();
+ this.SuppressTabListReset = false;
+
+ // show at the center of the screen
+ tablist.openPopupAtScreen(screen.availLeft + (screen.availWidth - width) / 2,
+ screen.availTop + (screen.availHeight - height) / 2,
+ false);
+
+ var ietab = "chrome://ietab/content/reloaded.html?url=";
+ if (gBrowser.currentURI.spec.startsWith(ietab))
+ tablist.focus();
+
+ this.TabListLock = true;
+ },
+
+ init: function() {
+ this._inited = true;
+
+ this.TabList = document.getElementById("lasttabTabList");
+
+ let tabBox = gBrowser.mTabBox;
+ let els = Cc["@mozilla.org/eventlistenerservice;1"]
+ .getService(Ci.nsIEventListenerService);
+ if (Tabmix.isVersion(320)) {
+ els.removeSystemEventListener(tabBox._eventNode, "keydown", tabBox, false);
+ }
+ else {
+ tabBox._eventNode.removeEventListener("keypress", tabBox, false);
+ els.addSystemEventListener(tabBox._eventNode, "keypress", this, false);
+ }
+ els.addSystemEventListener(tabBox._eventNode, "keydown", this, false);
+ els.addSystemEventListener(tabBox._eventNode, "keyup", this, false);
+
+ // if session manager select other tab then the first one we need to build
+ // TabHistory in two steps to maintain natural Ctrl-Tab order.
+ this.TabHistory = [];
+ var currentIndex = gBrowser.mCurrentTab._tPos;
+ for (let i = currentIndex; i < gBrowser.tabs.length; i++)
+ this.TabHistory.unshift(gBrowser.tabs[i]);
+ for (let i = 0; i < currentIndex; i++)
+ this.TabHistory.unshift(gBrowser.tabs[i]);
+
+ this.ReadPreferences();
+ },
+
+ deinit: function() {
+ if (!this._inited)
+ return;
+
+ let tabBox = gBrowser.mTabBox;
+ let els = Cc["@mozilla.org/eventlistenerservice;1"]
+ .getService(Ci.nsIEventListenerService);
+ els.removeSystemEventListener(tabBox._eventNode, "keydown", this, false);
+ els.removeSystemEventListener(tabBox._eventNode, "keyup", this, false);
+ if (!Tabmix.isVersion(320))
+ els.removeSystemEventListener(tabBox._eventNode, "keypress", this, false);
+ },
+
+ handleEvent: function(event) {
+ switch (event.type) {
+ case "keydown":
+ this.OnKeyDown(event);
+ break;
+ case "keypress":
+ this.OnKeyPress(event);
+ break;
+ case "keyup":
+ this.OnKeyUp(event);
+ break;
+ case "DOMMenuItemActive":
+ this.ItemActive(event);
+ break;
+ case "DOMMenuItemInactive":
+ this.ItemInactive(event);
+ break;
+ }
+ },
+
+ ItemActive: function(event) {
+ TabmixAllTabs.updateMenuItemActive(event);
+ if (this.respondToMouseInTabList) {
+ if (this.KeyboardNavigating) {
+ if (event.target.value != this.inverseIndex(this.TabIndex))
+ this.tabs[this.TabIndex].mCorrespondingMenuitem.setAttribute("_moz-menuactive", "false");
+ this.KeyboardNavigating = false;
}
- else if (this.TabListLock && this.CtrlKey &&
- event.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_SHIFT) {
- // don't hide the tabs list popup when user press shift
- return;
+ this.TabIndex = this.inverseIndex(event.target.value);
+ }
+ else if (event.target.value != this.inverseIndex(this.TabIndex)) {
+ event.target.setAttribute("_moz-menuactive", "false");
+ }
+ },
+
+ ItemInactive: function(event) {
+ TabmixAllTabs.updateMenuItemInactive(event);
+ if (!this.respondToMouseInTabList && event.target.value == this.inverseIndex(this.TabIndex))
+ event.target.setAttribute("_moz-menuactive", "true");
+ },
+
+ attachTab: function TMP_LastTab_attachTab(aTab, lastRelatedTab) {
+ if (!this._inited)
+ return;
+
+ this.detachTab(aTab);
+ let index = this.TabHistory.indexOf(lastRelatedTab);
+ if (index < 0)
+ index = this.TabHistory.length - 1;
+ this.TabHistory.splice(index, 0, aTab);
+ },
+
+ detachTab: function TMP_LastTab_detachTab(aTab) {
+ var i = this.TabHistory.indexOf(aTab);
+ if (i >= 0)
+ this.TabHistory.splice(i, 1);
+ },
+
+ isCtrlTab: function(event) {
+ return (this.handleCtrlTab || this.showTabList) &&
+ event.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_TAB &&
+ event.ctrlKey && !event.altKey && !event.metaKey;
+ },
+
+ OnKeyDown: function(event) {
+ this.CtrlKey = event.ctrlKey && !event.altKey && !event.metaKey;
+ Tabmix.keyModifierDown = event.shiftKey || event.ctrlKey || event.altKey || event.metaKey;
+ if (Tabmix.isVersion(320))
+ this.OnKeyPress(event);
+ },
+
+ set tabs(val) {
+ if (val !== null)
+ return;
+
+ this._tabs = null;
+ },
+
+ get tabs() {
+ if (this._tabs)
+ return this._tabs;
+ let list = this.handleCtrlTab ? this.TabHistory : gBrowser.tabs;
+ this._tabs = Array.filter(list, function(tab) {
+ return !tab.hidden && !tab.closing;
+ });
+ return this._tabs;
+ },
+
+ OnKeyPress: function _LastTab_OnKeyPress(event) {
+ if (this.isCtrlTab(event)) {
+ let tabCount = this.tabs.length;
+ if (!this.KeyLock) {
+ if (this.handleCtrlTab) {
+ this.TabIndex = tabCount - 1;
+ } else {
+ this.TabIndex = this.tabs.indexOf(gBrowser.mCurrentTab);
+ }
+ this.KeyLock = true;
}
- else {
- if (this.TabListLock)
- this.TabList.hidePopup();
- gBrowser.mTabBox.handleEvent(event);
- }
- },
-
- OnKeyUp: function _LastTab_OnKeyUp(event) {
- var keyReleased = event.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_CONTROL;
- this.CtrlKey = event.ctrlKey && !event.altKey && !event.metaKey;
- Tabmix.keyModifierDown = event.shiftKey || event.ctrlKey || event.altKey || event.metaKey;
- if (!keyReleased)
- return;
- var tabToSelect;
- if (this._timer) {
- clearTimeout(this._timer);
- this._timer = null;
- tabToSelect = this.tabs[this.TabIndex];
- TabmixAllTabs._tabSelectedFromList(tabToSelect);
- this.PushSelectedTab();
- }
if (this.TabListLock) {
- let tab = this.tabs[this.TabIndex];
- if (tab && tab.mCorrespondingMenuitem.getAttribute("_moz-menuactive") == "true") {
- tabToSelect = tab;
- }
-
- TabmixAllTabs.updateMenuItemInactive(null);
- TabmixAllTabs.backupLabel = "";
-
- this.TabList.hidePopup();
- if (tabToSelect)
- TabmixAllTabs._tabSelectedFromList(tabToSelect);
- this.PushSelectedTab();
+ let tab = this.tabs[this.TabIndex];
+ if (tab)
+ tab.mCorrespondingMenuitem.setAttribute("_moz-menuactive", "false");
}
- if (this.KeyLock) {
- this.PushSelectedTab();
- this.TabIndex = 0;
- this.KeyLock = false;
- }
- this._tabs = null;
- },
- onMenuCommand: function(event) {
- if (this.respondToMouseInTabList) {
- TabmixAllTabs._tabSelectedFromList(event.target.tab);
- this.PushSelectedTab();
+ if ((this.handleCtrlTab && event.shiftKey) || (!this.handleCtrlTab && !event.shiftKey)) {
+ this.TabIndex++;
+ if (this.TabIndex >= tabCount)
+ this.TabIndex = 0;
+ }
+ else {
+ this.TabIndex--;
+ if (this.TabIndex < 0)
+ this.TabIndex = tabCount - 1;
}
- },
-
- onPopupshowing: function() {
- this.TabList.addEventListener("DOMMenuItemActive", this, true);
- this.TabList.addEventListener("DOMMenuItemInactive", this, true);
- },
- onPopuphidden: function() {
- this.TabList.removeEventListener("DOMMenuItemActive", this, true);
- this.TabList.removeEventListener("DOMMenuItemInactive", this, true);
- if (!this.SuppressTabListReset) {
- var tablist = this.TabList;
+ if (this.showTabList) {
+ this.KeyboardNavigating = true;
+ if (!this.TabListLock) {
+ if (tabCount > 1) {
+ if (!this._timer) {
+ this._timer = setTimeout(() => {
+ this._timer = null;
+ if (!this.TabListLock)
+ this.DisplayTabList();
+ }, 200);
+ }
+ else
+ this.DisplayTabList();
+ }
+ }
+ else {
+ let item = this.tabs[this.TabIndex].mCorrespondingMenuitem;
+ item.setAttribute("_moz-menuactive", "true");
+ TabmixAllTabs.updateMenuItemActive(null, item);
+ }
+ }
+ else
+ TabmixAllTabs._tabSelectedFromList(this.tabs[this.TabIndex]);
+ event.stopPropagation();
+ event.preventDefault();
+ }
+ else if (this.TabListLock && this.CtrlKey &&
+ event.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_SHIFT) {
+ // don't hide the tabs list popup when user press shift
+ return;
+ }
+ else {
+ if (this.TabListLock)
+ this.TabList.hidePopup();
+
+ gBrowser.mTabBox.handleEvent(event);
+ }
+ },
+
+ OnKeyUp: function _LastTab_OnKeyUp(event) {
+ var keyReleased = event.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_CONTROL;
+ this.CtrlKey = event.ctrlKey && !event.altKey && !event.metaKey;
+ Tabmix.keyModifierDown = event.shiftKey || event.ctrlKey || event.altKey || event.metaKey;
+ if (!keyReleased)
+ return;
+ var tabToSelect;
+ if (this._timer) {
+ clearTimeout(this._timer);
+ this._timer = null;
+ tabToSelect = this.tabs[this.TabIndex];
+ TabmixAllTabs._tabSelectedFromList(tabToSelect);
+ this.PushSelectedTab();
+ }
+ if (this.TabListLock) {
+ let tab = this.tabs[this.TabIndex];
+ if (tab && tab.mCorrespondingMenuitem.getAttribute("_moz-menuactive") == "true") {
+ tabToSelect = tab;
+ }
- while (tablist.childNodes.length > 0)
- tablist.removeChild(tablist.childNodes[0]);
+ TabmixAllTabs.updateMenuItemInactive(null);
+ TabmixAllTabs.backupLabel = "";
- this.TabListLock = false;
- this.TabIndex = 0;
- this.KeyLock = false;
+ this.TabList.hidePopup();
+ if (tabToSelect)
+ TabmixAllTabs._tabSelectedFromList(tabToSelect);
+ this.PushSelectedTab();
+ }
+ if (this.KeyLock) {
+ this.PushSelectedTab();
+ this.TabIndex = 0;
+ this.KeyLock = false;
+ }
+ this._tabs = null;
+ },
+
+ onMenuCommand: function(event) {
+ if (this.respondToMouseInTabList) {
+ TabmixAllTabs._tabSelectedFromList(event.target.tab);
+ this.PushSelectedTab();
+ }
+ },
+
+ onPopupshowing: function() {
+ this.TabList.addEventListener("DOMMenuItemActive", this, true);
+ this.TabList.addEventListener("DOMMenuItemInactive", this, true);
+ },
+
+ onPopuphidden: function() {
+ this.TabList.removeEventListener("DOMMenuItemActive", this, true);
+ this.TabList.removeEventListener("DOMMenuItemInactive", this, true);
+ if (!this.SuppressTabListReset) {
+ var tablist = this.TabList;
- TabmixAllTabs.hideCommonList(tablist);
- }
- },
-
- OnSelect: function() {
- // session manager can select new tab before TMP_LastTab is init
- if (!this._inited)
- return;
-
- var tabCount = this.TabHistory.length;
- if (tabCount != gBrowser.tabs.length) {
- if (tabCount > gBrowser.tabs.length) {
- if (gBrowser.tabs.length == 1) {
- this.KeyLock = false;
- this.TabIndex = 0;
- }
- }
- this.PushSelectedTab();
+ while (tablist.childNodes.length > 0)
+ tablist.removeChild(tablist.childNodes[0]);
+
+ this.TabListLock = false;
+ this.TabIndex = 0;
+ this.KeyLock = false;
+
+ TabmixAllTabs.hideCommonList(tablist);
+ }
+ },
+
+ OnSelect: function() {
+ // session manager can select new tab before TMP_LastTab is init
+ if (!this._inited)
+ return;
+
+ var tabCount = this.TabHistory.length;
+ if (tabCount != gBrowser.tabs.length) {
+ if (tabCount > gBrowser.tabs.length) {
+ if (gBrowser.tabs.length == 1) {
+ this.KeyLock = false;
+ this.TabIndex = 0;
+ }
}
- else if (!this.KeyLock) {
- if (this.CtrlKey)
- this.KeyLock = true; // allow other tab navigation methods to work
- else
- this.PushSelectedTab();
- }
- },
-
- PushSelectedTab: function TMP_LastTab_PushSelectedTab() {
- var selectedTab = gBrowser.tabContainer.selectedItem;
- this.detachTab(selectedTab);
- this.TabHistory.push(selectedTab);
- },
-
- ReadPreferences: function() {
- // when Build-in tabPreviews is on we disable our own function
- var mostRecentlyUsed = Services.prefs.getBoolPref("browser.ctrlTab.previews");
- var tabPreviews = document.getElementById("ctrlTab-panel") && "ctrlTab" in window;
- if (tabPreviews) {
- var tabPreviewsCurentStatus = ctrlTab._recentlyUsedTabs ? true : false;
- tabPreviews = mostRecentlyUsed && Tabmix.prefs.getBoolPref("lasttab.tabPreviews");
- if (tabPreviewsCurentStatus != tabPreviews) {
- if (tabPreviews) {
- ctrlTab.init();
- ctrlTab._recentlyUsedTabs = [];
- for (var i = 0; i < this.TabHistory.length; i++) {
- ctrlTab._recentlyUsedTabs.unshift(this.TabHistory[i]);
- }
- }
- else
- ctrlTab.uninit();
- }
+ this.PushSelectedTab();
+ }
+ else if (!this.KeyLock) {
+ if (this.CtrlKey)
+ this.KeyLock = true; // allow other tab navigation methods to work
+ else
+ this.PushSelectedTab();
+ }
+ },
+
+ PushSelectedTab: function TMP_LastTab_PushSelectedTab() {
+ var selectedTab = gBrowser.tabContainer.selectedItem;
+ this.detachTab(selectedTab);
+ this.TabHistory.push(selectedTab);
+ },
+
+ ReadPreferences: function() {
+ // when Build-in tabPreviews is on we disable our own function
+ var mostRecentlyUsed = Services.prefs.getBoolPref("browser.ctrlTab.previews");
+ var tabPreviews = document.getElementById("ctrlTab-panel") && "ctrlTab" in window;
+ if (tabPreviews) {
+ var tabPreviewsCurentStatus = ctrlTab._recentlyUsedTabs ? true : false;
+ tabPreviews = mostRecentlyUsed && Tabmix.prefs.getBoolPref("lasttab.tabPreviews");
+ if (tabPreviewsCurentStatus != tabPreviews) {
+ if (tabPreviews) {
+ ctrlTab.init();
+ ctrlTab._recentlyUsedTabs = [];
+ for (var i = 0; i < this.TabHistory.length; i++) {
+ ctrlTab._recentlyUsedTabs.unshift(this.TabHistory[i]);
+ }
+ }
+ else
+ ctrlTab.uninit();
}
+ }
- this.handleCtrlTab = !tabPreviews && mostRecentlyUsed;
- this.showTabList = !tabPreviews && Tabmix.prefs.getBoolPref("lasttab.showTabList");
- this.respondToMouseInTabList = Tabmix.prefs.getBoolPref("lasttab.respondToMouseInTabList");
- },
+ this.handleCtrlTab = !tabPreviews && mostRecentlyUsed;
+ this.showTabList = !tabPreviews && Tabmix.prefs.getBoolPref("lasttab.showTabList");
+ this.respondToMouseInTabList = Tabmix.prefs.getBoolPref("lasttab.respondToMouseInTabList");
+ },
- inverseIndex: function(index) {
- return this.handleCtrlTab ? index : this.tabs.length - 1 - index;
- }
+ inverseIndex: function(index) {
+ return this.handleCtrlTab ? index : this.tabs.length - 1 - index;
+ }
};
diff --git a/chrome/content/links/setup.js b/chrome/content/links/setup.js
index 0845756..86893c9 100644
--- a/chrome/content/links/setup.js
+++ b/chrome/content/links/setup.js
@@ -16,8 +16,8 @@
*/
Tabmix.linkHandling_init = function TMP_TBP_init(aWindowType) {
if (aWindowType == "Extension:Manager") {
- // we're in the EM
- window.openURL = this.openURL;
+ // we're in the EM
+ window.openURL = this.openURL;
}
// for normal click this function calls urlbar.handleCommand
@@ -238,103 +238,104 @@ Tabmix.beforeBrowserInitOnLoad = function() {
// this must run before all
Tabmix.beforeStartup = function TMP_beforeStartup(tabBrowser, aTabContainer) {
- if (typeof tabBrowser == "undefined")
- tabBrowser = gBrowser;
-
- // return true if all tabs in the window are blank
- tabBrowser.isBlankWindow = function() {
- for (var i = 0; i < this.tabs.length; i++) {
- if (!this.isBlankBrowser(this.getBrowserAtIndex(i)))
- return false;
- }
- return true;
- };
-
- tabBrowser.isBlankTab = function(aTab) {
- return this.isBlankBrowser(this.getBrowserForTab(aTab));
- };
+ if (typeof tabBrowser == "undefined")
+ tabBrowser = gBrowser;
- //XXX isTabEmpty exist in Firefox 4.0 - same as isBlankNotBusyTab
- // isTabEmpty don't check for Tabmix.isNewTabUrls
- tabBrowser.isBlankNotBusyTab = function TMP_isBlankNotBusyTab(aTab, aboutBlank) {
- if (aTab.hasAttribute("busy") || aTab.hasAttribute("pending"))
+ // return true if all tabs in the window are blank
+ tabBrowser.isBlankWindow = function() {
+ for (var i = 0; i < this.tabs.length; i++) {
+ if (!this.isBlankBrowser(this.getBrowserAtIndex(i)))
return false;
-
- return this.isBlankBrowser(this.getBrowserForTab(aTab), aboutBlank);
- };
-
- tabBrowser.isBlankBrowser = function TMP_isBlankBrowser(aBrowser, aboutBlank) {
- try {
- if (!aBrowser || !aBrowser.currentURI)
- return true;
- if (aBrowser.canGoForward || aBrowser.canGoBack)
- return false;
- return aboutBlank ? aBrowser.currentURI.spec == TabmixSvc.aboutBlank :
- Tabmix.isNewTabUrls(aBrowser.currentURI.spec);
- } catch (ex) {
-Tabmix.assert(ex); return true;
-}
- };
-
- /**
- * add gBrowser.getTabForBrowser if it is not exist
- * gBrowser.getTabForBrowser exsit since Firefox 35 (Bug 1039500)
- * gBrowser._getTabForBrowser exsit since Firefox 23 (Bug 662008)
- */
- if (typeof tabBrowser.getTabForBrowser != "function") {
- // this is _getTabForBrowser version from Firefox 23
- tabBrowser.getTabForBrowser = function(aBrowser) {
- for (let i = 0; i < this.tabs.length; i++) {
- if (this.tabs[i].linkedBrowser == aBrowser)
- return this.tabs[i];
- }
- return null;
- };
}
-
- tabBrowser.getTabForLastPanel = function() {
- let notificationbox = this.mPanelContainer.lastChild;
- let attrName = Tabmix.isVersion(180) ? "class" : "anonid"; // changed by Bug 768442
- let browser = document.getAnonymousElementByAttribute(notificationbox, attrName, "browserStack").firstChild;
- return this.getTabForBrowser(browser);
+ return true;
+ };
+
+ tabBrowser.isBlankTab = function(aTab) {
+ return this.isBlankBrowser(this.getBrowserForTab(aTab));
+ };
+
+ //XXX isTabEmpty exist in Firefox 4.0 - same as isBlankNotBusyTab
+ // isTabEmpty don't check for Tabmix.isNewTabUrls
+ tabBrowser.isBlankNotBusyTab = function TMP_isBlankNotBusyTab(aTab, aboutBlank) {
+ if (aTab.hasAttribute("busy") || aTab.hasAttribute("pending"))
+ return false;
+
+ return this.isBlankBrowser(this.getBrowserForTab(aTab), aboutBlank);
+ };
+
+ tabBrowser.isBlankBrowser = function TMP_isBlankBrowser(aBrowser, aboutBlank) {
+ try {
+ if (!aBrowser || !aBrowser.currentURI)
+ return true;
+ if (aBrowser.canGoForward || aBrowser.canGoBack)
+ return false;
+ return aboutBlank ? aBrowser.currentURI.spec == TabmixSvc.aboutBlank :
+ Tabmix.isNewTabUrls(aBrowser.currentURI.spec);
+ } catch (ex) {
+ Tabmix.assert(ex);
+ return true;
+ }
+ };
+
+ /**
+ * add gBrowser.getTabForBrowser if it is not exist
+ * gBrowser.getTabForBrowser exsit since Firefox 35 (Bug 1039500)
+ * gBrowser._getTabForBrowser exsit since Firefox 23 (Bug 662008)
+ */
+ if (typeof tabBrowser.getTabForBrowser != "function") {
+ // this is _getTabForBrowser version from Firefox 23
+ tabBrowser.getTabForBrowser = function(aBrowser) {
+ for (let i = 0; i < this.tabs.length; i++) {
+ if (this.tabs[i].linkedBrowser == aBrowser)
+ return this.tabs[i];
+ }
+ return null;
};
+ }
- var tabContainer = aTabContainer || tabBrowser.tabContainer ||
- document.getAnonymousElementByAttribute(tabBrowser, "anonid", "tabcontainer");
-
- // Firefox sessionStore and session manager extension start to add tab before our onWindowOpen run
- // so we initialize this before start
- // mTabMaxWidth not exist from firefox 4.0
- var max = Math.max(16, Services.prefs.getIntPref("browser.tabs.tabMaxWidth"));
- var min = Math.max(16, Services.prefs.getIntPref("browser.tabs.tabMinWidth"));
- if (max < min) {
- Services.prefs.setIntPref("browser.tabs.tabMaxWidth", min);
- Services.prefs.setIntPref("browser.tabs.tabMinWidth", max);
- [min, max] = [max, min];
- }
- tabContainer.mTabMaxWidth = max;
- tabContainer.mTabMinWidth = min;
- TabmixTabbar.widthFitTitle = this.prefs.getBoolPref("flexTabs") && (max != min);
- if (TabmixTabbar.widthFitTitle)
- this.setItem(tabContainer, "widthFitTitle", true);
-
- var tabscroll = this.prefs.getIntPref("tabBarMode");
- if (document.documentElement.getAttribute("chromehidden").indexOf("toolbar") != -1)
- tabscroll = 1;
- if (tabscroll < 0 || tabscroll > 3 ||
- (tabscroll != TabmixTabbar.SCROLL_BUTTONS_LEFT_RIGHT && "TreeStyleTabBrowser" in window)) {
- this.prefs.setIntPref("tabBarMode", 1);
- tabscroll = 1;
- }
- TabmixTabbar.scrollButtonsMode = tabscroll;
- let flowing = ["singlebar", "scrollbutton", "multibar", "scrollbutton"][tabscroll];
- TabmixTabbar.flowing = flowing;
+ tabBrowser.getTabForLastPanel = function() {
+ let notificationbox = this.mPanelContainer.lastChild;
+ let attrName = Tabmix.isVersion(180) ? "class" : "anonid"; // changed by Bug 768442
+ let browser = document.getAnonymousElementByAttribute(notificationbox, attrName, "browserStack").firstChild;
+ return this.getTabForBrowser(browser);
+ };
+
+ var tabContainer = aTabContainer || tabBrowser.tabContainer ||
+ document.getAnonymousElementByAttribute(tabBrowser, "anonid", "tabcontainer");
+
+ // Firefox sessionStore and session manager extension start to add tab before our onWindowOpen run
+ // so we initialize this before start
+ // mTabMaxWidth not exist from firefox 4.0
+ var max = Math.max(16, Services.prefs.getIntPref("browser.tabs.tabMaxWidth"));
+ var min = Math.max(16, Services.prefs.getIntPref("browser.tabs.tabMinWidth"));
+ if (max < min) {
+ Services.prefs.setIntPref("browser.tabs.tabMaxWidth", min);
+ Services.prefs.setIntPref("browser.tabs.tabMinWidth", max);
+ [min, max] = [max, min];
+ }
+ tabContainer.mTabMaxWidth = max;
+ tabContainer.mTabMinWidth = min;
+ TabmixTabbar.widthFitTitle = this.prefs.getBoolPref("flexTabs") && (max != min);
+ if (TabmixTabbar.widthFitTitle)
+ this.setItem(tabContainer, "widthFitTitle", true);
+
+ var tabscroll = this.prefs.getIntPref("tabBarMode");
+ if (document.documentElement.getAttribute("chromehidden").indexOf("toolbar") != -1)
+ tabscroll = 1;
+ if (tabscroll < 0 || tabscroll > 3 ||
+ (tabscroll != TabmixTabbar.SCROLL_BUTTONS_LEFT_RIGHT && "TreeStyleTabBrowser" in window)) {
+ this.prefs.setIntPref("tabBarMode", 1);
+ tabscroll = 1;
+ }
+ TabmixTabbar.scrollButtonsMode = tabscroll;
+ let flowing = ["singlebar", "scrollbutton", "multibar", "scrollbutton"][tabscroll];
+ TabmixTabbar.flowing = flowing;
- // add flag that we are after SwitchThemes, we use it in Tabmix.isWindowAfterSessionRestore
- if ("SwitchThemesModule" in window && SwitchThemesModule.windowsStates && SwitchThemesModule.windowsStates.length)
- TMP_SessionStore.afterSwitchThemes = true;
+ // add flag that we are after SwitchThemes, we use it in Tabmix.isWindowAfterSessionRestore
+ if ("SwitchThemesModule" in window && SwitchThemesModule.windowsStates && SwitchThemesModule.windowsStates.length)
+ TMP_SessionStore.afterSwitchThemes = true;
- TMP_extensionsCompatibility.preInit();
+ TMP_extensionsCompatibility.preInit();
};
Tabmix.adjustTabstrip = function tabContainer_adjustTabstrip(skipUpdateScrollStatus, aUrl) {
@@ -350,39 +351,39 @@ Tabmix.adjustTabstrip = function tabContainer_adjustTabstrip(skipUpdateScrollSta
var tabs = tabbrowser.visibleTabs;
var tabsCount = tabs.length - tabbrowser._removingTabs.length;
switch (Tabmix.tabsUtils.closeButtonsEnabled ? this.mCloseButtons : 0) {
- case 0:
- this.removeAttribute("closebuttons-hover");
- this.setAttribute("closebuttons", "noclose");
- break;
- case 1:
- this.removeAttribute("closebuttons-hover");
- this.setAttribute("closebuttons", "alltabs");
- break;
- case 2:
- this.setAttribute("closebuttons-hover", "alltabs");
- this.setAttribute("closebuttons", "noclose");
- break;
- case 3:
- this.removeAttribute("closebuttons-hover");
- this.setAttribute("closebuttons", "activetab");
- break;
- case 4:
- this.setAttribute("closebuttons-hover", "notactivetab");
- this.setAttribute("closebuttons", "activetab");
- break;
- case 5:
- this.removeAttribute("closebuttons-hover");
- if (tabsCount < 3)
+ case 0:
+ this.removeAttribute("closebuttons-hover");
+ this.setAttribute("closebuttons", "noclose");
+ break;
+ case 1:
+ this.removeAttribute("closebuttons-hover");
this.setAttribute("closebuttons", "alltabs");
- else {
- // make sure not to check collapsed, hidden or pinned tabs for width
- let tab = TMP_TabView.checkTabs(tabs);
- if (tab && tab.getBoundingClientRect().width > this.mTabClipWidth)
+ break;
+ case 2:
+ this.setAttribute("closebuttons-hover", "alltabs");
+ this.setAttribute("closebuttons", "noclose");
+ break;
+ case 3:
+ this.removeAttribute("closebuttons-hover");
+ this.setAttribute("closebuttons", "activetab");
+ break;
+ case 4:
+ this.setAttribute("closebuttons-hover", "notactivetab");
+ this.setAttribute("closebuttons", "activetab");
+ break;
+ case 5:
+ this.removeAttribute("closebuttons-hover");
+ if (tabsCount < 3)
this.setAttribute("closebuttons", "alltabs");
- else
- this.setAttribute("closebuttons", "activetab");
- }
- break;
+ else {
+ // make sure not to check collapsed, hidden or pinned tabs for width
+ let tab = TMP_TabView.checkTabs(tabs);
+ if (tab && tab.getBoundingClientRect().width > this.mTabClipWidth)
+ this.setAttribute("closebuttons", "alltabs");
+ else
+ this.setAttribute("closebuttons", "activetab");
+ }
+ break;
}
/**
@@ -392,12 +393,12 @@ Tabmix.adjustTabstrip = function tabContainer_adjustTabstrip(skipUpdateScrollSta
if (tabsCount == 1) {
let tab = this.selectedItem;
if (!aUrl) {
- let currentURI = tabbrowser.currentURI;
- aUrl = currentURI ? currentURI.spec : null;
+ let currentURI = tabbrowser.currentURI;
+ aUrl = currentURI ? currentURI.spec : null;
}
if (Tabmix.tabsUtils._keepLastTab ||
isBlankPageURL(tab.__newLastTab || null) ||
- (!aUrl || isBlankPageURL(aUrl)) &&
+ (!aUrl || isBlankPageURL(aUrl)) &&
tabbrowser.isBlankNotBusyTab(tab)) {
this.setAttribute("closebuttons", "noclose");
this.removeAttribute("closebuttons-hover");
diff --git a/chrome/content/links/userInterface.js b/chrome/content/links/userInterface.js
index 5ec9dc6..c0c00ce 100644
--- a/chrome/content/links/userInterface.js
+++ b/chrome/content/links/userInterface.js
@@ -44,158 +44,159 @@ Tabmix.openOptionsDialog = function TMP_openDialog(panel) {
*
*/
Tabmix.openURL = function TMP_openURL(aURL, event) {
- var linkTarget;
- try {
- linkTarget = Services.prefs.getIntPref("browser.link.open_newwindow");
- }
- catch (e) {
- linkTarget = 1;
- }
-
- if (!aURL)
- aURL = "about:blank";
-
- // check for an existing window and focus it; it's not application modal
- var browserWindow = this.getTopWin();
-
- if (!browserWindow) {
- openDialog("chrome://browser/content/browser.xul", "_blank", "chrome,all,dialog=no", aURL, null, null, null);
- if (event && event instanceof Event) {
- event.preventDefault();
- event.stopPropagation();
- }
- return true;
- }
-
- var tabBrowser = browserWindow.gBrowser;
- var originCharset = tabBrowser.selectedBrowser.characterSet;
-
- // if the current tab is empty, then do not open a new tab
- if (tabBrowser.currentURI.spec == TabmixSvc.aboutBlank) {
- // 1: CURRENT_TAB
- linkTarget = 1;
- originCharset = null;
- }
-
- switch (linkTarget) {
- case 1 :
- tabBrowser.loadURI(aURL, null, originCharset);
- break;
- case 2 :
- browserWindow.openNewWindowWith(aURL, null, null, false);
- break;
- case 3 :
- // added by request, for extensions with multiple homepages
- browserWindow.Tabmix.loadTabs(aURL.split("|"), false);
- break;
- }
-
- if (event && event instanceof Event) {
+ var linkTarget;
+ try {
+ linkTarget = Services.prefs.getIntPref("browser.link.open_newwindow");
+ }
+ catch (e) {
+ linkTarget = 1;
+ }
+
+ if (!aURL)
+ aURL = "about:blank";
+
+ // check for an existing window and focus it; it's not application modal
+ var browserWindow = this.getTopWin();
+
+ if (!browserWindow) {
+ openDialog("chrome://browser/content/browser.xul", "_blank", "chrome,all,dialog=no", aURL, null, null, null);
+ if (event && event instanceof Event) {
event.preventDefault();
event.stopPropagation();
- }
- return true;
+ }
+ return true;
+ }
+
+ var tabBrowser = browserWindow.gBrowser;
+ var originCharset = tabBrowser.selectedBrowser.characterSet;
+
+ // if the current tab is empty, then do not open a new tab
+ if (tabBrowser.currentURI.spec == TabmixSvc.aboutBlank) {
+ // 1: CURRENT_TAB
+ linkTarget = 1;
+ originCharset = null;
+ }
+
+ switch (linkTarget) {
+ case 1 :
+ tabBrowser.loadURI(aURL, null, originCharset);
+ break;
+ case 2 :
+ browserWindow.openNewWindowWith(aURL, null, null, false);
+ break;
+ case 3 :
+ // added by request, for extensions with multiple homepages
+ browserWindow.Tabmix.loadTabs(aURL.split("|"), false);
+ break;
+ }
+
+ if (event && event instanceof Event) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ return true;
};
// Don't change this function name other extensions using it
// Speed-Dial, Fast-Dial, TabGroupManager
function TMP_BrowserOpenTab(aTab, replaceLastTab) {
- var newTabContent = replaceLastTab ? Tabmix.prefs.getIntPref("replaceLastTabWith.type") :
- Tabmix.prefs.getIntPref("loadOnNewTab.type");
- var url;
- var newTabUrl = BROWSER_NEW_TAB_URL;
- var selectedTab = gBrowser.selectedTab;
- switch (newTabContent) {
- case 0 : // blank tab, by default
- url = "about:blank";
- break;
- case 1 : // home page
- url = gHomeButton.getHomePage().split("|")[0];
- break;
- case 2 : // current URI
- var currentURI = gBrowser.currentURI;
- url = currentURI ? currentURI.spec : newTabUrl;
- break;
- case 3 : // duplicate tab
- let currentUrl = gBrowser.currentURI.spec;
- let newTab = gBrowser.duplicateTab(selectedTab, null, null, null, true);
- Tabmix.clearUrlBar(newTab, currentUrl, true);
- return newTab;
- case 4 : // user url
- let prefName = replaceLastTab ? "extensions.tabmix.replaceLastTabWith.newtab.url" :
- TabmixSvc.newtabUrl;
- try {
- url = Services.prefs.getComplexValue(prefName, Ci.nsISupportsString).data;
- if (newTabUrl == "about:privatebrowsing" && url == TabmixSvc.aboutNewtab)
- url = "about:privatebrowsing";
- } catch (ex) { Tabmix.assert(ex); }
- // use this if we can't find the pref
- if (!url)
- url = newTabUrl;
- break;
- default:
- url = newTabUrl;
- }
- // if google.toolbar extension installed check google.toolbar.newtab pref
- if ("GTB_GoogleToolbarOverlay" in window) {
- try {
- if (Services.prefs.getBoolPref("google.toolbar.newtab"))
- url = "chrome://google-toolbar/content/new-tab.html";
- } catch (ex) {/* no pref - do noting */}
- }
- if (TabmixTabbar.widthFitTitle && replaceLastTab && !selectedTab.collapsed)
- selectedTab.collapsed = true;
-
- // always select new tab when replacing last tab
- var loadInBackground = replaceLastTab ? false :
- Tabmix.prefs.getBoolPref("loadNewInBackground");
- var loadBlank = isBlankPageURL(url);
- if (!TabmixSessionManager.isPrivateWindow && replaceLastTab && !loadBlank &&
- typeof privateTab == "object" && privateTab.isTabPrivate(selectedTab) &&
- TabmixSvc.prefs.get("extensions.privateTab.makeNewEmptyTabsPrivate", 0) === 0) {
- privateTab.readyToOpenTab(false);
- }
- var newTab = gBrowser.addTab(url, {
- charset: loadBlank ? null : gBrowser.selectedBrowser.characterSet,
- ownerTab: loadInBackground ? null : selectedTab,
- skipAnimation: replaceLastTab,
- dontMove: true});
- if (replaceLastTab) {
- newTab.__newLastTab = url;
- if (Services.prefs.getCharPref("general.skins.selectedSkin") == "Vista-aero") {
- gBrowser.selectedTab = newTab;
- gBrowser.updateCurrentBrowser();
- }
- if (loadBlank) {
- gBrowser.tabContainer.setAttribute("closebuttons", "noclose");
- gBrowser.tabContainer.removeAttribute("closebuttons-hover");
- }
- }
-
- // make sure to update recently used tabs
- // if user open many tabs quickly select event don't have time to fire
- // before new tab select
- if (!loadInBackground) {
+ var newTabContent = replaceLastTab ? Tabmix.prefs.getIntPref("replaceLastTabWith.type") :
+ Tabmix.prefs.getIntPref("loadOnNewTab.type");
+ var url;
+ var newTabUrl = BROWSER_NEW_TAB_URL;
+ var selectedTab = gBrowser.selectedTab;
+ switch (newTabContent) {
+ case 0 : // blank tab, by default
+ url = "about:blank";
+ break;
+ case 1 : // home page
+ url = gHomeButton.getHomePage().split("|")[0];
+ break;
+ case 2 : // current URI
+ var currentURI = gBrowser.currentURI;
+ url = currentURI ? currentURI.spec : newTabUrl;
+ break;
+ case 3 : // duplicate tab
+ let currentUrl = gBrowser.currentURI.spec;
+ let newTab = gBrowser.duplicateTab(selectedTab, null, null, null, true);
+ Tabmix.clearUrlBar(newTab, currentUrl, true);
+ return newTab;
+ case 4 : // user url
+ let prefName = replaceLastTab ? "extensions.tabmix.replaceLastTabWith.newtab.url" :
+ TabmixSvc.newtabUrl;
+ try {
+ url = Services.prefs.getComplexValue(prefName, Ci.nsISupportsString).data;
+ if (newTabUrl == "about:privatebrowsing" && url == TabmixSvc.aboutNewtab)
+ url = "about:privatebrowsing";
+ } catch (ex) { Tabmix.assert(ex); }
+ // use this if we can't find the pref
+ if (!url)
+ url = newTabUrl;
+ break;
+ default:
+ url = newTabUrl;
+ }
+ // if google.toolbar extension installed check google.toolbar.newtab pref
+ if ("GTB_GoogleToolbarOverlay" in window) {
+ try {
+ if (Services.prefs.getBoolPref("google.toolbar.newtab"))
+ url = "chrome://google-toolbar/content/new-tab.html";
+ } catch (ex) {/* no pref - do noting */}
+ }
+ if (TabmixTabbar.widthFitTitle && replaceLastTab && !selectedTab.collapsed)
+ selectedTab.collapsed = true;
+
+ // always select new tab when replacing last tab
+ var loadInBackground = replaceLastTab ? false :
+ Tabmix.prefs.getBoolPref("loadNewInBackground");
+ var loadBlank = isBlankPageURL(url);
+ if (!TabmixSessionManager.isPrivateWindow && replaceLastTab && !loadBlank &&
+ typeof privateTab == "object" && privateTab.isTabPrivate(selectedTab) &&
+ TabmixSvc.prefs.get("extensions.privateTab.makeNewEmptyTabsPrivate", 0) === 0) {
+ privateTab.readyToOpenTab(false);
+ }
+ var newTab = gBrowser.addTab(url, {
+ charset: loadBlank ? null : gBrowser.selectedBrowser.characterSet,
+ ownerTab: loadInBackground ? null : selectedTab,
+ skipAnimation: replaceLastTab,
+ dontMove: true
+ });
+ if (replaceLastTab) {
+ newTab.__newLastTab = url;
+ if (Services.prefs.getCharPref("general.skins.selectedSkin") == "Vista-aero") {
gBrowser.selectedTab = newTab;
- TMP_LastTab.PushSelectedTab();
- }
- if (aTab && aTab.localName == "tab")
- gBrowser.moveTabTo(newTab, aTab._tPos + 1);
- else if (!replaceLastTab && Tabmix.prefs.getBoolPref("openNewTabNext")) {
- // we used to move tab after lastRelatedTab but we don't need it on new tabs
- // and it mess with recently used tabs order
- gBrowser.moveTabTo(newTab, selectedTab._tPos + 1);
- }
-
- gBrowser.selectedBrowser.focus();
- // focus the address bar on new tab
- var clearUrlBar = !replaceLastTab && Tabmix.prefs.getBoolPref("selectLocationBar") ||
- replaceLastTab && Tabmix.prefs.getBoolPref("selectLocationBar.afterLastTabClosed") ||
- url == TabmixSvc.aboutBlank || url == TabmixSvc.aboutNewtab || url == "about:privatebrowsing";
- if (clearUrlBar)
- Tabmix.clearUrlBar(newTab, url, false, replaceLastTab);
-
- return newTab;
+ gBrowser.updateCurrentBrowser();
+ }
+ if (loadBlank) {
+ gBrowser.tabContainer.setAttribute("closebuttons", "noclose");
+ gBrowser.tabContainer.removeAttribute("closebuttons-hover");
+ }
+ }
+
+ // make sure to update recently used tabs
+ // if user open many tabs quickly select event don't have time to fire
+ // before new tab select
+ if (!loadInBackground) {
+ gBrowser.selectedTab = newTab;
+ TMP_LastTab.PushSelectedTab();
+ }
+ if (aTab && aTab.localName == "tab")
+ gBrowser.moveTabTo(newTab, aTab._tPos + 1);
+ else if (!replaceLastTab && Tabmix.prefs.getBoolPref("openNewTabNext")) {
+ // we used to move tab after lastRelatedTab but we don't need it on new tabs
+ // and it mess with recently used tabs order
+ gBrowser.moveTabTo(newTab, selectedTab._tPos + 1);
+ }
+
+ gBrowser.selectedBrowser.focus();
+ // focus the address bar on new tab
+ var clearUrlBar = !replaceLastTab && Tabmix.prefs.getBoolPref("selectLocationBar") ||
+ replaceLastTab && Tabmix.prefs.getBoolPref("selectLocationBar.afterLastTabClosed") ||
+ url == TabmixSvc.aboutBlank || url == TabmixSvc.aboutNewtab || url == "about:privatebrowsing";
+ if (clearUrlBar)
+ Tabmix.clearUrlBar(newTab, url, false, replaceLastTab);
+
+ return newTab;
}
Tabmix.selectedTab = null;
@@ -316,7 +317,7 @@ Tabmix.checkCurrent = function TMP_checkCurrent(url) {
if (opentabforLinks == 1 || gBrowser.mCurrentTab.hasAttribute("locked")) {
let isBlankTab = gBrowser.isBlankNotBusyTab(gBrowser.mCurrentTab);
if (!isBlankTab)
- return "tab";
+ return "tab";
}
else if (opentabforLinks == 2) {
// Get current page url
diff --git a/chrome/content/minit/minit.js b/chrome/content/minit/minit.js
index b1e3568..03aa377 100644
--- a/chrome/content/minit/minit.js
+++ b/chrome/content/minit/minit.js
@@ -278,12 +278,12 @@ var TMP_tabDNDObserver = {
case "scrollbutton-up-right":
if (Tabmix.tabsUtils.canScrollTabsLeft)
_scroll = -1;
- break;
+ break;
case "scrollbutton-down":
case "scrollbutton-down-right":
if (Tabmix.tabsUtils.canScrollTabsRight)
_scroll = 1;
- break;
+ break;
}
if (_scroll) {
let scrollIncrement = TabmixTabbar.isMultiRow ?
@@ -364,7 +364,7 @@ var TMP_tabDNDObserver = {
if (newIndex >= numPinned)
gBrowser.unpinTab(draggedTab);
} else if (newIndex <= numPinned - 1 || (newIndex == numPinned && dt.__pinTab)) {
- gBrowser.pinTab(draggedTab);
+ gBrowser.pinTab(draggedTab);
}
if (newIndex != draggedTab._tPos)
gBrowser.moveTabTo(draggedTab, newIndex);
@@ -620,22 +620,22 @@ var TMP_tabDNDObserver = {
},
getLeft_Right: function(event, newIndex, oldIndex, draggeType) {
- var mX = event.screenX;
- var left_right;
- var tab = gBrowser.tabs[newIndex];
- var tabBo = tab.boxObject;
- var ltr = Tabmix.ltr;
- var _left = ltr ? 0 : 1;
- var _right = ltr ? 1 : 0;
-
- var isCtrlKey = ((event.ctrlKey || event.metaKey) && !event.shiftKey && !event.altKey);
- var lockedTab = tab.getAttribute("locked") && !gBrowser.isBlankNotBusyTab(tab);
- if ((draggeType == this.DRAG_LINK && lockedTab) || (draggeType == this.DRAG_LINK && !lockedTab && !isCtrlKey)) {
+ var mX = event.screenX;
+ var left_right;
+ var tab = gBrowser.tabs[newIndex];
+ var tabBo = tab.boxObject;
+ var ltr = Tabmix.ltr;
+ var _left = ltr ? 0 : 1;
+ var _right = ltr ? 1 : 0;
+
+ var isCtrlKey = ((event.ctrlKey || event.metaKey) && !event.shiftKey && !event.altKey);
+ var lockedTab = tab.getAttribute("locked") && !gBrowser.isBlankNotBusyTab(tab);
+ if ((draggeType == this.DRAG_LINK && lockedTab) || (draggeType == this.DRAG_LINK && !lockedTab && !isCtrlKey)) {
left_right = (mX < tabBo.screenX + tabBo.width / 4) ? _left : _right;
if (left_right == _right && mX < tabBo.screenX + tabBo.width * 3 / 4)
- left_right = -1;
- }
- else {
+ left_right = -1;
+ }
+ else {
left_right = (mX < tabBo.screenX + tabBo.width / 2) ? _left : _right;
if (!isCtrlKey && draggeType == this.DRAG_TAB_IN_SAME_WINDOW) {
if (newIndex == oldIndex - 1)
@@ -643,9 +643,9 @@ var TMP_tabDNDObserver = {
else if (newIndex == oldIndex + 1)
left_right = ltr ? _right : _left;
}
- }
+ }
- return left_right;
+ return left_right;
},
getDragType: function minit_getDragType(aSourceNode) {
@@ -665,17 +665,17 @@ var TMP_tabDNDObserver = {
gBrowser.tabs[this.dragmarkindex.index].pinned == gBrowser.tabs[index].pinned)
return;
- this.clearDragmark();// clear old dragmark if one exist
+ this.clearDragmark();// clear old dragmark if one exist
- if (!Tabmix.prefs.getBoolPref("useFirefoxDragmark")) {
+ if (!Tabmix.prefs.getBoolPref("useFirefoxDragmark")) {
var sameRow = newIndex !== 0 && newIndex != gBrowser.tabs.length &&
- TabmixTabbar.inSameRow(gBrowser.tabs[newIndex - 1], gBrowser.tabs[newIndex]);
+ TabmixTabbar.inSameRow(gBrowser.tabs[newIndex - 1], gBrowser.tabs[newIndex]);
if (sameRow || left_right === 0)
- this.setDragmarkAttribute(gBrowser.tabs[newIndex], "atLeft");
+ this.setDragmarkAttribute(gBrowser.tabs[newIndex], "atLeft");
if (sameRow || left_right == 1)
- this.setDragmarkAttribute(gBrowser.tabs[newIndex - 1], "atRight");
- }
- else {
+ this.setDragmarkAttribute(gBrowser.tabs[newIndex - 1], "atRight");
+ }
+ else {
// code for firefox indicator
var ind = gBrowser.tabContainer._tabDropIndicator;
var minMargin, maxMargin, newMargin;
@@ -686,17 +686,17 @@ var TMP_tabDNDObserver = {
minMargin = scrollRect.left - rect.left - this.paddingLeft;
maxMargin = Math.min(minMargin + scrollRect.width, scrollRect.right);
if (!ltr)
- [minMargin, maxMargin] = [gBrowser.clientWidth - maxMargin, gBrowser.clientWidth - minMargin];
+ [minMargin, maxMargin] = [gBrowser.clientWidth - maxMargin, gBrowser.clientWidth - minMargin];
tabRect = gBrowser.tabs[index].getBoundingClientRect();
if (ltr)
- newMargin = tabRect.left - rect.left +
- (left_right == 1 ? tabRect.width + this.LinuxMarginEnd : 0) -
- this.paddingLeft;
+ newMargin = tabRect.left - rect.left +
+ (left_right == 1 ? tabRect.width + this.LinuxMarginEnd : 0) -
+ this.paddingLeft;
else
- newMargin = rect.right - tabRect.left -
- (left_right === 0 ? tabRect.width + this.LinuxMarginEnd : 0) -
- this.paddingLeft;
+ newMargin = rect.right - tabRect.left -
+ (left_right === 0 ? tabRect.width + this.LinuxMarginEnd : 0) -
+ this.paddingLeft;
///XXX fix min/max x margin when in one row the drag mark is visible after
///XXX the arrow when the last tab is partly visible
@@ -737,9 +737,9 @@ var TMP_tabDNDObserver = {
if (!Tabmix.prefs.getBoolPref("useFirefoxDragmark")) {
var index = this.dragmarkindex.newIndex;
if (index != gBrowser.tabs.length && gBrowser.tabs[index].hasAttribute("dragmark"))
- this.removetDragmarkAttribute(gBrowser.tabs[index]);
+ this.removetDragmarkAttribute(gBrowser.tabs[index]);
if (index !== 0 && gBrowser.tabs[index - 1].hasAttribute("dragmark"))
- this.removetDragmarkAttribute(gBrowser.tabs[index - 1]);
+ this.removetDragmarkAttribute(gBrowser.tabs[index - 1]);
}
else
this.setFirefoxDropIndicator(false);
@@ -891,22 +891,22 @@ Tabmix.loadTabs = function TMP_loadTabs(aURIs, aReplace) {
};
Tabmix.whereToOpen = function TMP_whereToOpen(pref, altKey) {
- var aTab = gBrowser.mCurrentTab;
- var isBlankTab = gBrowser.isBlankNotBusyTab(aTab);
- var isLockTab = !isBlankTab && aTab.hasAttribute("locked");
-
- var openTabPref = typeof (pref) == "string" ? Services.prefs.getBoolPref(pref) : pref;
- if (typeof (altKey) != "undefined") {
- // don't reuse balnk tab if the user press alt key when the pref is to open in current tab
- if (altKey && !openTabPref)
- isBlankTab = false;
-
- // see bug 315034 If search is set to open in a new tab,
- // Alt+Enter should open the search result in the current tab
- // so here we reverse the pref if user press Alt key
- openTabPref = (altKey ^ openTabPref) == 1;
- }
- return {inNew: !isBlankTab && (isLockTab || openTabPref), lock: isLockTab};
+ var aTab = gBrowser.mCurrentTab;
+ var isBlankTab = gBrowser.isBlankNotBusyTab(aTab);
+ var isLockTab = !isBlankTab && aTab.hasAttribute("locked");
+
+ var openTabPref = typeof (pref) == "string" ? Services.prefs.getBoolPref(pref) : pref;
+ if (typeof (altKey) != "undefined") {
+ // don't reuse balnk tab if the user press alt key when the pref is to open in current tab
+ if (altKey && !openTabPref)
+ isBlankTab = false;
+
+ // see bug 315034 If search is set to open in a new tab,
+ // Alt+Enter should open the search result in the current tab
+ // so here we reverse the pref if user press Alt key
+ openTabPref = (altKey ^ openTabPref) == 1;
+ }
+ return {inNew: !isBlankTab && (isLockTab || openTabPref), lock: isLockTab};
};
Tabmix.getStyle = function TMP_getStyle(aObj, aStyle) {
@@ -918,14 +918,14 @@ Tabmix.getStyle = function TMP_getStyle(aObj, aStyle) {
// sometimes context popup stay "open", we hide it manually.
Tabmix.hidePopup = function TMP_hidePopup(aPopupMenu) {
- var node = aPopupMenu.triggerNode;
- while (node && node.localName != "menubar" && node.localName != "toolbar") {
- if (node.localName == "menupopup" || node.localName == "popup") {
- if (node.hasAttribute("open")) node.removeAttribute("open");
- node.hidePopup();
- }
- node = node.parentNode;
- }
+ var node = aPopupMenu.triggerNode;
+ while (node && node.localName != "menubar" && node.localName != "toolbar") {
+ if (node.localName == "menupopup" || node.localName == "popup") {
+ if (node.hasAttribute("open")) node.removeAttribute("open");
+ node.hidePopup();
+ }
+ node = node.parentNode;
+ }
};
var TMP_TabView = { /* jshint ignore: line */
@@ -1354,7 +1354,7 @@ Tabmix.navToolbox = {
_closeButtonInitialized: false,
setCloseButtonPosition: function() {
- if (this._closeButtonInitialized)
+ if (this._closeButtonInitialized)
return;
if (!Tabmix.isVersion(310))
diff --git a/chrome/content/minit/tabView.js b/chrome/content/minit/tabView.js
index bdcbcfd..4ca8038 100644
--- a/chrome/content/minit/tabView.js
+++ b/chrome/content/minit/tabView.js
@@ -199,8 +199,7 @@
this._updateUIpageBounds = false;
};
- TabmixSessionManager._aftertWindowStateReady =
- function SM__aftertWindowStateReady(aOverwriteTabs, showNotification) {
+ TabmixSessionManager._aftertWindowStateReady = function(aOverwriteTabs, showNotification) {
if (!aOverwriteTabs)
this._groupItems = this._tabviewData["tabview-group"];
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 4739b62..f52d653 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -1,7 +1,7 @@
"use strict";
if (!window.tablib || tablib.version != "tabmixplus")
-var tablib = {
+var tablib = { // eslint-disable-line
version: "tabmixplus",
_inited: false,
init: function TMP_tablib_init() {
@@ -413,13 +413,14 @@ var tablib = {
).toCode();
// we use our own preferences observer
- if (!Tabmix.isVersion(310))
- Tabmix.changeCode(tabBar._prefObserver, "gBrowser.tabContainer._prefObserver.observe")._replace(
- 'this.tabContainer.mCloseButtons = Services.prefs.getIntPref(data);',
- 'break;'
- )._replace(
- 'this.tabContainer.updateVisibility();', '', {check: !Tabmix.isVersion(230)}
- ).toCode();
+ if (!Tabmix.isVersion(310)) {
+ Tabmix.changeCode(tabBar._prefObserver, "gBrowser.tabContainer._prefObserver.observe")._replace(
+ 'this.tabContainer.mCloseButtons = Services.prefs.getIntPref(data);',
+ 'break;'
+ )._replace(
+ 'this.tabContainer.updateVisibility();', '', {check: !Tabmix.isVersion(230)}
+ ).toCode();
+ }
if (Tabmix.isVersion(230)) {
Tabmix.changeCode(tabBar, "gBrowser.tabContainer.updateVisibility")._replace(
@@ -459,11 +460,12 @@ var tablib = {
).toCode();
// _expandSpacerBy not exsit in Firefox 21
- if (typeof tabBar._expandSpacerBy == "function")
- Tabmix.changeCode(tabBar, "gBrowser.tabContainer._expandSpacerBy")._replace(
- '{',
- '{if (TabmixTabbar.widthFitTitle || !Tabmix.tabsUtils.isSingleRow()) return;'
- ).toCode();
+ if (typeof tabBar._expandSpacerBy == "function") {
+ Tabmix.changeCode(tabBar, "gBrowser.tabContainer._expandSpacerBy")._replace(
+ '{',
+ '{if (TabmixTabbar.widthFitTitle || !Tabmix.tabsUtils.isSingleRow()) return;'
+ ).toCode();
+ }
Tabmix.changeCode(tabBar, "gBrowser.tabContainer._unlockTabSizing")._replace(
'{', '{\n' +
@@ -850,15 +852,16 @@ var tablib = {
if (popup)
popup.setAttribute("context", "tm_undocloseWindowContextMenu");
- if (!Tabmix.isVersion(290))
- Tabmix.changeCode(window, "switchToTabHavingURI")._replace(
- 'function switchIfURIInWindow',
- 'let switchIfURIInWindow = $&', {check: Tabmix._debugMode}
- )._replace(
- 'gBrowser.selectedBrowser.loadURI(aURI.spec);',
- '{$& \
- gBrowser.ensureTabIsVisible(gBrowser.selectedTab);}'
- ).toCode();
+ if (!Tabmix.isVersion(290)) {
+ Tabmix.changeCode(window, "switchToTabHavingURI")._replace(
+ 'function switchIfURIInWindow',
+ 'let switchIfURIInWindow = $&', {check: Tabmix._debugMode}
+ )._replace(
+ 'gBrowser.selectedBrowser.loadURI(aURI.spec);',
+ '{$& \
+ gBrowser.ensureTabIsVisible(gBrowser.selectedTab);}'
+ ).toCode();
+ }
if (Tabmix.isVersion(300)) {
Tabmix.changeCode(window, "BrowserOpenNewTabOrWindow")._replace(
@@ -1357,8 +1360,7 @@ var tablib = {
var temp_id, tempIndex = -1, max_id = 0;
var tabs = aTabs || this.visibleTabs;
var items = Array.filter(this.tabContainer.getElementsByAttribute("tabmix_selectedID", "*"),
- function(tab) {return !tab.hidden && !tab.closing;
- }, this);
+ tab => !tab.hidden && !tab.closing);
for (var i = 0; i < items.length; ++i) {
if (aTab && items[i] == aTab)
continue;
@@ -1443,15 +1445,15 @@ var tablib = {
};
gBrowser.stopMouseHoverSelect = function(aTab) {
- // add extra delay after tab removed or after tab flip before we select by hover
- // to let the user time to move the mouse
- if (aTab.mouseHoverSelect) {
- this.setAttribute("preventMouseHoverSelect", true);
- var delay = aTab.mouseHoverSelectDelay + 50;
- setTimeout(function removeDelayAfterClose(browser) {
- browser.removeAttribute("preventMouseHoverSelect");
- }, delay, this);
- }
+ // add extra delay after tab removed or after tab flip before we select by hover
+ // to let the user time to move the mouse
+ if (aTab.mouseHoverSelect) {
+ this.setAttribute("preventMouseHoverSelect", true);
+ var delay = aTab.mouseHoverSelectDelay + 50;
+ setTimeout(function removeDelayAfterClose(browser) {
+ browser.removeAttribute("preventMouseHoverSelect");
+ }, delay, this);
+ }
};
Object.defineProperty(gBrowser, "closingTabsEnum",
@@ -1632,17 +1634,17 @@ var tablib = {
Tabmix.setNewFunction(gBrowser, "warnAboutClosingTabs", warnAboutClosingTabs);
gBrowser.TMP_selectNewForegroundTab = function(aTab, aLoadInBackground, aUrl, addOwner) {
- var bgLoad = typeof aLoadInBackground == "boolean" ? aLoadInBackground :
- Services.prefs.getBoolPref("browser.tabs.loadInBackground");
- if (!bgLoad) {
- // set new tab owner
- addOwner = typeof addOwner == "boolean" ? addOwner : true;
- if (addOwner)
- aTab.owner = this.selectedTab;
- this.selectedTab = aTab;
- if (aUrl && Tabmix.isNewTabUrls(aUrl))
- tablib.setURLBarFocus();
- }
+ var bgLoad = typeof aLoadInBackground == "boolean" ? aLoadInBackground :
+ Services.prefs.getBoolPref("browser.tabs.loadInBackground");
+ if (!bgLoad) {
+ // set new tab owner
+ addOwner = typeof addOwner == "boolean" ? addOwner : true;
+ if (addOwner)
+ aTab.owner = this.selectedTab;
+ this.selectedTab = aTab;
+ if (aUrl && Tabmix.isNewTabUrls(aUrl))
+ tablib.setURLBarFocus();
+ }
};
Tabmix.originalFunctions.swapBrowsersAndCloseOther = gBrowser.swapBrowsersAndCloseOther;
@@ -1746,7 +1748,7 @@ var tablib = {
(!TMP_Places.inUpdateBatch || !TMP_Places.currentTab)) {
let tab = gBrowser.selectedTab;
if (Tabmix.tabsUtils.isElementVisible(tab))
- TMP_Places.currentTab = tab;
+ TMP_Places.currentTab = tab;
}
return TMP_Places.getTabTitle(aTab, url, title);
},
@@ -1948,11 +1950,11 @@ Tabmix.isNewTabUrls = function Tabmix_isNewTabUrls(aUrl) {
};
Tabmix.newTabUrls = [
- "about:newtab", "about:blank",
- "chrome://abouttab/content/text.html",
- "chrome://abouttab/content/tab.html",
- "chrome://google-toolbar/content/new-tab.html",
- "chrome://fastdial/content/fastdial.html"
+ "about:newtab", "about:blank",
+ "chrome://abouttab/content/text.html",
+ "chrome://abouttab/content/tab.html",
+ "chrome://google-toolbar/content/new-tab.html",
+ "chrome://fastdial/content/fastdial.html"
];
Tabmix.getOpenTabNextPref = function TMP_getOpenTabNextPref(aRelatedToCurrent) {
diff --git a/chrome/content/places/places.js b/chrome/content/places/places.js
index b2cc336..d4a164d 100644
--- a/chrome/content/places/places.js
+++ b/chrome/content/places/places.js
@@ -2,148 +2,148 @@
// code by onemen
var TMP_Places = {
- prefHistory: "extensions.tabmix.opentabfor.history",
- prefBookmark: "extensions.tabmix.opentabfor.bookmarks",
-
- addEvent: function TMP_PC_addEvent() {
- window.addEventListener("load", this, false);
- window.addEventListener("unload", this, false);
- },
-
- handleEvent: function TMP_PC_handleEvent(aEvent) {
- switch (aEvent.type) {
- case "load":
- window.removeEventListener("load", this, false);
- this.init();
- break;
- case "unload":
- window.removeEventListener("unload", this, false);
- this.deinit();
- break;
- }
- },
-
- init: function TMP_PC_init() {
- this.contextMenu.toggleEventListener(true);
-
- // use tab label for bookmark name when user renamed the tab
- // PlacesCommandHook exist on browser window
- if ("PlacesCommandHook" in window) {
- if (Tabmix.isVersion(400)) {
- if (!Tabmix.originalFunctions.placesBookmarkPage) {
- Tabmix.originalFunctions.placesBookmarkPage = PlacesCommandHook.bookmarkPage;
- }
- PlacesCommandHook.bookmarkPage = function(aBrowser) {
- let origTitle;
- let tab = gBrowser.getTabForBrowser(aBrowser);
- let title = TMP_Places.getTabTitle(tab, aBrowser.currentURI.spec);
- if (typeof title == "string") {
- origTitle = aBrowser.contentTitle;
- aBrowser._contentTitle = title;
- }
- try {
- return Tabmix.originalFunctions.placesBookmarkPage.apply(this, arguments);
- } finally {
- if (origTitle) {
- setTimeout(() => aBrowser._contentTitle = origTitle, 100);
- }
- }
- };
- } else {
- Tabmix.changeCode(PlacesCommandHook, "PlacesCommandHook.bookmarkPage")._replace(
- /(webNav\.document\.)*title \|\| (url|uri)\.spec;/,
- 'TMP_Places.getTabTitle(gBrowser.getTabForBrowser(aBrowser), url.spec) || $&'
- ).toCode();
- }
-
- Tabmix.changeCode(PlacesCommandHook, "uniqueCurrentPages", {getter: true})._replace(
- 'URIs.push(tab.linkedBrowser.currentURI);',
- 'let uri = tab.linkedBrowser.currentURI; \
- URIs.push({uri: uri, title: TMP_Places.getTabTitle(tab, uri.spec)});'
- ).defineProperty();
- }
+ prefHistory: "extensions.tabmix.opentabfor.history",
+ prefBookmark: "extensions.tabmix.opentabfor.bookmarks",
+
+ addEvent: function TMP_PC_addEvent() {
+ window.addEventListener("load", this, false);
+ window.addEventListener("unload", this, false);
+ },
+
+ handleEvent: function TMP_PC_handleEvent(aEvent) {
+ switch (aEvent.type) {
+ case "load":
+ window.removeEventListener("load", this, false);
+ this.init();
+ break;
+ case "unload":
+ window.removeEventListener("unload", this, false);
+ this.deinit();
+ break;
+ }
+ },
+
+ init: function TMP_PC_init() {
+ this.contextMenu.toggleEventListener(true);
- if ("PlacesViewBase" in window && PlacesViewBase.prototype) {
- Tabmix.changeCode(PlacesViewBase.prototype, "PlacesViewBase.prototype._setLivemarkSiteURIMenuItem")._replace(
- "openUILink(this.getAttribute('targetURI'), event);",
- "TMP_Places.openLivemarkSite(this.getAttribute('targetURI'), event);"
- ).toCode();
+ // use tab label for bookmark name when user renamed the tab
+ // PlacesCommandHook exist on browser window
+ if ("PlacesCommandHook" in window) {
+ if (Tabmix.isVersion(400)) {
+ if (!Tabmix.originalFunctions.placesBookmarkPage) {
+ Tabmix.originalFunctions.placesBookmarkPage = PlacesCommandHook.bookmarkPage;
+ }
+ PlacesCommandHook.bookmarkPage = function(aBrowser) {
+ let origTitle;
+ let tab = gBrowser.getTabForBrowser(aBrowser);
+ let title = TMP_Places.getTabTitle(tab, aBrowser.currentURI.spec);
+ if (typeof title == "string") {
+ origTitle = aBrowser.contentTitle;
+ aBrowser._contentTitle = title;
+ }
+ try {
+ return Tabmix.originalFunctions.placesBookmarkPage.apply(this, arguments);
+ } finally {
+ if (origTitle) {
+ setTimeout(() => aBrowser._contentTitle = origTitle, 100);
+ }
+ }
+ };
+ } else {
+ Tabmix.changeCode(PlacesCommandHook, "PlacesCommandHook.bookmarkPage")._replace(
+ /(webNav\.document\.)*title \|\| (url|uri)\.spec;/,
+ 'TMP_Places.getTabTitle(gBrowser.getTabForBrowser(aBrowser), url.spec) || $&'
+ ).toCode();
}
- // fix small bug when the event is not mouse event
- // inverse focus of middle/ctrl/meta clicked bookmarks/history
- // don't inverse focus when called from onPopupClick and One-Click Search
- // Bar Interface is on
- // when we are in single window mode set the function to return "tab"
- let $LF = '\n ';
- Tabmix.changeCode(window, "whereToOpenLink")._replace(
- 'var middle = !ignoreButton && e.button == 1;',
- 'var middle = !ignoreButton && e.button && e.button == 1;'
- )._replace(
- 'return shift ? "tabshifted" : "tab";',
- '{let pref = Tabmix.isCallerInList("openUILink", "handleLinkClick", "TMP_tabshifted", "TMP_contentLinkClick") ?\
- "extensions.tabmix.inversefocusLinks" : "extensions.tabmix.inversefocusOther";' + $LF +
- 'let notOneClickSearch = !getBoolPref("browser.search.showOneOffButtons", false) ||' + $LF +
- ' Tabmix.callerName() != "onPopupClick";' + $LF +
- 'if (notOneClickSearch && getBoolPref(pref, true))' + $LF +
- ' shift = !shift;' + $LF +
- '$&}'
- )._replace(
- 'return "window";',
- 'return Tabmix.getSingleWindowMode() ? "tab" : "window";'
- ).toCode();
+ Tabmix.changeCode(PlacesCommandHook, "uniqueCurrentPages", {getter: true})._replace(
+ 'URIs.push(tab.linkedBrowser.currentURI);',
+ 'let uri = tab.linkedBrowser.currentURI; \
+ URIs.push({uri: uri, title: TMP_Places.getTabTitle(tab, uri.spec)});'
+ ).defineProperty();
+ }
- Tabmix.changeCode(window, "openUILinkIn")._replace(
- 'params.fromChrome = true;',
- '$&\n' +
- ' if (Tabmix.isCallerInList("BG_observe"))\n' +
- ' params.inBackground = getBoolPref("browser.tabs.loadInBackground");'
+ if ("PlacesViewBase" in window && PlacesViewBase.prototype) {
+ Tabmix.changeCode(PlacesViewBase.prototype, "PlacesViewBase.prototype._setLivemarkSiteURIMenuItem")._replace(
+ "openUILink(this.getAttribute('targetURI'), event);",
+ "TMP_Places.openLivemarkSite(this.getAttribute('targetURI'), event);"
).toCode();
+ }
- // update incompatibility with X-notifier(aka WebMail Notifier) 2.9.13+
- // in case it warp the function in its object
- let [fnObj, fnName] = this.getXnotifierFunction("openLinkIn");
-
- Tabmix.changeCode(fnObj, fnName)._replace(
- /aRelatedToCurrent\s*= params.relatedToCurrent;/,
- '$& \
- var bookMarkId = params.bookMarkId;'
- )._replace(
- 'where == "current" && w.gBrowser.selectedTab.pinned',
- '$& && !params.suppressTabsOnFileDownload'
- )._replace(
- 'var w = getTopWin();',
- '$&\n' +
- ' if (w && where == "window" && !Tabmix.isNewWindowAllow(Tabmix.isVersion(200) ?\n' +
- ' aIsPrivate : false)) where = "tab";'
- )._replace(
- /Services.ww.openWindow[^;]*;/,
- 'let newWin = $&\n if (newWin && bookMarkId)\n newWin.bookMarkIds = bookMarkId;'
- )._replace(
- /(\})(\)?)$/,
- ' var tab = where == "current" ?\n' +
- ' w.gBrowser.selectedTab : w.gBrowser.getTabForLastPanel();\n' +
- ' w.TMP_Places.setTabTitle(tab, url, bookMarkId);\n' +
- ' if (where == "current")' +
- ' w.gBrowser.ensureTabIsVisible(w.gBrowser.selectedTab);' +
- '$1$2'
+ // fix small bug when the event is not mouse event
+ // inverse focus of middle/ctrl/meta clicked bookmarks/history
+ // don't inverse focus when called from onPopupClick and One-Click Search
+ // Bar Interface is on
+ // when we are in single window mode set the function to return "tab"
+ let $LF = '\n ';
+ Tabmix.changeCode(window, "whereToOpenLink")._replace(
+ 'var middle = !ignoreButton && e.button == 1;',
+ 'var middle = !ignoreButton && e.button && e.button == 1;'
+ )._replace(
+ 'return shift ? "tabshifted" : "tab";',
+ '{let pref = Tabmix.isCallerInList("openUILink", "handleLinkClick", "TMP_tabshifted", "TMP_contentLinkClick") ?\
+ "extensions.tabmix.inversefocusLinks" : "extensions.tabmix.inversefocusOther";' + $LF +
+ 'let notOneClickSearch = !getBoolPref("browser.search.showOneOffButtons", false) ||' + $LF +
+ ' Tabmix.callerName() != "onPopupClick";' + $LF +
+ 'if (notOneClickSearch && getBoolPref(pref, true))' + $LF +
+ ' shift = !shift;' + $LF +
+ '$&}'
+ )._replace(
+ 'return "window";',
+ 'return Tabmix.getSingleWindowMode() ? "tab" : "window";'
+ ).toCode();
+
+ Tabmix.changeCode(window, "openUILinkIn")._replace(
+ 'params.fromChrome = true;',
+ '$&\n' +
+ ' if (Tabmix.isCallerInList("BG_observe"))\n' +
+ ' params.inBackground = getBoolPref("browser.tabs.loadInBackground");'
+ ).toCode();
+
+ // update incompatibility with X-notifier(aka WebMail Notifier) 2.9.13+
+ // in case it warp the function in its object
+ let [fnObj, fnName] = this.getXnotifierFunction("openLinkIn");
+
+ Tabmix.changeCode(fnObj, fnName)._replace(
+ /aRelatedToCurrent\s*= params.relatedToCurrent;/,
+ '$& \
+ var bookMarkId = params.bookMarkId;'
+ )._replace(
+ 'where == "current" && w.gBrowser.selectedTab.pinned',
+ '$& && !params.suppressTabsOnFileDownload'
+ )._replace(
+ 'var w = getTopWin();',
+ '$&\n' +
+ ' if (w && where == "window" && !Tabmix.isNewWindowAllow(Tabmix.isVersion(200) ?\n' +
+ ' aIsPrivate : false)) where = "tab";'
+ )._replace(
+ /Services.ww.openWindow[^;]*;/,
+ 'let newWin = $&\n if (newWin && bookMarkId)\n newWin.bookMarkIds = bookMarkId;'
+ )._replace(
+ /(\})(\)?)$/,
+ ' var tab = where == "current" ?\n' +
+ ' w.gBrowser.selectedTab : w.gBrowser.getTabForLastPanel();\n' +
+ ' w.TMP_Places.setTabTitle(tab, url, bookMarkId);\n' +
+ ' if (where == "current")' +
+ ' w.gBrowser.ensureTabIsVisible(w.gBrowser.selectedTab);' +
+ '$1$2'
+ ).toCode();
+
+ // prevent error when closing window with sidbar open
+ var docURI = window.document.documentURI;
+ if (docURI == "chrome://browser/content/bookmarks/bookmarksPanel.xul" ||
+ docURI == "chrome://browser/content/history/history-panel.xul") {
+ let fn = "setMouseoverURL" in SidebarUtils ? "setMouseoverURL" : "clearURLFromStatusBar";
+ Tabmix.changeCode(SidebarUtils, "SidebarUtils." + fn)._replace(
+ '{',
+ '{if (window.top.XULBrowserWindow == null) return;'
).toCode();
+ }
+ },
- // prevent error when closing window with sidbar open
- var docURI = window.document.documentURI;
- if (docURI == "chrome://browser/content/bookmarks/bookmarksPanel.xul" ||
- docURI == "chrome://browser/content/history/history-panel.xul") {
- let fn = "setMouseoverURL" in SidebarUtils ? "setMouseoverURL" : "clearURLFromStatusBar";
- Tabmix.changeCode(SidebarUtils, "SidebarUtils." + fn)._replace(
- '{',
- '{if (window.top.XULBrowserWindow == null) return;'
- ).toCode();
- }
- },
-
- deinit: function TMP_PC_deinit() {
- this.stopObserver();
- },
+ deinit: function TMP_PC_deinit() {
+ this.stopObserver();
+ },
// update compatibility with X-notifier(aka WebMail Notifier) 2.9.13+
// object name wmn replace with xnotifier for version 3.0+
@@ -159,109 +159,109 @@ var TMP_Places = {
return [window, aName];
},
- historyMenuItemsTitle: function TMP_PC_historyMenuItemsTitle(aEvent) {
- if (!this._titlefrombookmark)
- return;
+ historyMenuItemsTitle: function TMP_PC_historyMenuItemsTitle(aEvent) {
+ if (!this._titlefrombookmark)
+ return;
- var aMenuPopup = aEvent.target;
- if (aMenuPopup.id != "goPopup" && aMenuPopup.id != "appmenu_historyMenupopup")
- return;
-
- for (let i = 0; i < aMenuPopup.childNodes.length; i++) {
- let item = aMenuPopup.childNodes[i];
- if ("_placesNode" in item) {
- let bookMarkName = this.getTitleFromBookmark(item._placesNode.uri);
- if (bookMarkName)
- item.setAttribute("label", bookMarkName);
- }
- }
- },
-
- // replace openlivemarksite-menuitem with tabmix function
- openLivemarkSite: function TMP_PC_openLivemarkSite(aUrl, aEvent) {
- var where = this.fixWhereToOpen(aEvent, whereToOpenLink(aEvent), this.prefBookmark);
- if (where == "current")
- Tabmix.getTopWin().gBrowser.selectedBrowser.tabmix_allowLoad = true;
- openUILinkIn(aUrl, where, {
- inBackground: Services.prefs.getBoolPref("browser.tabs.loadBookmarksInBackground"),
- initiatingDoc: aEvent ? aEvent.target.ownerDocument : null
- });
- },
-
- // we replace HistoryMenu.prototype._onCommand with this function
- // look in tablib.js
- historyMenu: function TMP_PC_historyMenu(aEvent) {
- var node = aEvent.target._placesNode;
- if (node) {
- PlacesUIUtils.markPageAsTyped(node.uri);
- this.openHistoryItem(node.uri, aEvent);
- }
- },
-
- // open PanelUI-historyItems from history button, diverted from openUILink
- openHistoryItem: function(aUri, aEvent) {
- var where = this.isBookmarklet(aUri) ? "current" :
- this.fixWhereToOpen(aEvent, whereToOpenLink(aEvent, false, true), this.prefHistory);
- if (where == "current")
- Tabmix.getTopWin().gBrowser.selectedBrowser.tabmix_allowLoad = true;
- openUILinkIn(aUri, where, {
- inBackground: Services.prefs.getBoolPref("browser.tabs.loadBookmarksInBackground"),
- initiatingDoc: aEvent ? aEvent.target.ownerDocument : null
- });
- },
-
- isBookmarklet: function(url) {
- var jsURL = /^ *javascript:/;
- return jsURL.test(url) ? true : false;
- },
-
- fixWhereToOpen: function(aEvent, aWhere, aPref) {
- var w = Tabmix.getTopWin();
- if (!w)
- return aWhere;
-
- var tabBrowser = w.gBrowser;
- var aTab = tabBrowser.mCurrentTab;
-
- if (typeof (aPref) == "undefined")
- aPref = this.getPrefByDocumentURI(window);
-
- var _pref = w.Services.prefs;
- if ((_pref.getBoolPref(aPref) || aTab.hasAttribute("locked"))) {
- if (aEvent && _pref.getBoolPref("extensions.tabmix.middlecurrent") &&
- ((aEvent instanceof MouseEvent &&
- (aEvent.button == 1 || aEvent.button === 0 && (aEvent.ctrlKey || aEvent.metaKey))) ||
- (aEvent instanceof XULCommandEvent &&
- typeof aEvent.target._placesNode == "object" && (aEvent.ctrlKey || aEvent.metaKey))))
- aWhere = "current";
- else if (aWhere == "current" && !tabBrowser.isBlankNotBusyTab(aTab))
- aWhere = "tab";
+ var aMenuPopup = aEvent.target;
+ if (aMenuPopup.id != "goPopup" && aMenuPopup.id != "appmenu_historyMenupopup")
+ return;
+
+ for (let i = 0; i < aMenuPopup.childNodes.length; i++) {
+ let item = aMenuPopup.childNodes[i];
+ if ("_placesNode" in item) {
+ let bookMarkName = this.getTitleFromBookmark(item._placesNode.uri);
+ if (bookMarkName)
+ item.setAttribute("label", bookMarkName);
}
+ }
+ },
+
+ // replace openlivemarksite-menuitem with tabmix function
+ openLivemarkSite: function TMP_PC_openLivemarkSite(aUrl, aEvent) {
+ var where = this.fixWhereToOpen(aEvent, whereToOpenLink(aEvent), this.prefBookmark);
+ if (where == "current")
+ Tabmix.getTopWin().gBrowser.selectedBrowser.tabmix_allowLoad = true;
+ openUILinkIn(aUrl, where, {
+ inBackground: Services.prefs.getBoolPref("browser.tabs.loadBookmarksInBackground"),
+ initiatingDoc: aEvent ? aEvent.target.ownerDocument : null
+ });
+ },
+
+ // we replace HistoryMenu.prototype._onCommand with this function
+ // look in tablib.js
+ historyMenu: function TMP_PC_historyMenu(aEvent) {
+ var node = aEvent.target._placesNode;
+ if (node) {
+ PlacesUIUtils.markPageAsTyped(node.uri);
+ this.openHistoryItem(node.uri, aEvent);
+ }
+ },
+
+ // open PanelUI-historyItems from history button, diverted from openUILink
+ openHistoryItem: function(aUri, aEvent) {
+ var where = this.isBookmarklet(aUri) ? "current" :
+ this.fixWhereToOpen(aEvent, whereToOpenLink(aEvent, false, true), this.prefHistory);
+ if (where == "current")
+ Tabmix.getTopWin().gBrowser.selectedBrowser.tabmix_allowLoad = true;
+ openUILinkIn(aUri, where, {
+ inBackground: Services.prefs.getBoolPref("browser.tabs.loadBookmarksInBackground"),
+ initiatingDoc: aEvent ? aEvent.target.ownerDocument : null
+ });
+ },
+
+ isBookmarklet: function(url) {
+ var jsURL = /^ *javascript:/;
+ return jsURL.test(url) ? true : false;
+ },
+ fixWhereToOpen: function(aEvent, aWhere, aPref) {
+ var w = Tabmix.getTopWin();
+ if (!w)
return aWhere;
- },
-
- getPrefByDocumentURI: function(aWindow) {
- switch (aWindow.document.documentURI) {
- case "chrome://browser/content/places/places.xul":
- let history = PlacesUIUtils.getString("OrganizerQueryHistory");
- let historyId = PlacesUIUtils.leftPaneQueries[history];
- let node = PlacesOrganizer._places.selectedNode;
- let historySelected = node.itemId == historyId ||
- node.parent && node.parent.itemId == historyId;
- if (!historySelected)
- return this.prefBookmark;
- /* falls through */
- case "chrome://browser/content/history/history-panel.xul":
- return this.prefHistory;
- case "chrome://browser/content/browser.xul":
- case "chrome://browser/content/bookmarks/bookmarksPanel.xul":
- /* falls through */
- default:
- break;
- }
- return this.prefBookmark;
- },
+
+ var tabBrowser = w.gBrowser;
+ var aTab = tabBrowser.mCurrentTab;
+
+ if (typeof (aPref) == "undefined")
+ aPref = this.getPrefByDocumentURI(window);
+
+ var _pref = w.Services.prefs;
+ if ((_pref.getBoolPref(aPref) || aTab.hasAttribute("locked"))) {
+ if (aEvent && _pref.getBoolPref("extensions.tabmix.middlecurrent") &&
+ ((aEvent instanceof MouseEvent &&
+ (aEvent.button == 1 || aEvent.button === 0 && (aEvent.ctrlKey || aEvent.metaKey))) ||
+ (aEvent instanceof XULCommandEvent &&
+ typeof aEvent.target._placesNode == "object" && (aEvent.ctrlKey || aEvent.metaKey))))
+ aWhere = "current";
+ else if (aWhere == "current" && !tabBrowser.isBlankNotBusyTab(aTab))
+ aWhere = "tab";
+ }
+
+ return aWhere;
+ },
+
+ getPrefByDocumentURI: function(aWindow) {
+ switch (aWindow.document.documentURI) {
+ case "chrome://browser/content/places/places.xul":
+ let history = PlacesUIUtils.getString("OrganizerQueryHistory");
+ let historyId = PlacesUIUtils.leftPaneQueries[history];
+ let node = PlacesOrganizer._places.selectedNode;
+ let historySelected = node.itemId == historyId ||
+ node.parent && node.parent.itemId == historyId;
+ if (!historySelected)
+ return this.prefBookmark;
+ /* falls through */
+ case "chrome://browser/content/history/history-panel.xul":
+ return this.prefHistory;
+ case "chrome://browser/content/browser.xul":
+ case "chrome://browser/content/bookmarks/bookmarksPanel.xul":
+ /* falls through */
+ default:
+ break;
+ }
+ return this.prefBookmark;
+ },
// fixed: reuse all blank tab not just in the end
// fixed: if "extensions.tabmix.loadBookmarksAndReplace" is true don't reuse
@@ -284,19 +284,19 @@ var TMP_Places = {
var aTab, reuseTabs = [], removeTabs = [], i;
var tabIsBlank, canReplace;
for (i = 0; i < tabs.length; i++) {
- aTab = tabs[i];
- tabIsBlank = gBrowser.isBlankNotBusyTab(aTab);
- // don't reuse collapsed tab if width fitTitle is set
- canReplace = (doReplace && !aTab.hasAttribute("locked") &&
+ aTab = tabs[i];
+ tabIsBlank = gBrowser.isBlankNotBusyTab(aTab);
+ // don't reuse collapsed tab if width fitTitle is set
+ canReplace = (doReplace && !aTab.hasAttribute("locked") &&
!aTab.hasAttribute("pinned")) || tabIsBlank;
- if (reuseTabs.length < bmGroup.length && canReplace)
- reuseTabs.push(aTab);
- else if ((doReplace && !aTab.hasAttribute("locked") &&
- !aTab.hasAttribute("protected") &&
- !aTab.hasAttribute("pinned")) || tabIsBlank) {
- aTab.collapsed = true;
- removeTabs.push(aTab);
- }
+ if (reuseTabs.length < bmGroup.length && canReplace)
+ reuseTabs.push(aTab);
+ else if ((doReplace && !aTab.hasAttribute("locked") &&
+ !aTab.hasAttribute("protected") &&
+ !aTab.hasAttribute("pinned")) || tabIsBlank) {
+ aTab.collapsed = true;
+ removeTabs.push(aTab);
+ }
}
var tabToSelect = null;
@@ -305,36 +305,36 @@ var TMP_Places = {
var tabPos, index;
var multiple = bmGroup.length > 1;
for (i = 0; i < bmGroup.length; i++) {
- let url = bmGroup[i];
- try { // bug 300911
- if (i < reuseTabs.length) {
- aTab = reuseTabs[i];
- let browser = gBrowser.getBrowserForTab(aTab);
- browser.userTypedValue = url;
- browser.loadURI(url);
- // setTabTitle will call TabmixTabbar.updateScrollStatus for us
- aTab.collapsed = false;
- // reset visited & tabmix_selectedID attribute
- if (!aTab.selected) {
- aTab.removeAttribute("visited");
- aTab.removeAttribute("tabmix_selectedID");
- } else
- aTab.setAttribute("reloadcurrent", true);
- }
- else
- aTab = gBrowser.addTab(url, {skipAnimation: multiple, dontMove: true});
-
- this.setTabTitle(aTab, url, bmIds[i]);
- } catch (er) { }
-
- if (!tabToSelect)
- tabToSelect = aTab;
- // move tab to place
- index = prevTab._tPos + 1;
- tabPos = aTab._tPos < index ? index - 1 : index;
- gBrowser.moveTabTo(aTab, tabPos);
- TMP_LastTab.attachTab(aTab, prevTab);
- prevTab = aTab;
+ let url = bmGroup[i];
+ try { // bug 300911
+ if (i < reuseTabs.length) {
+ aTab = reuseTabs[i];
+ let browser = gBrowser.getBrowserForTab(aTab);
+ browser.userTypedValue = url;
+ browser.loadURI(url);
+ // setTabTitle will call TabmixTabbar.updateScrollStatus for us
+ aTab.collapsed = false;
+ // reset visited & tabmix_selectedID attribute
+ if (!aTab.selected) {
+ aTab.removeAttribute("visited");
+ aTab.removeAttribute("tabmix_selectedID");
+ } else
+ aTab.setAttribute("reloadcurrent", true);
+ }
+ else
+ aTab = gBrowser.addTab(url, {skipAnimation: multiple, dontMove: true});
+
+ this.setTabTitle(aTab, url, bmIds[i]);
+ } catch (er) { }
+
+ if (!tabToSelect)
+ tabToSelect = aTab;
+ // move tab to place
+ index = prevTab._tPos + 1;
+ tabPos = aTab._tPos < index ? index - 1 : index;
+ gBrowser.moveTabTo(aTab, tabPos);
+ TMP_LastTab.attachTab(aTab, prevTab);
+ prevTab = aTab;
}
// focus the first tab if prefs say to
@@ -359,7 +359,7 @@ var TMP_Places = {
// Close any remaining open tabs or blank tabs that are left over.
while (removeTabs.length > 0) {
- gBrowser.removeTab(removeTabs.pop());
+ gBrowser.removeTab(removeTabs.pop());
}
},
@@ -367,7 +367,7 @@ var TMP_Places = {
if (!aTab || !aTab.parentNode)
return false;
if (aID && aID > -1)
- aTab.setAttribute("tabmix_bookmarkId", aID);
+ aTab.setAttribute("tabmix_bookmarkId", aID);
if (!aUrl)
aUrl = aTab.linkedBrowser.currentURI.spec;
let title = this.getTabTitle(aTab, aUrl, aTab.label);
@@ -396,24 +396,24 @@ var TMP_Places = {
return newTitle || title;
},
- _getBookmarkTitle: function(aUrl, aID) {
- let aItemId = aID.value || -1;
- try {
- if (aItemId > -1) {
- var _URI = PlacesUtils.bookmarks.getBookmarkURI(aItemId);
- if (_URI && _URI.spec == aUrl)
- return PlacesUtils.bookmarks.getItemTitle(aItemId);
- }
- } catch (ex) { }
- try {
- let uri = Services.io.newURI(aUrl, null, null);
- aItemId = aID.value = PlacesUtils.getMostRecentBookmarkForURI(uri);
- if (aItemId > -1)
- return PlacesUtils.bookmarks.getItemTitle(aItemId);
- } catch (ex) { }
- aID.value = null;
- return null;
- },
+ _getBookmarkTitle: function(aUrl, aID) {
+ let aItemId = aID.value || -1;
+ try {
+ if (aItemId > -1) {
+ var _URI = PlacesUtils.bookmarks.getBookmarkURI(aItemId);
+ if (_URI && _URI.spec == aUrl)
+ return PlacesUtils.bookmarks.getItemTitle(aItemId);
+ }
+ } catch (ex) { }
+ try {
+ let uri = Services.io.newURI(aUrl, null, null);
+ aItemId = aID.value = PlacesUtils.getMostRecentBookmarkForURI(uri);
+ if (aItemId > -1)
+ return PlacesUtils.bookmarks.getItemTitle(aItemId);
+ } catch (ex) { }
+ aID.value = null;
+ return null;
+ },
get _titlefrombookmark() {
delete this._titlefrombookmark;
diff --git a/chrome/content/preferences/overlay/preferencesOverlay.js b/chrome/content/preferences/overlay/preferencesOverlay.js
index 89057ac..c1a3def 100644
--- a/chrome/content/preferences/overlay/preferencesOverlay.js
+++ b/chrome/content/preferences/overlay/preferencesOverlay.js
@@ -39,56 +39,56 @@ var gTabMix_preferencesOverlay = { // jshint ignore:line
},
/* ........ paneTabs .............. */
- initPaneTabsOptions: function() {
- this.id("_hideTabbar").value = this.id("extensions.tabmix.hideTabbar").value;
- this.id("generalWindowOpen").value = this.id("browser.link.open_newwindow").value;
- this.id("warnCloseMultiple").checked = this.id("extensions.tabmix.tabs.warnOnClose").value;
- this.id("warnOnCloseWindow").checked = this.id("browser.tabs.warnOnClose").value;
- this.id("warnOnCloseProtected").checked = this.id("extensions.tabmix.protectedtabs.warnOnClose").value;
- this.setSingleWindowUI();
- },
+ initPaneTabsOptions: function() {
+ this.id("_hideTabbar").value = this.id("extensions.tabmix.hideTabbar").value;
+ this.id("generalWindowOpen").value = this.id("browser.link.open_newwindow").value;
+ this.id("warnCloseMultiple").checked = this.id("extensions.tabmix.tabs.warnOnClose").value;
+ this.id("warnOnCloseWindow").checked = this.id("browser.tabs.warnOnClose").value;
+ this.id("warnOnCloseProtected").checked = this.id("extensions.tabmix.protectedtabs.warnOnClose").value;
+ this.setSingleWindowUI();
+ },
- setSingleWindowUI: function() {
- var val = TabmixSvc.prefBranch.getBoolPref("singleWindow");
- let item = this.id("linkTargetWindow");
- item.disabled = val;
- if (val)
- item.setAttribute("style", "color: graytext !important; text-shadow: none !important;");
- else
- item.removeAttribute("style");
- },
+ setSingleWindowUI: function() {
+ var val = TabmixSvc.prefBranch.getBoolPref("singleWindow");
+ let item = this.id("linkTargetWindow");
+ item.disabled = val;
+ if (val)
+ item.setAttribute("style", "color: graytext !important; text-shadow: none !important;");
+ else
+ item.removeAttribute("style");
+ },
- showTabmixOptions: function(panel) {
- var windowMediator = Services.wm;
- var browserWindow = windowMediator.getMostRecentWindow('navigator:browser');
+ showTabmixOptions: function(panel) {
+ var windowMediator = Services.wm;
+ var browserWindow = windowMediator.getMostRecentWindow('navigator:browser');
- if (!browserWindow) {
- let tabmixopt = windowMediator.getMostRecentWindow("mozilla:tabmixopt");
- if (tabmixopt)
- tabmixopt.close();
- let title = TabmixSvc.getString("tabmixoption.error.title");
- let msg = TabmixSvc.getString("tabmixoption.error.msg");
- Services.prompt.alert(window, title, msg);
- }
- else
- browserWindow.Tabmix.openOptionsDialog(panel);
- },
+ if (!browserWindow) {
+ let tabmixopt = windowMediator.getMostRecentWindow("mozilla:tabmixopt");
+ if (tabmixopt)
+ tabmixopt.close();
+ let title = TabmixSvc.getString("tabmixoption.error.title");
+ let msg = TabmixSvc.getString("tabmixoption.error.msg");
+ Services.prompt.alert(window, title, msg);
+ }
+ else
+ browserWindow.Tabmix.openOptionsDialog(panel);
+ },
/* ........ paneMain .............. */
- initMainPane: function() {
- var menuList = this.id("browserStartupPage");
- var hBox = menuList.parentNode;
- menuList.parentNode.id = "whenBrowserStartBox";
- hBox.insertBefore(this.id("tabmixSessionManager"), menuList);
- this.onStartupPrefchanged();
- },
+ initMainPane: function() {
+ var menuList = this.id("browserStartupPage");
+ var hBox = menuList.parentNode;
+ menuList.parentNode.id = "whenBrowserStartBox";
+ hBox.insertBefore(this.id("tabmixSessionManager"), menuList);
+ this.onStartupPrefchanged();
+ },
- onStartupPrefchanged: function() {
- var tabmixSession = this.id('tabmix.sm').value || this.id('tabmix.cr').value;
- if (tabmixSession)
- this.id("whenBrowserStartBox").setAttribute("tabmixSession", true);
- else
- this.id("whenBrowserStartBox").removeAttribute("tabmixSession");
- }
+ onStartupPrefchanged: function() {
+ var tabmixSession = this.id('tabmix.sm').value || this.id('tabmix.cr').value;
+ if (tabmixSession)
+ this.id("whenBrowserStartBox").setAttribute("tabmixSession", true);
+ else
+ this.id("whenBrowserStartBox").removeAttribute("tabmixSession");
+ }
};
diff --git a/chrome/content/preferences/preferences.js b/chrome/content/preferences/preferences.js
index dc0c317..c8bd00e 100644
--- a/chrome/content/preferences/preferences.js
+++ b/chrome/content/preferences/preferences.js
@@ -87,22 +87,22 @@ var gPrefWindow = { // jshint ignore:line
handleEvent: function(aEvent) {
switch (aEvent.type) {
- case "change":
- if (aEvent.target.localName != "preference")
- return;
- this.updateBroadcaster(aEvent.target);
- if (!this.instantApply)
- this.updateApplyButton(aEvent);
- break;
- case "beforeaccept":
- if (this.widthChanged)
- gAppearancePane.changeTabsWidth();
- if (!this.instantApply) {
- // prevent TMP_SessionStore.setService from runing
- Tabmix.getTopWin().tabmix_setSession = true;
- Shortcuts.prefsChangedByTabmix = true;
- }
- break;
+ case "change":
+ if (aEvent.target.localName != "preference")
+ return;
+ this.updateBroadcaster(aEvent.target);
+ if (!this.instantApply)
+ this.updateApplyButton(aEvent);
+ break;
+ case "beforeaccept":
+ if (this.widthChanged)
+ gAppearancePane.changeTabsWidth();
+ if (!this.instantApply) {
+ // prevent TMP_SessionStore.setService from runing
+ Tabmix.getTopWin().tabmix_setSession = true;
+ Shortcuts.prefsChangedByTabmix = true;
+ }
+ break;
}
},
@@ -298,17 +298,17 @@ function setPrefAfterImport(aPref) {
// preference that exist in the defaulbranch but no longer in use by Tabmix
switch (aPref.name) {
- case "browser.tabs.autoHide":
- // from tabmix 0.3.6.0.080223 we use extensions.tabmix.hideTabbar
- Tabmix.prefs.setIntPref("hideTabbar", aPref.value ? 1 : 0);
- return true;
- case "browser.tabs.closeButtons":
- // we use browser.tabs.closeButtons only in 0.3.8.3
- if (aPref.value < 0 || aPref.value > 6)
- aPref.value = 6;
- aPref.value = [3, 5, 1, 1, 2, 4, 1][aPref.value];
- Tabmix.prefs.setIntPref("tabs.closeButtons", aPref.value);
- return true;
+ case "browser.tabs.autoHide":
+ // from tabmix 0.3.6.0.080223 we use extensions.tabmix.hideTabbar
+ Tabmix.prefs.setIntPref("hideTabbar", aPref.value ? 1 : 0);
+ return true;
+ case "browser.tabs.closeButtons":
+ // we use browser.tabs.closeButtons only in 0.3.8.3
+ if (aPref.value < 0 || aPref.value > 6)
+ aPref.value = 6;
+ aPref.value = [3, 5, 1, 1, 2, 4, 1][aPref.value];
+ Tabmix.prefs.setIntPref("tabs.closeButtons", aPref.value);
+ return true;
}
// don't do anything if user locked a preference
@@ -576,9 +576,9 @@ var gIncompatiblePane = {
},
checkForIncompatible: function(aShowList) {
- let tmp = {};
- Components.utils.import("resource://tabmixplus/extensions/CompatibilityCheck.jsm", tmp);
- tmp = new tmp.CompatibilityCheck(window, aShowList, true);
+ let tmp = {};
+ Components.utils.import("resource://tabmixplus/extensions/CompatibilityCheck.jsm", tmp);
+ tmp = new tmp.CompatibilityCheck(window, aShowList, true);
},
// call back function from CompatibilityCheck.jsm
diff --git a/chrome/content/preferences/subdialogs/pref-filetype.js b/chrome/content/preferences/subdialogs/pref-filetype.js
index aad1c50..e90e473 100644
--- a/chrome/content/preferences/subdialogs/pref-filetype.js
+++ b/chrome/content/preferences/subdialogs/pref-filetype.js
@@ -3,148 +3,148 @@
var list, entry, edit, del, add;
function Init() {
- // set these once and refer to them later
- list = document.getElementById('filetypeList');
- entry = document.getElementById('filetypeEntry');
- edit = document.getElementById('filetypeEdit');
- del = document.getElementById('filetypeDelete');
- add = document.getElementById('filetypeAdd');
-
- FillData();
+ // set these once and refer to them later
+ list = document.getElementById('filetypeList');
+ entry = document.getElementById('filetypeEntry');
+ edit = document.getElementById('filetypeEdit');
+ del = document.getElementById('filetypeDelete');
+ add = document.getElementById('filetypeAdd');
+
+ FillData();
}
function FillData() {
- // remove all the item from the list
- while (list.hasChildNodes()) {
+ // remove all the item from the list
+ while (list.hasChildNodes()) {
list.removeChild(list.lastChild);
- }
-
- var data, items, item;
- try {
- data = Services.prefs.getCharPref(list.getAttribute('prefstring'));
- }
- catch (e) {}
-
- if (!data.length) {
- setButtonDisable(del, true);
- return true;
- }
-
- items = data.split(' ');
- for (var i = 0; i < items.length; ++i) {
- if (items[i] === "") continue;
- item = items[i].trim();
- list.appendItem(item, item.toLowerCase());
- }
-
- list.selectedIndex = 0;
- list.focus();
- return true;
+ }
+
+ var data, items, item;
+ try {
+ data = Services.prefs.getCharPref(list.getAttribute('prefstring'));
+ }
+ catch (e) {}
+
+ if (!data.length) {
+ setButtonDisable(del, true);
+ return true;
+ }
+
+ items = data.split(' ');
+ for (var i = 0; i < items.length; ++i) {
+ if (items[i] === "") continue;
+ item = items[i].trim();
+ list.appendItem(item, item.toLowerCase());
+ }
+
+ list.selectedIndex = 0;
+ list.focus();
+ return true;
}
function Save() {
- var filetype = [];
- for (var i = 0; i < list.getRowCount(); ++i)
- filetype.push(list.getItemAtIndex(i).getAttribute("label").trim());
-
- try {
- Services.prefs.setCharPref(list.getAttribute('prefstring'), filetype.join(" "));
- }
- catch (ex) {Tabmix.assert(ex, "error in filetype: " + filetype);}
- return true;
+ var filetype = [];
+ for (var i = 0; i < list.getRowCount(); ++i)
+ filetype.push(list.getItemAtIndex(i).getAttribute("label").trim());
+
+ try {
+ Services.prefs.setCharPref(list.getAttribute('prefstring'), filetype.join(" "));
+ }
+ catch (ex) {Tabmix.assert(ex, "error in filetype: " + filetype);}
+ return true;
}
// sets the textbox to the currently selected item, if any
function Select() {
- setButtonDisable(add, true);
- setButtonDisable(edit, true);
-
- if (!list.selectedItem) {
- setButtonDisable(del, true);
- return false;
- }
- entry.value = list.selectedItem.getAttribute("label");
- setButtonDisable(del, false);
- return true;
+ setButtonDisable(add, true);
+ setButtonDisable(edit, true);
+
+ if (!list.selectedItem) {
+ setButtonDisable(del, true);
+ return false;
+ }
+ entry.value = list.selectedItem.getAttribute("label");
+ setButtonDisable(del, false);
+ return true;
}
function Add() {
- // check for data in the textbox
- if (!entry.value) return false;
+ // check for data in the textbox
+ if (!entry.value) return false;
- list.appendItem(entry.value, entry.value.toLowerCase());
+ list.appendItem(entry.value, entry.value.toLowerCase());
- SelectItemAt(list.getRowCount() - 1, true);
- setButtonDisable(del, false);
- return true;
+ SelectItemAt(list.getRowCount() - 1, true);
+ setButtonDisable(del, false);
+ return true;
}
function Mod() {
- // check for data in the textbox
- if (!entry.value) return false;
+ // check for data in the textbox
+ if (!entry.value) return false;
- // make sure an item is selected, else create a new item
- if (!list.selectedItem) return Add();
+ // make sure an item is selected, else create a new item
+ if (!list.selectedItem) return Add();
- // change the text
- list.selectedItem.setAttribute("label", entry.value);
- list.selectedItem.setAttribute("value", entry.value.toLowerCase());
- SelectItemAt(list.getIndexOfItem(list.selectedItem), false);
+ // change the text
+ list.selectedItem.setAttribute("label", entry.value);
+ list.selectedItem.setAttribute("value", entry.value.toLowerCase());
+ SelectItemAt(list.getIndexOfItem(list.selectedItem), false);
- setButtonDisable(add, true);
- setButtonDisable(edit, true);
- return true;
+ setButtonDisable(add, true);
+ setButtonDisable(edit, true);
+ return true;
}
function Input() {
- if (!entry.value) {
+ if (!entry.value) {
+ setButtonDisable(edit, true);
+ setButtonDisable(add, true);
+ } else {
+ // chack if the input value is in the list
+ var items = list.getElementsByAttribute("value", entry.value.toLowerCase());
+ if (items.length > 0) {
+ SelectItemAt(list.getIndexOfItem(items[0]), false);
setButtonDisable(edit, true);
setButtonDisable(add, true);
- } else {
- // chack if the input value is in the list
- var items = list.getElementsByAttribute("value", entry.value.toLowerCase());
- if (items.length > 0) {
- SelectItemAt(list.getIndexOfItem(items[0]), false);
- setButtonDisable(edit, true);
- setButtonDisable(add, true);
- } else {
- if (list.selectedItem) setButtonDisable(edit, false);
- setButtonDisable(add, false);
- }
- }
+ } else {
+ if (list.selectedItem) setButtonDisable(edit, false);
+ setButtonDisable(add, false);
+ }
+ }
}
function Del() {
- var item = list.selectedItem;
- if (!item) return;
- var index = list.getIndexOfItem(item);
- // if the list is not empty select next item or if we at the end the last item
- if (list.getRowCount() > 1)
- SelectItemAt(index == list.getRowCount() - 1 ? index - 1 : index + 1, true);
- else
- entry.value = null;
- list.removeChild(item);
+ var item = list.selectedItem;
+ if (!item) return;
+ var index = list.getIndexOfItem(item);
+ // if the list is not empty select next item or if we at the end the last item
+ if (list.getRowCount() > 1)
+ SelectItemAt(index == list.getRowCount() - 1 ? index - 1 : index + 1, true);
+ else
+ entry.value = null;
+ list.removeChild(item);
}
function Restore() {
- Save();
- var pref = "filetype";
- if (Tabmix.prefs.prefHasUserValue(pref))
- Tabmix.prefs.clearUserPref(pref);
- FillData();
+ Save();
+ var pref = "filetype";
+ if (Tabmix.prefs.prefHasUserValue(pref))
+ Tabmix.prefs.clearUserPref(pref);
+ FillData();
}
// select new item and focus the list
function SelectItemAt(index, focus) {
- list.ensureIndexIsVisible(index);
- list.selectedIndex = index;
- if (focus) list.focus();
+ list.ensureIndexIsVisible(index);
+ list.selectedIndex = index;
+ if (focus) list.focus();
}
function setButtonDisable(button, set) {
- if (set) {
- button.setAttribute("disabled", true);
- } else {
- button.removeAttribute("disabled");
- }
+ if (set) {
+ button.setAttribute("disabled", true);
+ } else {
+ button.removeAttribute("disabled");
+ }
}
diff --git a/chrome/content/session/promptservice.js b/chrome/content/session/promptservice.js
index acc23b2..4c01da8 100644
--- a/chrome/content/session/promptservice.js
+++ b/chrome/content/session/promptservice.js
@@ -1,240 +1,240 @@
"use strict";
- const TMP_BUTTON_OK = 0;
- const TMP_BUTTON_CANCEL = 1;
- const TMP_BUTTON_EXTRA1 = 2;
- const TMP_SHOW_MENULIST = 1;
- const TMP_SHOW_TEXTBOX = 0;
- const TMP_HIDE_MENUANDTEXT = 2;
- const TMP_CHECKBOX_UNCHECKED = 0;
- const TMP_CHECKBOX_CHECKED = 1;
- const TMP_HIDE_CHECKBOX = 2;
- const TMP_SELECT_DEFAULT = 0;
- const TMP_SELECT_LASTSESSION = 1;
- const TMP_SELECT_CRASH = 2;
- const TMP_SHOW_CLOSED_WINDOW_LIST = 3;
- const TMP_DLG_SAVE = 0;
- const TMP_DLG_RENAME = 1;
-
- var dialogParams, gHideElmParam, gSavedName, gCancelLabel, gOrigName;
-
- function prompt_init() {
- dialogParams = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);
- document.title = dialogParams.GetString(0);
-
- // display the main text
- var i, messageText = dialogParams.GetString(1);
- var messageParent = document.getElementById("tm_info");
- var messageParagraphs = messageText.split("\n");
- gHideElmParam = dialogParams.GetInt(1);
- for (i = 0; i < messageParagraphs.length; i++) {
- var descriptionNode = document.createElement("description");
- var text = document.createTextNode(messageParagraphs[i]);
- descriptionNode.appendChild(text);
- messageParent.appendChild(descriptionNode);
- }
-
- // display the menulist
- gHideElmParam = dialogParams.GetInt(1);
- var menuList = document.getElementById("tm_prompt");
- if (gHideElmParam == TMP_SHOW_MENULIST) {
- var index, isDisabled, popup = document.getElementById("tm_prompt_menu");
- if (dialogParams.GetInt(4) == 1)
- window.opener.Tabmix.Sessions.createMenuForDialog(popup, dialogParams.GetInt(3));
- else
- window.opener.TabmixSessionManager.createMenuForDialog(popup, dialogParams.GetInt(3));
- switch (dialogParams.GetInt(3)) {
- case TMP_SELECT_CRASH: index = popup.childNodes.length - 1;
- break;
- case TMP_SHOW_CLOSED_WINDOW_LIST: index = 1; // 0 is menuseparator
- break;
- default:
- index = menuList.defaultIndex;
- if (index >= popup.childNodes.length || index < 0) index = 1;
- isDisabled = popup.childNodes[index].getAttribute("disabled") == "true";
- // select the first entry that isn't menuseparator and not "disabled"
- if (!isDisabled) break;
- var item;
- for (i = 1; i < popup.childNodes.length; ++i) {
- item = popup.childNodes[i];
- if (item.localName == "menuseparator") continue;
- if (item.getAttribute("disabled") != "true") {
- index = i;
- break;
- }
- }
- }
- menuList.selectedIndex = index;
- } else menuList.hidden = true;
-
- // display the textBox
- var textBox = document.getElementById("tm_textbox");
- if (gHideElmParam == TMP_SHOW_TEXTBOX) {
- messageParent.lastChild.setAttribute("style", "height:3em");
- gSavedName = dialogParams.GetString(2).split("\n");
- textBox.value = gSavedName.shift();
- gOrigName = textBox.value.toLowerCase();
- }
- else textBox.hidden = true;
-
- // display the checkbox
- var checkBox = document.getElementById("tm_checkbox");
- var check = dialogParams.GetInt(2);
- if (check != TMP_HIDE_CHECKBOX) {
- document.getElementById("checkboxContainer").removeAttribute("collapsed");
- checkBox.checked = check == TMP_CHECKBOX_CHECKED;
- setLabelForNode(checkBox, dialogParams.GetString(3));
- }
-
- // display the command buttons
- var aButtons, buttons = ["accept", "cancel", "extra1"];
- var btnLabels = dialogParams.GetString(4).split("\n");
- for (i = 0; i < buttons.length; ++i) {
- aButtons = document.documentElement.getButton(buttons[i]);
- if (i < btnLabels.length && btnLabels[i] !== "") {
- setLabelForNode(aButtons, btnLabels[i]);
- }
- else aButtons.hidden = true; // hide extra button
- }
-
- // Set and focus default button
- var dButton = buttons[dialogParams.GetInt(0)];
- var dialog = document.documentElement;
- dialog.defaultButton = dButton;
- if (gHideElmParam == TMP_HIDE_MENUANDTEXT) { // hide menulist & text box and set focus to default Button
- document.getElementById("space_befor_checkbox").hidden = true;
- dialog.getButton(dButton).focus();
- }
-
- if (gHideElmParam == TMP_SHOW_TEXTBOX) {
- dialog.getButton("extra1").hidden = true;
- gCancelLabel = dialog.getButton("cancel").label;
- inputText(textBox);
- }
-
- // Move to the right location
- moveToAlertPosition();
- centerWindowOnScreen();
- }
-
- function prompt_deinit(button) {
- dialogParams.SetInt(4, button); // ok = 0; cancel = 1; extra1 = 2;
- dialogParams.SetInt(5, document.getElementById("tm_checkbox").checked);
- if (gHideElmParam < TMP_HIDE_MENUANDTEXT) {
- if (gHideElmParam == TMP_SHOW_MENULIST) {
- var item = document.getElementById("tm_prompt").selectedItem;
-///XXX item.fileName - in the new Tabmix.Sessions
- dialogParams.SetString(5, item.session || item.fileName);
- dialogParams.SetInt(6, item.getAttribute("value"));
- }
- else dialogParams.SetString(5, document.getElementById("tm_textbox").value);
- }
- // if we are not a modal use a callback function
- if (typeof window._callBackFunction == "function") {
- if (window.opener && !window.opener.closed) {
- let returnData = {button: dialogParams.GetInt(4),
- checked: (dialogParams.GetInt(5) == TMP_CHECKBOX_CHECKED),
- label: dialogParams.GetString(5),
- value: dialogParams.GetInt(6)};
- try {
- window._callBackFunction(returnData);
- } catch (ex) {Tabmix.assert(ex, "error in callback " + window._callBackFunction.name);}
+const TMP_BUTTON_OK = 0;
+const TMP_BUTTON_CANCEL = 1;
+const TMP_BUTTON_EXTRA1 = 2;
+const TMP_SHOW_MENULIST = 1;
+const TMP_SHOW_TEXTBOX = 0;
+const TMP_HIDE_MENUANDTEXT = 2;
+const TMP_CHECKBOX_UNCHECKED = 0;
+const TMP_CHECKBOX_CHECKED = 1;
+const TMP_HIDE_CHECKBOX = 2;
+const TMP_SELECT_DEFAULT = 0;
+const TMP_SELECT_LASTSESSION = 1;
+const TMP_SELECT_CRASH = 2;
+const TMP_SHOW_CLOSED_WINDOW_LIST = 3;
+const TMP_DLG_SAVE = 0;
+const TMP_DLG_RENAME = 1;
+
+var dialogParams, gHideElmParam, gSavedName, gCancelLabel, gOrigName;
+
+function prompt_init() {
+ dialogParams = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);
+ document.title = dialogParams.GetString(0);
+
+ // display the main text
+ var i, messageText = dialogParams.GetString(1);
+ var messageParent = document.getElementById("tm_info");
+ var messageParagraphs = messageText.split("\n");
+ gHideElmParam = dialogParams.GetInt(1);
+ for (i = 0; i < messageParagraphs.length; i++) {
+ var descriptionNode = document.createElement("description");
+ var text = document.createTextNode(messageParagraphs[i]);
+ descriptionNode.appendChild(text);
+ messageParent.appendChild(descriptionNode);
+ }
+
+ // display the menulist
+ gHideElmParam = dialogParams.GetInt(1);
+ var menuList = document.getElementById("tm_prompt");
+ if (gHideElmParam == TMP_SHOW_MENULIST) {
+ var index, isDisabled, popup = document.getElementById("tm_prompt_menu");
+ if (dialogParams.GetInt(4) == 1)
+ window.opener.Tabmix.Sessions.createMenuForDialog(popup, dialogParams.GetInt(3));
+ else
+ window.opener.TabmixSessionManager.createMenuForDialog(popup, dialogParams.GetInt(3));
+ switch (dialogParams.GetInt(3)) {
+ case TMP_SELECT_CRASH: index = popup.childNodes.length - 1;
+ break;
+ case TMP_SHOW_CLOSED_WINDOW_LIST: index = 1; // 0 is menuseparator
+ break;
+ default:
+ index = menuList.defaultIndex;
+ if (index >= popup.childNodes.length || index < 0) index = 1;
+ isDisabled = popup.childNodes[index].getAttribute("disabled") == "true";
+ // select the first entry that isn't menuseparator and not "disabled"
+ if (!isDisabled) break;
+ var item;
+ for (i = 1; i < popup.childNodes.length; ++i) {
+ item = popup.childNodes[i];
+ if (item.localName == "menuseparator") continue;
+ if (item.getAttribute("disabled") != "true") {
+ index = i;
+ break;
+ }
}
- window._callBackFunction = null;
- }
- }
-
- function prompt_extra1(button) {
- prompt_deinit(button);
- window.close();
- }
-
- // copy from commonDialog.js
- function setLabelForNode(aNode, aLabel, aIsLabelFlag) {
- var accessKey = null;
- if (/ *\(\&([^&])\)(:?)$/.test(aLabel)) {
- aLabel = RegExp.leftContext + RegExp.$2;
- accessKey = RegExp.$1;
- } else if (/^([^&]*)\&(([^&]).*$)/.test(aLabel)) {
- aLabel = RegExp.$1 + RegExp.$2;
- accessKey = RegExp.$3;
- }
-
- // && is the magic sequence to embed an & in your label.
- aLabel = aLabel.replace(/\&\&/g, "&");
- if (aIsLabelFlag) { // Set text for <label> element
- aNode.setAttribute("value", aLabel);
- } else { // Set text for other xul elements
- aNode.label = aLabel;
- }
-
- // Need to set this after aNode.setAttribute("value", aLabel);
- if (accessKey)
- aNode.accessKey = accessKey;
- }
-
- function inputText(textBox) {
- var btnOK = document.documentElement.getButton("accept");
- var btnCancel = document.documentElement.getButton("cancel");
- var btnExt = document.documentElement.getButton("extra1");
- var msg = [];
- msg[0] = "";
- /**
+ }
+ menuList.selectedIndex = index;
+ } else menuList.hidden = true;
+
+ // display the textBox
+ var textBox = document.getElementById("tm_textbox");
+ if (gHideElmParam == TMP_SHOW_TEXTBOX) {
+ messageParent.lastChild.setAttribute("style", "height:3em");
+ gSavedName = dialogParams.GetString(2).split("\n");
+ textBox.value = gSavedName.shift();
+ gOrigName = textBox.value.toLowerCase();
+ }
+ else textBox.hidden = true;
+
+ // display the checkbox
+ var checkBox = document.getElementById("tm_checkbox");
+ var check = dialogParams.GetInt(2);
+ if (check != TMP_HIDE_CHECKBOX) {
+ document.getElementById("checkboxContainer").removeAttribute("collapsed");
+ checkBox.checked = check == TMP_CHECKBOX_CHECKED;
+ setLabelForNode(checkBox, dialogParams.GetString(3));
+ }
+
+ // display the command buttons
+ var aButtons, buttons = ["accept", "cancel", "extra1"];
+ var btnLabels = dialogParams.GetString(4).split("\n");
+ for (i = 0; i < buttons.length; ++i) {
+ aButtons = document.documentElement.getButton(buttons[i]);
+ if (i < btnLabels.length && btnLabels[i] !== "") {
+ setLabelForNode(aButtons, btnLabels[i]);
+ }
+ else aButtons.hidden = true; // hide extra button
+ }
+
+ // Set and focus default button
+ var dButton = buttons[dialogParams.GetInt(0)];
+ var dialog = document.documentElement;
+ dialog.defaultButton = dButton;
+ if (gHideElmParam == TMP_HIDE_MENUANDTEXT) { // hide menulist & text box and set focus to default Button
+ document.getElementById("space_befor_checkbox").hidden = true;
+ dialog.getButton(dButton).focus();
+ }
+
+ if (gHideElmParam == TMP_SHOW_TEXTBOX) {
+ dialog.getButton("extra1").hidden = true;
+ gCancelLabel = dialog.getButton("cancel").label;
+ inputText(textBox);
+ }
+
+ // Move to the right location
+ moveToAlertPosition();
+ centerWindowOnScreen();
+}
+
+function prompt_deinit(button) {
+ dialogParams.SetInt(4, button); // ok = 0; cancel = 1; extra1 = 2;
+ dialogParams.SetInt(5, document.getElementById("tm_checkbox").checked);
+ if (gHideElmParam < TMP_HIDE_MENUANDTEXT) {
+ if (gHideElmParam == TMP_SHOW_MENULIST) {
+ var item = document.getElementById("tm_prompt").selectedItem;
+ ///XXX item.fileName - in the new Tabmix.Sessions
+ dialogParams.SetString(5, item.session || item.fileName);
+ dialogParams.SetInt(6, item.getAttribute("value"));
+ }
+ else dialogParams.SetString(5, document.getElementById("tm_textbox").value);
+ }
+ // if we are not a modal use a callback function
+ if (typeof window._callBackFunction == "function") {
+ if (window.opener && !window.opener.closed) {
+ let returnData = {button: dialogParams.GetInt(4),
+ checked: (dialogParams.GetInt(5) == TMP_CHECKBOX_CHECKED),
+ label: dialogParams.GetString(5),
+ value: dialogParams.GetInt(6)};
+ try {
+ window._callBackFunction(returnData);
+ } catch (ex) {Tabmix.assert(ex, "error in callback " + window._callBackFunction.name);}
+ }
+ window._callBackFunction = null;
+ }
+}
+
+function prompt_extra1(button) {
+ prompt_deinit(button);
+ window.close();
+}
+
+// copy from commonDialog.js
+function setLabelForNode(aNode, aLabel, aIsLabelFlag) {
+ var accessKey = null;
+ if (/ *\(\&([^&])\)(:?)$/.test(aLabel)) {
+ aLabel = RegExp.leftContext + RegExp.$2;
+ accessKey = RegExp.$1;
+ } else if (/^([^&]*)\&(([^&]).*$)/.test(aLabel)) {
+ aLabel = RegExp.$1 + RegExp.$2;
+ accessKey = RegExp.$3;
+ }
+
+ // && is the magic sequence to embed an & in your label.
+ aLabel = aLabel.replace(/\&\&/g, "&");
+ if (aIsLabelFlag) { // Set text for <label> element
+ aNode.setAttribute("value", aLabel);
+ } else { // Set text for other xul elements
+ aNode.label = aLabel;
+ }
+
+ // Need to set this after aNode.setAttribute("value", aLabel);
+ if (accessKey)
+ aNode.accessKey = accessKey;
+}
+
+function inputText(textBox) {
+ var btnOK = document.documentElement.getButton("accept");
+ var btnCancel = document.documentElement.getButton("cancel");
+ var btnExt = document.documentElement.getButton("extra1");
+ var msg = [];
+ msg[0] = "";
+ /**
var msg1 = "Name must be at least one letter or number."
var msg2 = "This name already in use!"
var msg3 = "Are you sure you want to replace the session?"
var cLabel = "&Don't Replace";
*/
- msg[1] = TabmixSvc.getSMString("sm.sessionName.msg1");
- msg[2] = TabmixSvc.getSMString("sm.sessionName.msg2");
- msg[3] = msg[2] + ", " + TabmixSvc.getSMString("sm.sessionName.msg3");
- var cLabel = TabmixSvc.setLabel("sm.replaceStartup.button1");
-
- var description = document.getElementById("tm_info").lastChild.firstChild;
- textBox.value = textBox.value.replace(/^[\s]+/g, "");
- var name = textBox.value.toLowerCase();
- var validName = 0;
- if (name === "") validName = 1;
- if (validName === 0) {
- for (var i = 0; i < gSavedName.length; i++) {
- if (name == gSavedName[i].toLowerCase() && gSavedName[i] !== "") {
- if (dialogParams.GetInt(3) == TMP_DLG_RENAME) {
- if (gOrigName != name) validName = 2;
- continue;
- }
- validName = 3;
- dialogParams.SetInt(6, i);
- break;
- }
- }
+ msg[1] = TabmixSvc.getSMString("sm.sessionName.msg1");
+ msg[2] = TabmixSvc.getSMString("sm.sessionName.msg2");
+ msg[3] = msg[2] + ", " + TabmixSvc.getSMString("sm.sessionName.msg3");
+ var cLabel = TabmixSvc.setLabel("sm.replaceStartup.button1");
+
+ var description = document.getElementById("tm_info").lastChild.firstChild;
+ textBox.value = textBox.value.replace(/^[\s]+/g, "");
+ var name = textBox.value.toLowerCase();
+ var validName = 0;
+ if (name === "") validName = 1;
+ if (validName === 0) {
+ for (var i = 0; i < gSavedName.length; i++) {
+ if (name == gSavedName[i].toLowerCase() && gSavedName[i] !== "") {
+ if (dialogParams.GetInt(3) == TMP_DLG_RENAME) {
+ if (gOrigName != name) validName = 2;
+ continue;
+ }
+ validName = 3;
+ dialogParams.SetInt(6, i);
+ break;
}
- switch (validName) {
- case 0:
- if (btnOK.disabled) btnOK.disabled = false;
- if (btnOK.hidden) btnOK.hidden = false;
- if (!btnExt.hidden) {
- btnExt.hidden = true;
- if (dialogParams.GetInt(3) == TMP_DLG_SAVE) setLabelForNode(btnCancel, gCancelLabel);
- }
- description.replaceData(0, description.length, "");
- document.documentElement.defaultButton = "accept";
- break;
- case 1:
- case 2:
- if (btnOK.hidden) btnOK.hidden = false;
- if (!btnOK.disabled) btnOK.disabled = true;
- if (!btnExt.hidden) {
- btnExt.hidden = true;
- if (dialogParams.GetInt(3) == TMP_DLG_SAVE) setLabelForNode(btnCancel, gCancelLabel);
- }
- document.documentElement.defaultButton = "cancel";
- break;
- case 3:
- if (!btnOK.hidden) btnOK.hidden = true;
- btnExt.hidden = false;
- if (dialogParams.GetInt(3) == TMP_DLG_SAVE) setLabelForNode(btnCancel, cLabel);
- document.documentElement.defaultButton = "cancel";
- break;
+ }
+ }
+ switch (validName) {
+ case 0:
+ if (btnOK.disabled) btnOK.disabled = false;
+ if (btnOK.hidden) btnOK.hidden = false;
+ if (!btnExt.hidden) {
+ btnExt.hidden = true;
+ if (dialogParams.GetInt(3) == TMP_DLG_SAVE) setLabelForNode(btnCancel, gCancelLabel);
+ }
+ description.replaceData(0, description.length, "");
+ document.documentElement.defaultButton = "accept";
+ break;
+ case 1:
+ case 2:
+ if (btnOK.hidden) btnOK.hidden = false;
+ if (!btnOK.disabled) btnOK.disabled = true;
+ if (!btnExt.hidden) {
+ btnExt.hidden = true;
+ if (dialogParams.GetInt(3) == TMP_DLG_SAVE) setLabelForNode(btnCancel, gCancelLabel);
}
- description.replaceData(0, description.length, msg[validName]);
- }
+ document.documentElement.defaultButton = "cancel";
+ break;
+ case 3:
+ if (!btnOK.hidden) btnOK.hidden = true;
+ btnExt.hidden = false;
+ if (dialogParams.GetInt(3) == TMP_DLG_SAVE) setLabelForNode(btnCancel, cLabel);
+ document.documentElement.defaultButton = "cancel";
+ break;
+ }
+ description.replaceData(0, description.length, msg[validName]);
+}
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index 3cf131b..6b6b461 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -432,7 +432,7 @@ var TabmixTabbar = {
if (Tabmix.isVersion(220))
next = tabBar._afterSelectedTab;
else if (selectedIndex < visibleTabs.length - 1)
- next = visibleTabs[selectedIndex + 1];
+ next = visibleTabs[selectedIndex + 1];
}
if (multibar) {
@@ -1246,7 +1246,7 @@ var gTMPprefObserver = {
TMP_ClosedTabs.setButtonType(Services.prefs.getBoolPref(prefName));
break;
case "extensions.tabmix.focusTab":
- Services.prefs.setBoolPref("browser.tabs.selectOwnerOnClose", Services.prefs.getIntPref(prefName) == 2);
+ Services.prefs.setBoolPref("browser.tabs.selectOwnerOnClose", Services.prefs.getIntPref(prefName) == 2);
break;
case "extensions.tabmix.hideIcons":
this.setMenuIcons();
@@ -1363,15 +1363,15 @@ var gTMPprefObserver = {
gBrowser.tabContainer.adjustTabstrip();
break;
case "extensions.tabmix.tabBarPosition":
- if (this.tabBarPositionChanged(Services.prefs.getIntPref(prefName))) {
- if (window.fullScreen) {
- TMP_eventListener.onFullScreen(true);
- let bottomToolbox = document.getElementById("tabmix-bottom-toolbox");
- if (bottomToolbox)
- TMP_eventListener.toggleTabbarVisibility(false);
- }
- TabmixTabbar.updateSettings(false);
- }
+ if (this.tabBarPositionChanged(Services.prefs.getIntPref(prefName))) {
+ if (window.fullScreen) {
+ TMP_eventListener.onFullScreen(true);
+ let bottomToolbox = document.getElementById("tabmix-bottom-toolbox");
+ if (bottomToolbox)
+ TMP_eventListener.toggleTabbarVisibility(false);
+ }
+ TabmixTabbar.updateSettings(false);
+ }
break;
case "extensions.tabmix.undoClose":
if (!Tabmix.prefs.getBoolPref("undoClose")) {
@@ -1453,33 +1453,33 @@ var gTMPprefObserver = {
this.showReloadEveryOnReloadButton();
break;
case "extensions.tabmix.tabBarMaxRow":
- var tabBar = gBrowser.tabContainer;
- let row = Tabmix.prefs.getIntPref("tabBarMaxRow");
- if (row < 2) {
- Tabmix.prefs.setIntPref("tabBarMaxRow", 2);
- return;
- }
- // maxRow changed
- if (TabmixTabbar.isMultiRow) {
- let isVisible = Tabmix.tabsUtils.isElementVisible(gBrowser.mCurrentTab);
- // we hide the button to see if tabs can fits to fewer rows without the scroll buttons
- if (Tabmix.tabsUtils.overflow && row > TabmixTabbar.visibleRows)
- Tabmix.tabsUtils.overflow = false;
- // after we update the height check if we are still in overflow
- if (Tabmix.tabsUtils.updateVerticalTabStrip() == "scrollbar") {
- Tabmix.tabsUtils.overflow = true;
- tabBar.mTabstrip._updateScrollButtonsDisabledState();
- if (isVisible)
- gBrowser.ensureTabIsVisible(gBrowser.selectedTab, false);
- }
+ var tabBar = gBrowser.tabContainer;
+ let row = Tabmix.prefs.getIntPref("tabBarMaxRow");
+ if (row < 2) {
+ Tabmix.prefs.setIntPref("tabBarMaxRow", 2);
+ return;
+ }
+ // maxRow changed
+ if (TabmixTabbar.isMultiRow) {
+ let isVisible = Tabmix.tabsUtils.isElementVisible(gBrowser.mCurrentTab);
+ // we hide the button to see if tabs can fits to fewer rows without the scroll buttons
+ if (Tabmix.tabsUtils.overflow && row > TabmixTabbar.visibleRows)
+ Tabmix.tabsUtils.overflow = false;
+ // after we update the height check if we are still in overflow
+ if (Tabmix.tabsUtils.updateVerticalTabStrip() == "scrollbar") {
+ Tabmix.tabsUtils.overflow = true;
+ tabBar.mTabstrip._updateScrollButtonsDisabledState();
+ if (isVisible)
+ gBrowser.ensureTabIsVisible(gBrowser.selectedTab, false);
}
- TabmixTabbar.updateBeforeAndAfter();
+ }
+ TabmixTabbar.updateBeforeAndAfter();
break;
case "extensions.tabmix.pinnedTabScroll":
gBrowser.tabContainer._positionPinnedTabs();
break;
case "extensions.tabmix.offsetAmountToScroll":
- gBrowser.tabContainer.mTabstrip.offsetAmountToScroll = Services.prefs.getBoolPref(prefName);
+ gBrowser.tabContainer.mTabstrip.offsetAmountToScroll = Services.prefs.getBoolPref(prefName);
break;
case "browser.tabs.onTop":
if (TabmixTabbar.position == 1 && Services.prefs.getBoolPref(prefName)) {
@@ -1657,16 +1657,16 @@ var gTMPprefObserver = {
let marginEnd = style.getPropertyValue(sMarginEnd);
let textMarginEnd = parseInt(marginEnd) ? marginEnd : this._marginStart;
delete this._marginStart;
- let iconRule = '.tabbrowser-tabs%favhideclose%[closebuttons="noclose"] > ' +
- '.tabbrowser-tab%faviconized%:not([pinned]) .tab-label[tabmix="true"],' +
- '.tabbrowser-tabs%favhideclose%[closebuttons-side="left"] > ' +
- '.tabbrowser-tab%faviconized%:not([pinned]) .tab-label[tabmix="true"],' +
- '.tabbrowser-tabs%favhideclose%[closebuttons="activetab"]' +
- ':not([closebuttons-hover="notactivetab"])[closebuttons-side="right"] > ' +
- '.tabbrowser-tab%faviconized%:not([pinned]):not([selected="true"]) ' +
- '.tab-label[tabmix="true"],' +
- '.tabbrowser-tab%faviconized1%[protected]:not([pinned]) .tab-label[tabmix="true"] {' +
- '-moz-margin-end: %PX !important;}'.replace("%PX", textMarginEnd);
+ let iconRule = '.tabbrowser-tabs%favhideclose%[closebuttons="noclose"] > ' +
+ '.tabbrowser-tab%faviconized%:not([pinned]) .tab-label[tabmix="true"],' +
+ '.tabbrowser-tabs%favhideclose%[closebuttons-side="left"] > ' +
+ '.tabbrowser-tab%faviconized%:not([pinned]) .tab-label[tabmix="true"],' +
+ '.tabbrowser-tabs%favhideclose%[closebuttons="activetab"]' +
+ ':not([closebuttons-hover="notactivetab"])[closebuttons-side="right"] > ' +
+ '.tabbrowser-tab%faviconized%:not([pinned]):not([selected="true"]) ' +
+ '.tab-label[tabmix="true"],' +
+ '.tabbrowser-tab%faviconized1%[protected]:not([pinned]) .tab-label[tabmix="true"] {' +
+ '-moz-margin-end: %PX !important;}'.replace("%PX", textMarginEnd);
if ("faviconize" in window) {
let newRule = iconRule.replace(/%favhideclose%/g, ':not([favhideclose="true"])')
.replace(/%faviconized%/g, '')
@@ -2197,51 +2197,51 @@ var gTMPprefObserver = {
}
if (Tabmix.prefs.prefHasUserValue("undoCloseCache")) {
- var max_tabs_undo = getPrefByType("extensions.tabmix.undoCloseCache", 5, "IntPref");
- Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo);
+ var max_tabs_undo = getPrefByType("extensions.tabmix.undoCloseCache", 5, "IntPref");
+ Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo);
}
// remove disp=attd&view=att it's make problem with gMail
if (Tabmix.prefs.prefHasUserValue("filetype")) {
- var filetype = Tabmix.prefs.getCharPref("filetype");
- filetype = filetype.replace("/disp=attd&view=att/", "").replace(" ", " ").trim();
- Tabmix.prefs.setCharPref("filetype", filetype);
+ var filetype = Tabmix.prefs.getCharPref("filetype");
+ filetype = filetype.replace("/disp=attd&view=att/", "").replace(" ", " ").trim();
+ Tabmix.prefs.setCharPref("filetype", filetype);
}
// 2008-08-17
if (Tabmix.prefs.prefHasUserValue("opentabfor.search")) {
- Services.prefs.setBoolPref("browser.search.openintab", Tabmix.prefs.getBoolPref("opentabfor.search"));
- Tabmix.prefs.clearUserPref("opentabfor.search");
+ Services.prefs.setBoolPref("browser.search.openintab", Tabmix.prefs.getBoolPref("opentabfor.search"));
+ Tabmix.prefs.clearUserPref("opentabfor.search");
}
// 2008-09-23
if (Tabmix.prefs.prefHasUserValue("keepWindow")) {
- Services.prefs.setBoolPref("browser.tabs.closeWindowWithLastTab", !Tabmix.prefs.getBoolPref("keepWindow"));
- Tabmix.prefs.clearUserPref("keepWindow");
+ Services.prefs.setBoolPref("browser.tabs.closeWindowWithLastTab", !Tabmix.prefs.getBoolPref("keepWindow"));
+ Tabmix.prefs.clearUserPref("keepWindow");
}
// 2008-09-23
if (Services.prefs.prefHasUserValue("browser.ctrlTab.mostRecentlyUsed")) {
- Services.prefs.setBoolPref("browser.ctrlTab.previews",
- Services.prefs.getBoolPref("browser.ctrlTab.mostRecentlyUsed"));
- Services.prefs.clearUserPref("browser.ctrlTab.mostRecentlyUsed");
+ Services.prefs.setBoolPref("browser.ctrlTab.previews",
+ Services.prefs.getBoolPref("browser.ctrlTab.mostRecentlyUsed"));
+ Services.prefs.clearUserPref("browser.ctrlTab.mostRecentlyUsed");
}
// 2008-09-28
if (Tabmix.prefs.prefHasUserValue("lasttab.handleCtrlTab")) {
- Services.prefs.setBoolPref("browser.ctrlTab.previews",
- Tabmix.prefs.getBoolPref("lasttab.handleCtrlTab"));
- Tabmix.prefs.clearUserPref("lasttab.handleCtrlTab");
+ Services.prefs.setBoolPref("browser.ctrlTab.previews",
+ Tabmix.prefs.getBoolPref("lasttab.handleCtrlTab"));
+ Tabmix.prefs.clearUserPref("lasttab.handleCtrlTab");
}
// 2008-11-29
if (Tabmix.prefs.prefHasUserValue("maxWidth")) {
- let val = getPrefByType("extensions.tabmix.maxWidth", 250, "IntPref");
- Services.prefs.setIntPref("browser.tabs.tabMaxWidth", val);
+ let val = getPrefByType("extensions.tabmix.maxWidth", 250, "IntPref");
+ Services.prefs.setIntPref("browser.tabs.tabMaxWidth", val);
}
// 2008-11-29
if (Tabmix.prefs.prefHasUserValue("minWidth")) {
- let val = getPrefByType("extensions.tabmix.minWidth", 100, "IntPref");
- Services.prefs.setIntPref("browser.tabs.tabMinWidth", val);
+ let val = getPrefByType("extensions.tabmix.minWidth", 100, "IntPref");
+ Services.prefs.setIntPref("browser.tabs.tabMinWidth", val);
}
// 2009-01-31
if (Tabmix.prefs.prefHasUserValue("newTabButton.leftside")) {
- Tabmix.prefs.setIntPref("newTabButton.position", Tabmix.prefs.getBoolPref("newTabButton.leftside") ? 0 : 2);
- Tabmix.prefs.clearUserPref("newTabButton.leftside");
+ Tabmix.prefs.setIntPref("newTabButton.position", Tabmix.prefs.getBoolPref("newTabButton.leftside") ? 0 : 2);
+ Tabmix.prefs.clearUserPref("newTabButton.leftside");
}
// 2009-10-10
// swap prefs --> warn when closing window "extensions.tabmix.windows.warnOnClose"
@@ -2249,15 +2249,15 @@ var gTMPprefObserver = {
// warn when closing tabs "browser.tabs.warnOnClose"
// replaced with "extensions.tabmix.tabs.warnOnClose"
if (Tabmix.prefs.prefHasUserValue("windows.warnOnClose")) {
- Tabmix.prefs.setBoolPref("tabs.warnOnClose", Services.prefs.getBoolPref("browser.tabs.warnOnClose"));
- Services.prefs.setBoolPref("browser.tabs.warnOnClose", Tabmix.prefs.getBoolPref("windows.warnOnClose"));
- Tabmix.prefs.clearUserPref("windows.warnOnClose");
+ Tabmix.prefs.setBoolPref("tabs.warnOnClose", Services.prefs.getBoolPref("browser.tabs.warnOnClose"));
+ Services.prefs.setBoolPref("browser.tabs.warnOnClose", Tabmix.prefs.getBoolPref("windows.warnOnClose"));
+ Tabmix.prefs.clearUserPref("windows.warnOnClose");
}
// 2010-03-07
if (Tabmix.prefs.prefHasUserValue("extraIcons")) {
- Tabmix.prefs.setBoolPref("extraIcons.locked", Tabmix.prefs.getBoolPref("extraIcons"));
- Tabmix.prefs.setBoolPref("extraIcons.protected", Tabmix.prefs.getBoolPref("extraIcons"));
- Tabmix.prefs.clearUserPref("extraIcons");
+ Tabmix.prefs.setBoolPref("extraIcons.locked", Tabmix.prefs.getBoolPref("extraIcons"));
+ Tabmix.prefs.setBoolPref("extraIcons.protected", Tabmix.prefs.getBoolPref("extraIcons"));
+ Tabmix.prefs.clearUserPref("extraIcons");
}
// 2010-06-05
if (Tabmix.prefs.prefHasUserValue("tabXMode")) {
@@ -2353,19 +2353,19 @@ var gTMPprefObserver = {
Tabmix.prefs.setBoolPref("loadBookmarksAndReplace", Services.prefs.getBoolPref(pref));
Services.prefs.clearUserPref(pref);
}
-try {
- // 2012-06-22 - remove the use of extensions.tabmix.tabMinWidth/tabMaxWidth
- // other extensions still use browser.tabs.tabMinWidth/tabMaxWidth
- if (Tabmix.prefs.prefHasUserValue("tabMinWidth")) {
- let val = getPrefByType("extensions.tabmix.tabMinWidth", 100, "IntPref");
- Services.prefs.setIntPref("browser.tabs.tabMinWidth", val);
- }
- if (Tabmix.prefs.prefHasUserValue("tabMaxWidth")) {
- let val = getPrefByType("extensions.tabmix.tabMaxWidth", 250, "IntPref");
- Services.prefs.setIntPref("browser.tabs.tabMaxWidth", val);
- Tabmix.prefs.clearUserPref("tabMaxWidth");
- }
-} catch (ex) {Tabmix.assert(ex);}
+ try {
+ // 2012-06-22 - remove the use of extensions.tabmix.tabMinWidth/tabMaxWidth
+ // other extensions still use browser.tabs.tabMinWidth/tabMaxWidth
+ if (Tabmix.prefs.prefHasUserValue("tabMinWidth")) {
+ let val = getPrefByType("extensions.tabmix.tabMinWidth", 100, "IntPref");
+ Services.prefs.setIntPref("browser.tabs.tabMinWidth", val);
+ }
+ if (Tabmix.prefs.prefHasUserValue("tabMaxWidth")) {
+ let val = getPrefByType("extensions.tabmix.tabMaxWidth", 250, "IntPref");
+ Services.prefs.setIntPref("browser.tabs.tabMaxWidth", val);
+ Tabmix.prefs.clearUserPref("tabMaxWidth");
+ }
+ } catch (ex) {Tabmix.assert(ex);}
// 2013-01-21 - lock hideIcons to true in mac
if (Services.appinfo.OS == "Darwin" && !Tabmix.prefs.prefIsLocked("hideIcons")) {
Tabmix.defaultPrefs.setBoolPref("hideIcons", true);
@@ -2628,7 +2628,7 @@ var TabmixProgressListener = {
if (Tabmix.prefs.getBoolPref("unreadTabreload") && tab.hasAttribute("visited") &&
!tab.hasAttribute("dontremovevisited") && tab.getAttribute(TabmixSvc.selectedAtt) != "true")
tab.removeAttribute("visited");
- Tabmix.setTabStyle(tab);
+ Tabmix.setTabStyle(tab);
}
// see gBrowser.openLinkWithHistory in tablib.js
if (tab.hasAttribute("dontremovevisited"))
diff --git a/modules/ContentClick.jsm b/modules/ContentClick.jsm
index 5a647d5..0123b41 100644
--- a/modules/ContentClick.jsm
+++ b/modules/ContentClick.jsm
@@ -368,13 +368,13 @@ var ContentClickInternal = {
* portions were taken from disable target for downloads by cusser
*/
if (this.suppressTabsOnFileDownload()) {
- // don't do anything if we are on gmail and let gmail take care of the download
- let url = this._data.currentURL;
- let isGmail = /^(http|https):\/\/mail.google.com/.test(url);
- let isHttps = /^https/.test(href);
- if (isGmail || isHttps)
- return ["default at 6", true];
- return ["current at 7", true];
+ // don't do anything if we are on gmail and let gmail take care of the download
+ let url = this._data.currentURL;
+ let isGmail = /^(http|https):\/\/mail.google.com/.test(url);
+ let isHttps = /^https/.test(href);
+ if (isGmail || isHttps)
+ return ["default at 6", true];
+ return ["current at 7", true];
}
// check this after we check for suppressTabsOnFileDownload
diff --git a/modules/DynamicRules.jsm b/modules/DynamicRules.jsm
index 6ef4b8b..5f22542 100644
--- a/modules/DynamicRules.jsm
+++ b/modules/DynamicRules.jsm
@@ -18,10 +18,10 @@ XPCOMUtils.defineLazyGetter(this, "Prefs", function() {
var TYPE;
XPCOMUtils.defineLazyGetter(this, "SSS", function() {
- let sss = Cc['@mozilla.org/content/style-sheet-service;1']
- .getService(Ci.nsIStyleSheetService);
- TYPE = sss.AGENT_SHEET;
- return sss;
+ let sss = Cc['@mozilla.org/content/style-sheet-service;1']
+ .getService(Ci.nsIStyleSheetService);
+ TYPE = sss.AGENT_SHEET;
+ return sss;
});
const NAMESPACE = '@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");\n';
@@ -234,8 +234,8 @@ this.DynamicRules = {
style[rule] = cssText.replace(/#textColor/g, prefObj.textColor);
}
else if (prefObj.bg)
- style[rule] = cssText.replace(/#bottomColor/g, prefObj.bgColor)
- .replace(/#topColor/g, prefObj.bgTopColor);
+ style[rule] = cssText.replace(/#bottomColor/g, prefObj.bgColor)
+ .replace(/#topColor/g, prefObj.bgTopColor);
}
this.styles[name] = Object.keys(style).length ? style : null;
this.registerSheet(name);
diff --git a/modules/MergeWindows.jsm b/modules/MergeWindows.jsm
index 13d5647..9eae9db 100644
--- a/modules/MergeWindows.jsm
+++ b/modules/MergeWindows.jsm
@@ -101,7 +101,7 @@ this.MergeWindows = {
mergePopUpsToNewWindow: function(aWindows, aPrivate) {
var features = "chrome,all,dialog=no";
if (TabmixSvc.version(200))
- features += aPrivate ? ",private" : ",non-private";
+ features += aPrivate ? ",private" : ",non-private";
var newWindow = aWindows[0].openDialog("chrome://browser/content/browser.xul",
"_blank", features, null);
let mergePopUps = function _mergePopUps() {
diff --git a/modules/Shortcuts.jsm b/modules/Shortcuts.jsm
index 32450db..578e948 100644
--- a/modules/Shortcuts.jsm
+++ b/modules/Shortcuts.jsm
@@ -129,31 +129,31 @@ this.Shortcuts = {
},
onPrefChange: function TMP_SC_onPrefChange(aData) {
- try {
- if (this.updatingShortcuts ||
- aData != "shortcuts" && aData != "sessions.manager")
- return;
- this.updatingShortcuts = true;
- // instead of locking the preference just revert any changes user made
- if (aData == "shortcuts" && !this.prefsChangedByTabmix) {
- this.setShortcutsPref();
- return;
- }
+ try {
+ if (this.updatingShortcuts ||
+ aData != "shortcuts" && aData != "sessions.manager")
+ return;
+ this.updatingShortcuts = true;
+ // instead of locking the preference just revert any changes user made
+ if (aData == "shortcuts" && !this.prefsChangedByTabmix) {
+ this.setShortcutsPref();
+ return;
+ }
- let [changedKeys, needUpdate] = this._getChangedKeys({onChange: aData == "shortcuts"});
- if (needUpdate) {
- let windowsEnum = Services.wm.getEnumerator("navigator:browser");
- while (windowsEnum.hasMoreElements()) {
- let win = windowsEnum.getNext();
- if (!win.closed)
- this.updateWindowKeys(win, changedKeys);
+ let [changedKeys, needUpdate] = this._getChangedKeys({onChange: aData == "shortcuts"});
+ if (needUpdate) {
+ let windowsEnum = Services.wm.getEnumerator("navigator:browser");
+ while (windowsEnum.hasMoreElements()) {
+ let win = windowsEnum.getNext();
+ if (!win.closed)
+ this.updateWindowKeys(win, changedKeys);
+ }
+ if (this.keyConfigInstalled)
+ KeyConfig.syncToKeyConfig(changedKeys, true);
}
- if (this.keyConfigInstalled)
- KeyConfig.syncToKeyConfig(changedKeys, true);
- }
- this.updatingShortcuts = false;
- } catch (ex) {TabmixSvc.console.assert(ex);}
+ this.updatingShortcuts = false;
+ } catch (ex) {TabmixSvc.console.assert(ex);}
},
/* ........ Window Event Handlers .............. */
@@ -267,7 +267,7 @@ this.Shortcuts = {
// turn off slideShow if need to
if (aKey == "slideShow" && disabled &&
aWindow.Tabmix.SlideshowInitialized && aWindow.Tabmix.flst.slideShowTimer) {
- aWindow.Tabmix.flst.cancel();
+ aWindow.Tabmix.flst.cancel();
}
},
@@ -424,7 +424,7 @@ this.Shortcuts = {
if (!this.keys.browserReload.id) {
let index = 2, id;
do {
- id = "key_reload#".replace("#", index++);
+ id = "key_reload#".replace("#", index++);
} while (aWindow.document.getElementById(id));
this.keys.browserReload.id = key.id = id;
}
--
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