Add line breaks for dynamic patches

This commit is contained in:
Piro / YUKI Hiroshi 2012-10-13 02:24:02 +09:00
parent a314e75bdb
commit d66b7083d2
7 changed files with 284 additions and 284 deletions

View File

@ -249,19 +249,19 @@ var TreeStyleTabBookmarksService = {
'if (item.uri) { $& }'
).replace(
/(browserWindow\.(?:getBrowser\(\)|gBrowser)\.loadTabs\([^;]+\);)/,
'var TSTResult = browserWindow.TreeStyleTabBookmarksService.handleTabsOpenProcess(where, aEvent, browserWindow, ids, urls, typeof replaceCurrentTab == "undefined" ? undefined : replaceCurrentTab, aFolderTitle);' +
'TSTTreeStructure = TSTResult.treeStructure;' +
'TSTPreviousTabs = TSTResult.previousTabs;' +
'TSTOpenGroupBookmarkBehavior = TSTResult.behavior;' +
'if (typeof replaceCurrentTab != "undefined")' +
' replaceCurrentTab = TSTResult.replaceCurrentTab;' +
'var TSTResult = browserWindow.TreeStyleTabBookmarksService.handleTabsOpenProcess(where, aEvent, browserWindow, ids, urls, typeof replaceCurrentTab == "undefined" ? undefined : replaceCurrentTab, aFolderTitle);\n' +
'TSTTreeStructure = TSTResult.treeStructure;\n' +
'TSTPreviousTabs = TSTResult.previousTabs;\n' +
'TSTOpenGroupBookmarkBehavior = TSTResult.behavior;\n' +
'if (typeof replaceCurrentTab != "undefined")\n' +
' replaceCurrentTab = TSTResult.replaceCurrentTab;\n' +
'$1'
).replace(
/(\}\)?)$/,
' if (TSTTreeStructure && TSTPreviousTabs) {' +
' let tabs = browserWindow.TreeStyleTabService.getNewTabsFromPreviousTabsInfo(browserWindow.gBrowser, TSTPreviousTabs);' +
' browserWindow.TreeStyleTabService.applyTreeStructureToTabs(tabs, TSTTreeStructure, TSTOpenGroupBookmarkBehavior & browserWindow.TreeStyleTabBookmarksService.kGROUP_BOOKMARK_EXPAND_ALL_TREE);' +
' }' +
' if (TSTTreeStructure && TSTPreviousTabs) {\n' +
' let tabs = browserWindow.TreeStyleTabService.getNewTabsFromPreviousTabsInfo(browserWindow.gBrowser, TSTPreviousTabs);\n' +
' browserWindow.TreeStyleTabService.applyTreeStructureToTabs(tabs, TSTTreeStructure, TSTOpenGroupBookmarkBehavior & browserWindow.TreeStyleTabBookmarksService.kGROUP_BOOKMARK_EXPAND_ALL_TREE);\n' +
' }\n' +
'$1'
)
);
@ -275,16 +275,16 @@ var TreeStyleTabBookmarksService = {
eval('PlacesUIUtils.'+method+' = '+
PlacesUIUtils[method].toSource().replace(
/(this\._openTabset\([^\)]+)(\))/,
'let (w = "_getTopBrowserWin" in this ?' +
' this._getTopBrowserWin() :' +
' "_getCurrentActiveWin" in this ?' +
' this._getCurrentActiveWin() :' +
' window) {' +
' let nodes = w.TreeStyleTabBookmarksService.getItemIdsForContainerNode(aNode);' +
' for (let i in nodes) {' +
' urlsToOpen[i].id = nodes[i];' +
' }' +
'}' +
'let (w = "_getTopBrowserWin" in this ?\n' +
' this._getTopBrowserWin() :\n' +
' "_getCurrentActiveWin" in this ?\n' +
' this._getCurrentActiveWin() :\n' +
' window) {\n' +
' let nodes = w.TreeStyleTabBookmarksService.getItemIdsForContainerNode(aNode);\n' +
' for (let i in nodes) {\n' +
' urlsToOpen[i].id = nodes[i];\n' +
' }\n' +
'}\n' +
'$1, aNode.title$2'
)
);
@ -298,29 +298,29 @@ var TreeStyleTabBookmarksService = {
eval('PlacesUIUtils.'+method+' = '+
PlacesUIUtils[method].toSource().replace(
'{',
'{' +
' var TSTBS;' +
' let (w = "_getTopBrowserWin" in this ?' +
' this._getTopBrowserWin() :' +
' "_getCurrentActiveWin" in this ?' +
' this._getCurrentActiveWin() :' +
' window) {' +
' TSTBS = w.TreeStyleTabBookmarksService;' +
' PlacesUtils = w.PlacesUtils;' +
'{\n' +
' var TSTBS;\n' +
' let (w = "_getTopBrowserWin" in this ?\n' +
' this._getTopBrowserWin() :\n' +
' "_getCurrentActiveWin" in this ?\n' +
' this._getCurrentActiveWin() :\n' +
' window) {\n' +
' TSTBS = w.TreeStyleTabBookmarksService;\n' +
' PlacesUtils = w.PlacesUtils;\n' +
' }'
).replace(
'uri: aNodes[i].uri,',
'id: aNodes[i].itemId, $&'
).replace(
/(this\._openTabset\([^\)]+)(\))/,
'$1,' +
' TSTBS.treeBundle' +
' .getFormattedString(' +
' PlacesUtils.nodeIsBookmark(aNodes[0]) ?' +
' "openSelectedPlaces.bookmarks" :' +
' "openSelectedPlaces.history",' +
' [aNodes[0].title, aNodes.length]' +
' )' +
'$1,\n' +
' TSTBS.treeBundle\n' +
' .getFormattedString(\n' +
' PlacesUtils.nodeIsBookmark(aNodes[0]) ?\n' +
' "openSelectedPlaces.bookmarks" :\n' +
' "openSelectedPlaces.history",\n' +
' [aNodes[0].title, aNodes.length]\n' +
' )\n' +
'$2'
)
);
@ -338,28 +338,28 @@ var TreeStyleTabBookmarksService = {
eval('PlacesCommandHook.bookmarkCurrentPages = '+
PlacesCommandHook.bookmarkCurrentPages.toSource().replace(
'{',
'{' +
' TreeStyleTabBookmarksService.beginAddBookmarksFromTabs((function() {' +
' var tabs = [];' +
' var seen = {};' +
' var allTabs = getBrowser().mTabContainer.childNodes;' +
' for (let i = 0, maxi = allTabs.length; i < maxi; i++)' +
' {' +
' let tab = allTabs[i];' +
' let uri = tab.linkedBrowser.currentURI.spec;' +
' if (uri in seen) continue;' +
' seen[uri] = true;' +
' tabs.push(tab);' +
' }' +
' return tabs;' +
' })());' +
'{\n' +
' TreeStyleTabBookmarksService.beginAddBookmarksFromTabs((function() {\n' +
' var tabs = [];\n' +
' var seen = {};\n' +
' var allTabs = getBrowser().mTabContainer.childNodes;\n' +
' for (let i = 0, maxi = allTabs.length; i < maxi; i++)\n' +
' {\n' +
' let tab = allTabs[i];\n' +
' let uri = tab.linkedBrowser.currentURI.spec;\n' +
' if (uri in seen) continue;\n' +
' seen[uri] = true;\n' +
' tabs.push(tab);\n' +
' }\n' +
' return tabs;\n' +
' })());\n' +
' try {'
).replace(
/(\}\)?)$/,
' }' +
' catch(e) {' +
' }' +
' TreeStyleTabBookmarksService.endAddBookmarksFromTabs();' +
' }\n' +
' catch(e) {\n' +
' }\n' +
' TreeStyleTabBookmarksService.endAddBookmarksFromTabs();\n' +
'$1'
)
);

View File

@ -115,7 +115,7 @@ var TreeStyleTabBookmarksServiceEditable = {
eval('gEditItemOverlay._showHideRows = '+gEditItemOverlay._showHideRows.toSource().replace(
/(\}\)?)$/,
' TreeStyleTabBookmarksServiceEditable.parentRow.collapsed = this._element("keywordRow").collapsed && this._element("folderRow").collapsed;' +
' TreeStyleTabBookmarksServiceEditable.parentRow.collapsed = this._element("keywordRow").collapsed && this._element("folderRow").collapsed;\n' +
'$1'
));

View File

@ -52,9 +52,9 @@ var TreeStyleTabWindowHelper = {
eval('window.undoCloseTab = '+
window.undoCloseTab.toSource().replace(
/(\btab\s*=\s*[^\.]+\.undoCloseTab\([^;]+\);)/,
'gBrowser.__treestyletab__readyToUndoCloseTab = true;' +
'$1' +
'tab.__treestyletab__restoredByUndoCloseTab = true;' +
'gBrowser.__treestyletab__readyToUndoCloseTab = true;\n' +
'$1\n' +
'tab.__treestyletab__restoredByUndoCloseTab = true;\n' +
'delete gBrowser.__treestyletab__readyToUndoCloseTab;'
)
);
@ -96,9 +96,9 @@ var TreeStyleTabWindowHelper = {
/\.width/g, '[TST.sizeProp]'
).replace(
/(return (?:true|dt.effectAllowed = "copyMove");)/,
'if (!TST.tabbarDNDObserver.canDropTab(arguments[0])) {' +
' return dt.effectAllowed = "none";' +
'}' +
'if (!TST.tabbarDNDObserver.canDropTab(arguments[0])) {\n' +
' return dt.effectAllowed = "none";\n' +
'}\n' +
'$1'
).replace(
'sourceNode.parentNode == this &&',
@ -140,14 +140,14 @@ var TreeStyleTabWindowHelper = {
eval('nsContextMenu.prototype.openLinkInTab = '+
nsContextMenu.prototype.openLinkInTab.toSource().replace(
'{',
'{' +
'{\n' +
' TreeStyleTabService.readyToOpenChildTab(this.target.ownerDocument.defaultView);'
)
);
eval('nsContextMenu.prototype.openFrameInTab = '+
nsContextMenu.prototype.openFrameInTab.toSource().replace(
'{',
'{' +
'{\n' +
' TreeStyleTabService.readyToOpenChildTab(this.target.ownerDocument.defaultView);'
)
);
@ -344,8 +344,8 @@ var TreeStyleTabWindowHelper = {
searchbar.doSearch.toSource().toSource().indexOf('TreeStyleTabService') < 0) {
eval('searchbar.doSearch = '+searchbar.doSearch.toSource().replace(
/(openUILinkIn\(.+?\);)/,
'TreeStyleTabService.onBeforeBrowserSearch(arguments[0]);' +
'$1' +
'TreeStyleTabService.onBeforeBrowserSearch(arguments[0]);\n' +
'$1\n' +
'TreeStyleTabService.stopToOpenChildTab();'
));
}
@ -408,22 +408,22 @@ var TreeStyleTabWindowHelper = {
'tabPos + 1', 'nextTab._tPos'
).replace(
'this.moveTabTo(',
'var descendant = this.treeStyleTab.getDescendantTabs(nextTab);' +
'if (descendant.length) {' +
' nextTab = descendant[descendant.length-1];' +
'}' +
'var descendant = this.treeStyleTab.getDescendantTabs(nextTab);\n' +
'if (descendant.length) {\n' +
' nextTab = descendant[descendant.length-1];\n' +
'}\n' +
'$&'
).replace(
'this.moveTabToStart();',
'this.treeStyleTab.internallyTabMovingCount++;' +
'var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);' +
'if (parentTab) {' +
' this.moveTabTo(this.mCurrentTab, this.treeStyleTab.getFirstChildTab(parentTab)._tPos);' +
' this.mCurrentTab.focus();' +
'}' +
'else {' +
' $&' +
'}' +
'this.treeStyleTab.internallyTabMovingCount++;\n' +
'var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' +
'if (parentTab) {\n' +
' this.moveTabTo(this.mCurrentTab, this.treeStyleTab.getFirstChildTab(parentTab)._tPos);\n' +
' this.mCurrentTab.focus();\n' +
'}\n' +
'else {\n' +
' $&\n' +
'}\n' +
'this.treeStyleTab.internallyTabMovingCount--;'
)
);
@ -438,15 +438,15 @@ var TreeStyleTabWindowHelper = {
'tabPos - 1', 'prevTab._tPos'
).replace(
'this.moveTabToEnd();',
'this.treeStyleTab.internallyTabMovingCount++;' +
'var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);' +
'if (parentTab) {' +
' this.moveTabTo(this.mCurrentTab, this.treeStyleTab.getLastChildTab(parentTab)._tPos);' +
' this.mCurrentTab.focus();' +
'}' +
'else {' +
' $&' +
'}' +
'this.treeStyleTab.internallyTabMovingCount++;\n' +
'var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' +
'if (parentTab) {\n' +
' this.moveTabTo(this.mCurrentTab, this.treeStyleTab.getLastChildTab(parentTab)._tPos);\n' +
' this.mCurrentTab.focus();\n' +
'}\n' +
'else {\n' +
' $&\n' +
'}\n' +
'this.treeStyleTab.internallyTabMovingCount--;'
)
);
@ -454,18 +454,18 @@ var TreeStyleTabWindowHelper = {
eval('b.loadTabs = '+
b.loadTabs.toSource().replace(
'var tabNum = ',
'if (this.treeStyleTab.readiedToAttachNewTabGroup)' +
' TreeStyleTabService.readyToOpenChildTab(firstTabAdded || this.selectedTab, true);' +
'if (this.treeStyleTab.readiedToAttachNewTabGroup)\n' +
' TreeStyleTabService.readyToOpenChildTab(firstTabAdded || this.selectedTab, true);\n' +
'$&'
).replace(
'if (!aLoadInBackground)',
'if (TreeStyleTabService.checkToOpenChildTab(this))' +
' TreeStyleTabService.stopToOpenChildTab(this);' +
'if (TreeStyleTabService.checkToOpenChildTab(this))\n' +
' TreeStyleTabService.stopToOpenChildTab(this);\n' +
'$&'
).replace(
'this.selectedTab = firstTabAdded;',
'this.selectedTab = aURIs[0].indexOf("about:treestyletab-group") < 0 ? ' +
' firstTabAdded :' +
'this.selectedTab = aURIs[0].indexOf("about:treestyletab-group") < 0 ? \n' +
' firstTabAdded :\n' +
' TreeStyleTabService.getNextTab(firstTabAdded) ;'
)
);
@ -497,9 +497,9 @@ var TreeStyleTabWindowHelper = {
eval('b.mTabContainer.advanceSelectedTab = '+
source.replace(
'{',
'{' +
' var treeStyleTab = TreeStyleTabService.getTabBrowserFromChild(this).treeStyleTab;' +
' if (treeStyleTab.handleAdvanceSelectedTab(arguments[0], arguments[1]))' +
'{\n' +
' var treeStyleTab = TreeStyleTabService.getTabBrowserFromChild(this).treeStyleTab;\n' +
' if (treeStyleTab.handleAdvanceSelectedTab(arguments[0], arguments[1]))\n' +
' return;'
)
);
@ -510,10 +510,10 @@ var TreeStyleTabWindowHelper = {
eval('b.mTabContainer._notifyBackgroundTab = '+
source.replace(
'{',
'{' +
' var treeStyleTab = TreeStyleTabService.getTabBrowserFromChild(this).treeStyleTab;' +
' if (treeStyleTab.scrollToNewTabMode == 0 ||' +
' treeStyleTab.shouldCancelEnsureElementIsVisible())' +
'{\n' +
' var treeStyleTab = TreeStyleTabService.getTabBrowserFromChild(this).treeStyleTab;\n' +
' if (treeStyleTab.scrollToNewTabMode == 0 ||\n' +
' treeStyleTab.shouldCancelEnsureElementIsVisible())\n' +
' return;'
).replace(
/\.screenX/g, '[treeStyleTab.screenPositionProp]'
@ -556,14 +556,14 @@ var TreeStyleTabWindowHelper = {
eval('scrollbox.ensureElementIsVisible = '+
source.replace(
'{',
'{' +
' var treeStyleTab = TreeStyleTabService.getTabBrowserFromChild(this).treeStyleTab;' +
' if (treeStyleTab && treeStyleTab.shouldCancelEnsureElementIsVisible())' +
' return;' +
' if (' +
' treeStyleTab &&' +
' (arguments.length == 1 || arguments[1])' +
' )' +
'{\n' +
' var treeStyleTab = TreeStyleTabService.getTabBrowserFromChild(this).treeStyleTab;\n' +
' if (treeStyleTab && treeStyleTab.shouldCancelEnsureElementIsVisible())\n' +
' return;\n' +
' if (\n' +
' treeStyleTab &&\n' +
' (arguments.length == 1 || arguments[1])\n' +
' )\n' +
' return treeStyleTab.scrollToTab(arguments[0]);'
)
);

View File

@ -45,36 +45,36 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
eval('permaTabs.showPermaTab = '+
permaTabs.showPermaTab.toSource().replace(
/(\}\)?)$/,
'(function(tab, id) {' +
' if (this.ssWillRestore) return;' +
' var TST = TreeStyleTabService;' +
' if (this.TSTRestoredPermaTabsInfo === void(0)) {' +
' try {' +
' eval("this.TSTRestoredPermaTabsInfo = "+(TST.getTreePref("permaTabsInfo") || "null"));' +
' }' +
' catch(e) {' +
' }' +
' }' +
' if (!this.TSTRestoredPermaTabsInfo) return;' +
'(function(tab, id) {\n' +
' if (this.ssWillRestore) return;\n' +
' var TST = TreeStyleTabService;\n' +
' if (this.TSTRestoredPermaTabsInfo === void(0)) {\n' +
' try {\n' +
' eval("this.TSTRestoredPermaTabsInfo = "+(TST.getTreePref("permaTabsInfo") || "null"));\n' +
' }\n' +
' catch(e) {\n' +
' }\n' +
' }\n' +
' if (!this.TSTRestoredPermaTabsInfo) return;\n' +
' var info = this.TSTRestoredPermaTabsInfo[id];' +
' if (!info) return;' +
' var info = this.TSTRestoredPermaTabsInfo[id];\n' +
' if (!info) return;\n' +
' for (var i in info)' +
' {' +
' TST.SessionStore.setTabValue(tab, i, info[i]);' +
' }' +
' var count = 0;' +
' window.setTimeout(function() {' +
' var b = TST.getTabBrowserFromChild(tab);' +
' if (!b.treeStyleTab) {' +
' if (++count < 50)' +
' window.setTimeout(arguments.callee, 100);' +
' return;' +
' }' +
' b.treeStyleTab.handleRestoredTab(tab);' +
' }, 0);' +
'}).call(this, tab, id)' +
' for (var i in info)\n' +
' {\n' +
' TST.SessionStore.setTabValue(tab, i, info[i]);\n' +
' }\n' +
' var count = 0;\n' +
' window.setTimeout(function() {\n' +
' var b = TST.getTabBrowserFromChild(tab);\n' +
' if (!b.treeStyleTab) {\n' +
' if (++count < 50)\n' +
' window.setTimeout(arguments.callee, 100);\n' +
' return;\n' +
' }\n' +
' b.treeStyleTab.handleRestoredTab(tab);\n' +
' }, 0);\n' +
'}).call(this, tab, id)\n' +
'$1'
)
);
@ -83,25 +83,25 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
eval('permaTabs.savePermaTabs = '+
permaTabs.savePermaTabs.toSource().replace(
'{',
'{' +
'(function() {' +
' var tabsInfo = {};' +
' var TST = TreeStyleTabService;' +
' var allTabs = getBrowser().mTabContainer.childNodes;' +
' for (let i = 0, maxi = allTabs.length; i < maxi; i++)' +
' {' +
' let tab = allTabs[i];' +
' let index = this.getPermaTabLocalIndex(tab);' +
' if (index < 0) continue;' +
' let info = {};' +
' for (let i = 0, maxi = TST.extraProperties.length; i < maxi; i++)' +
' {' +
' let property = TST.extraProperties[i];' +
' info[property] = TST.getTabValue(tab, property);' +
' }' +
' tabsInfo[this.permaTabs[index].id] = info;' +
' }' +
' TST.setTreePref("permaTabsInfo", tabsInfo.toSource());' +
'{\n' +
'(function() {\n' +
' var tabsInfo = {};\n' +
' var TST = TreeStyleTabService;\n' +
' var allTabs = getBrowser().mTabContainer.childNodes;\n' +
' for (let i = 0, maxi = allTabs.length; i < maxi; i++)\n' +
' {\n' +
' let tab = allTabs[i];\n' +
' let index = this.getPermaTabLocalIndex(tab);\n' +
' if (index < 0) continue;\n' +
' let info = {};\n' +
' for (let i = 0, maxi = TST.extraProperties.length; i < maxi; i++)\n' +
' {\n' +
' let property = TST.extraProperties[i];\n' +
' info[property] = TST.getTabValue(tab, property);\n' +
' }\n' +
' tabsInfo[this.permaTabs[index].id] = info;\n' +
' }\n' +
' TST.setTreePref("permaTabsInfo", tabsInfo.toSource());\n' +
'}).call(this);'
)
);
@ -127,52 +127,52 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
eval('sessionData.getTabProperties = '+
sessionData.getTabProperties.toSource().replace(
'return tabProperties;',
' for (let i = 0, maxi = this.tabTSTProperties.length; i < maxi; i++)' +
' {' +
' let property = this.tabTSTProperties[i];' +
' tabProperties += "|" + property + "=" + encodeURIComponent(aTab.getAttribute(property));' +
' }' +
' for (let i = 0, maxi = this.tabTSTProperties.length; i < maxi; i++)\n' +
' {\n' +
' let property = this.tabTSTProperties[i];\n' +
' tabProperties += "|" + property + "=" + encodeURIComponent(aTab.getAttribute(property));\n' +
' }\n' +
'$&'
)
);
eval('sessionData.setTabProperties = '+
sessionData.setTabProperties.toSource().replace(
'{',
'$&' +
' var TSTProps = tabProperties.split("|");' +
' tabProperties = TSTProps.shift();' +
' for (let i = 0, maxi = TSTProps.length; i < maxi; i++)' +
' {' +
' let property = TSTProps[i];' +
' let index = property.indexOf("=");' +
' let name = property.substring(0, index);' +
' let value = decodeURIComponent(property.substring(index+1));' +
' if (name && value)' +
' aTab.setAttribute(name, value);' +
'$&\n' +
' var TSTProps = tabProperties.split("|");\n' +
' tabProperties = TSTProps.shift();\n' +
' for (let i = 0, maxi = TSTProps.length; i < maxi; i++)\n' +
' {\n' +
' let property = TSTProps[i];\n' +
' let index = property.indexOf("=");\n' +
' let name = property.substring(0, index);\n' +
' let value = decodeURIComponent(property.substring(index+1));\n' +
' if (name && value)\n' +
' aTab.setAttribute(name, value);\n' +
' }'
)
);
eval('sessionManager.loadOneTab = '+
sessionManager.loadOneTab.toSource().replace(
/(\}\))?$/,
' if (gBrowser.treeStyleTab.useTMPSessionAPI)' +
' gBrowser.treeStyleTab.handleRestoredTab(aTab);' +
' if (gBrowser.treeStyleTab.useTMPSessionAPI)\n' +
' gBrowser.treeStyleTab.handleRestoredTab(aTab);\n' +
'$1'
)
);
let source = tablib.init.toSource().split('gBrowser.restoreTab = ');
source[1] = source[1].replace(
'return newTab;',
' if (this.treeStyleTab.useTMPSessionAPI)' +
' this.treeStyleTab.handleRestoredTab(newTab);' +
' if (this.treeStyleTab.useTMPSessionAPI)\n' +
' this.treeStyleTab.handleRestoredTab(newTab);\n' +
'$&'
);
eval('tablib.init = '+source.join('gBrowser.restoreTab = '));
eval('sessionManager.loadOneWindow = '+
sessionManager.loadOneWindow.toSource().replace(
'gBrowser.tabsToLoad = ',
' gBrowser.treeStyleTab.resetAllTabs(true, true);' +
' TreeStyleTabService.restoringTree = true;' +
' gBrowser.treeStyleTab.resetAllTabs(true, true);\n' +
' TreeStyleTabService.restoringTree = true;\n' +
'$&'
).replace(
/(\}\))?$/,
@ -198,15 +198,15 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
if ('load' in gSessionManager) {
eval('gSessionManager.load = '+gSessionManager.load.toSource().replace(
'var tabcount = ',
' gBrowser.treeStyleTab.collapseExpandAllSubtree(false, true);' +
' let (tabs = gBrowser.treeStyleTab.getTabs(gBrowser).slice(1).reverse()) {' +
' for (let i = 0, maxi = tabs.length; i < maxi; i++)' +
' {' +
' let tab = tabs[i];' +
' gBrowser.removeTab(tab);' +
' }' +
' }' +
' TreeStyleTabService.restoringTree = true;' +
' gBrowser.treeStyleTab.collapseExpandAllSubtree(false, true);\n' +
' let (tabs = gBrowser.treeStyleTab.getTabs(gBrowser).slice(1).reverse()) {\n' +
' for (let i = 0, maxi = tabs.length; i < maxi; i++)\n' +
' {\n' +
' let tab = tabs[i];\n' +
' gBrowser.removeTab(tab);\n' +
' }\n' +
' }\n' +
' TreeStyleTabService.restoringTree = true;\n' +
'$&'
));
}
@ -281,20 +281,20 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
sv.getTreePref('compatibility.OptimozTweaks')) {
eval('window.mtSidebarStartup = '+window.mtSidebarStartup.toSource().replace(
'{',
'{' +
' document.getElementById("TabsToolbar")' +
'{\n' +
' document.getElementById("TabsToolbar")\n' +
' .addEventListener("mousemove", mtMouseMoveListener, false);'
));
eval('window.mtSidebarShutdown = '+window.mtSidebarShutdown.toSource().replace(
'{',
'{' +
' document.getElementById("TabsToolbar")' +
'{\n' +
' document.getElementById("TabsToolbar")\n' +
' .removeEventListener("mousemove", mtMouseMoveListener, false);'
));
eval('window.mtPreventHiding = '+window.mtPreventHiding.toSource().replace(
'{',
'{' +
' if (TreeStyleTabService.getTabbarFromEvent(arguments[0]))' +
'{\n' +
' if (TreeStyleTabService.getTabbarFromEvent(arguments[0]))\n' +
' return;'
));
}
@ -307,7 +307,7 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
'do_alter' in HideCaption) {
eval('HideCaption.do_alter = '+HideCaption.do_alter.toSource().replace(
'if (!theSettings) {',
' if (!theSettings ||' +
' if (!theSettings ||\n' +
' gBrowser.treeStyleTab.isVertical) {'
));
}
@ -337,9 +337,9 @@ TreeStyleTabWindowHelper.overrideExtensionsBeforeBrowserInit = function TSTWH_ov
'boxObject[sizeProp]'
).replace(
'{',
'{' +
' var posProp = gBrowser.treeStyleTab.isVertical ? "y" : "x" ;' +
' var screenPosProp = gBrowser.treeStyleTab.isVertical ? "screenY" : "screenX" ;' +
'{\n' +
' var posProp = gBrowser.treeStyleTab.isVertical ? "y" : "x" ;\n' +
' var screenPosProp = gBrowser.treeStyleTab.isVertical ? "screenY" : "screenX" ;\n' +
' var sizeProp = gBrowser.treeStyleTab.isVertical ? "height" : "width" ;'
)
}
@ -383,11 +383,11 @@ TreeStyleTabWindowHelper.overrideExtensionsBeforeBrowserInit = function TSTWH_ov
eval('tabberwocky.openSelectedLinks = '+
tabberwocky.openSelectedLinks.toSource().replace(
'links.forEach(',
' TreeStyleTabService.readyToOpenChildTab(aFrame, true)' +
' TreeStyleTabService.readyToOpenChildTab(aFrame, true)\n' +
'$&'
).replace(
/(\}\)?)$/,
' TreeStyleTabService.stopToOpenChildTab(aFrame)' +
' TreeStyleTabService.stopToOpenChildTab(aFrame)\n' +
'$1'
)
);
@ -406,8 +406,8 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
eval('selectionlinks.parseSelection = '+
selectionlinks.parseSelection.toSource().replace(
/((?:[^\s:;]+.selectedTab\s*=\s*)?([^\s:;]+).addTab\()/g,
' if ($2.treeStyleTab)' +
' $2.treeStyleTab.readyToOpenChildTab(focusedWindow);' +
' if ($2.treeStyleTab)\n' +
' $2.treeStyleTab.readyToOpenChildTab(focusedWindow);\n' +
'$1'
)
);
@ -430,7 +430,7 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
eval('DNDObserver.onDragStart = '+
DNDObserver.onDragStart.toSource().replace(
'event.target.localName != "tab"',
' gBrowser.treeStyleTab.tabbarDNDObserver.canDragTabbar(event) ||' +
' gBrowser.treeStyleTab.tabbarDNDObserver.canDragTabbar(event) ||\n' +
' $&'
)
);
@ -491,9 +491,9 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
eval('superDrag.onDrop = '+
superDrag.onDrop.toSource().replace(
/(var newTab = getBrowser\(\).addTab\([^\)]+\);)/g,
' if (aDragSession.sourceNode &&' +
' aDragSession.sourceNode.ownerDocument.defaultView.top == getBrowser().contentWindow)' +
' TreeStyleTabService.readyToOpenChildTab(getBrowser());' +
' if (aDragSession.sourceNode &&\n' +
' aDragSession.sourceNode.ownerDocument.defaultView.top == getBrowser().contentWindow)\n' +
' TreeStyleTabService.readyToOpenChildTab(getBrowser());\n' +
' $1'
)
);
@ -506,15 +506,15 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
eval('ddg_ges.Open = '+
ddg_ges.Open.toSource().replace(
'if (mode[1] == "h" || mode[1] == "f") {',
'$&' +
' if ("sourceNode" in aData) // only for dragging from the content tarea.' +
'$&\n' +
' if ("sourceNode" in aData) // only for dragging from the content tarea.\n' +
' TreeStyleTabService.readyToOpenChildTab(getBrowser());'
)
);
eval('ddg_ges.Search = '+
ddg_ges.Search.toSource().replace(
'if (mode[1] == "h" || mode[1] == "f") {',
'$&' +
'$&\n' +
' TreeStyleTabService.readyToOpenChildTab(getBrowser());'
)
);
@ -607,38 +607,38 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
eval('FireGestures.onExtraGesture = '+
FireGestures.onExtraGesture.toSource().replace(
'case "keypress-stop":',
'$&' +
'$&\n' +
' TreeStyleTabService.readyToOpenChildTab(gBrowser, true);'
).replace(
'break;case "gesture-timeout":',
' TreeStyleTabService.stopToOpenChildTab(gBrowser);' +
' TreeStyleTabService.stopToOpenChildTab(gBrowser);\n' +
'$&'
)
);
eval('FireGestures._performAction = '+
FireGestures._performAction.toSource().replace(
'gBrowser.loadOneTab(',
' TreeStyleTabService.readyToOpenChildTab(gBrowser);' +
' TreeStyleTabService.readyToOpenChildTab(gBrowser);\n' +
'$&'
)
);
eval('FireGestures.openURLsInSelection = '+
FireGestures.openURLsInSelection.toSource().replace(
'var tab =',
' if (!TreeStyleTabService.checkToOpenChildTab(gBrowser))' +
' TreeStyleTabService.readyToOpenChildTab(gBrowser, true);' +
' if (!TreeStyleTabService.checkToOpenChildTab(gBrowser))\n' +
' TreeStyleTabService.readyToOpenChildTab(gBrowser, true);\n' +
'$&'
).replace(
'if (!flag)',
' if (TreeStyleTabService.checkToOpenChildTab(gBrowser))' +
' TreeStyleTabService.stopToOpenChildTab(gBrowser);' +
' if (TreeStyleTabService.checkToOpenChildTab(gBrowser))\n' +
' TreeStyleTabService.stopToOpenChildTab(gBrowser);\n' +
'$&'
)
);
eval('FireGestures.handleEvent = '+
FireGestures.handleEvent.toSource().replace(
'gBrowser.loadOneTab(',
' TreeStyleTabService.readyToOpenChildTab(gBrowser);' +
' TreeStyleTabService.readyToOpenChildTab(gBrowser);\n' +
'$&'
)
);
@ -891,27 +891,27 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
if ('MoveContent' in autoHIDE) {
eval('autoHIDE.MoveContent = '+autoHIDE.MoveContent.toSource().replace(
/(;)([^;]*\.setPosition\(0, -\s*ah\.delta\);)/,
'$1' +
' if (autoHIDE.winUtil)' +
' autoHIDE.winUtil.setRedraw(false, false);' +
' $2' +
' gBrowser.treeStyleTab.autoHide.extraYOffset = ah.delta;' +
' window.setTimeout(function() {' +
' gBrowser.treeStyleTab.autoHide.redrawContentArea();' +
' if (autoHIDE.winUtil)' +
' autoHIDE.winUtil.setRedraw(true, false);' +
'$1\n' +
' if (autoHIDE.winUtil)\n' +
' autoHIDE.winUtil.setRedraw(false, false);\n' +
' $2\n' +
' gBrowser.treeStyleTab.autoHide.extraYOffset = ah.delta;\n' +
' window.setTimeout(function() {\n' +
' gBrowser.treeStyleTab.autoHide.redrawContentArea();\n' +
' if (autoHIDE.winUtil)\n' +
' autoHIDE.winUtil.setRedraw(true, false);\n' +
' }, 0);'
).replace(
/(;)([^;]*\.setPosition\(0, 0\);)/,
'$1' +
' if (autoHIDE.winUtil)' +
' autoHIDE.winUtil.setRedraw(false, false);' +
' $2' +
' gBrowser.treeStyleTab.autoHide.extraYOffset = 0;' +
' window.setTimeout(function() {' +
' gBrowser.treeStyleTab.autoHide.redrawContentArea();' +
' if (autoHIDE.winUtil)' +
' autoHIDE.winUtil.setRedraw(true, false);' +
'$1\n' +
' if (autoHIDE.winUtil)\n' +
' autoHIDE.winUtil.setRedraw(false, false);\n' +
' $2\n' +
' gBrowser.treeStyleTab.autoHide.extraYOffset = 0;\n' +
' window.setTimeout(function() {\n' +
' gBrowser.treeStyleTab.autoHide.redrawContentArea();\n' +
' if (autoHIDE.winUtil)\n' +
' autoHIDE.winUtil.setRedraw(true, false);\n' +
' }, 0);'
));
}
@ -929,18 +929,18 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
if (func.indexOf('treeStyleTab') < 0) {
eval('sidewikiWindowHandler.barsContainer_.geometry_.__proto__.getWindowSizeForDrawers = '+func.replace(
'return {',
' if ("treeStyleTab" in this.topLevelDocument_.getElementById("content")) {' +
' let b = this.topLevelDocument_.getElementById("content");' +
' let box = b.mPanelContainer.boxObject;' +
' return {' +
' height : box.height,' +
' width : box.width,' +
' top : box.y,' +
' left : box.x,' +
' right : this.topLevelWindow_.innerWidth - box.x - box.width,' +
' tabBoxHeight : 0' +
' };' +
' }' +
' if ("treeStyleTab" in this.topLevelDocument_.getElementById("content")) {\n' +
' let b = this.topLevelDocument_.getElementById("content");\n' +
' let box = b.mPanelContainer.boxObject;\n' +
' return {\n' +
' height : box.height,\n' +
' width : box.width,\n' +
' top : box.y,\n' +
' left : box.x,\n' +
' right : this.topLevelWindow_.innerWidth - box.x - box.width,\n' +
' tabBoxHeight : 0\n' +
' };\n' +
' }\n' +
'$&'
));
}
@ -963,9 +963,9 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
'[maxSizeProp]'
).replace(
'{',
'{' +
' var scrollProp = gBrowser.treeStyleTab.isVertical ? "scrollHeight" : "scrollWidth" ;' +
' var sizeProp = gBrowser.treeStyleTab.isVertical ? "height" : "width" ;' +
'{\n' +
' var scrollProp = gBrowser.treeStyleTab.isVertical ? "scrollHeight" : "scrollWidth" ;\n' +
' var sizeProp = gBrowser.treeStyleTab.isVertical ? "height" : "width" ;\n' +
' var maxSizeProp = gBrowser.treeStyleTab.isVertical ? "maxHeight" : "maxWidth" ;'
)
}
@ -1181,18 +1181,18 @@ TreeStyleTabWindowHelper.overrideExtensionsDelayed = function TSTWH_overrideExte
eval('gBrowser.TMP_openTabNext = '+
gBrowser.TMP_openTabNext.toSource().replace(
'this.mCurrentTab._tPos + this.tabContainer.nextTab',
' (function() {' +
' var tabs = this.treeStyleTab.getDescendantTabs(this.mCurrentTab);' +
' if (tabs.length) {' +
' var index = this.treeStyleTab.getPref("extensions.tabmix.openTabNextInverse") ?' +
' tabs[tabs.length - 1]._tPos :' +
' this.mCurrentTab._tPos ;' +
' if (index < aTab._tPos) index++;' +
' return index;' +
' }' +
' else {' +
' return ($&);' +
' }' +
' (function() {\n' +
' var tabs = this.treeStyleTab.getDescendantTabs(this.mCurrentTab);\n' +
' if (tabs.length) {\n' +
' var index = this.treeStyleTab.getPref("extensions.tabmix.openTabNextInverse") ?\n' +
' tabs[tabs.length - 1]._tPos :\n' +
' this.mCurrentTab._tPos ;\n' +
' if (index < aTab._tPos) index++;\n' +
' return index;\n' +
' }\n' +
' else {\n' +
' return ($&);\n' +
' }\n' +
' }).call(this)'
)
);
@ -1209,13 +1209,13 @@ TreeStyleTabWindowHelper.overrideExtensionsDelayed = function TSTWH_overrideExte
eval('MultiLinks_Wrapper.LinksManager.OpenInNewTabs = '+
MultiLinks_Wrapper.LinksManager.OpenInNewTabs.toSource().replace(
'{',
'{' +
' if (!TreeStyleTabService.checkToOpenChildTab(getBrowser()))' +
'{\n' +
' if (!TreeStyleTabService.checkToOpenChildTab(getBrowser()))\n' +
' TreeStyleTabService.readyToOpenChildTab(getBrowser(), true);'
).replace(
/(\}\)?)$/,
' if (TreeStyleTabService.checkToOpenChildTab(getBrowser()))' +
' TreeStyleTabService.stopToOpenChildTab(getBrowser());' +
' if (TreeStyleTabService.checkToOpenChildTab(getBrowser()))\n' +
' TreeStyleTabService.stopToOpenChildTab(getBrowser());\n' +
'$1'
)
);

View File

@ -1414,7 +1414,7 @@ var TreeStyleTabBase = {
getTabbarFromChild : function TSTUtils_getTabbarFromChild(aNode)
{
return this.evaluateXPath(
'ancestor-or-self::*[contains(concat(" ", normalize-space(@class), " "), " tabbrowser-strip ")] | '+
'ancestor-or-self::*[contains(concat(" ", normalize-space(@class), " "), " tabbrowser-strip ")] | ' +
'ancestor-or-self::xul:tabs[@tabbrowser] | ' +
'ancestor-or-self::xul:toolbar/child::xul:tabs[@tabbrowser]',
aNode,
@ -1424,7 +1424,7 @@ var TreeStyleTabBase = {
getAncestorTabbarFromChild : function TSTUtils_getAncestorTabbarFromChild(aNode)
{
return this.evaluateXPath(
'ancestor-or-self::*[contains(concat(" ", normalize-space(@class), " "), " tabbrowser-strip ")] | '+
'ancestor-or-self::*[contains(concat(" ", normalize-space(@class), " "), " tabbrowser-strip ")] | ' +
'ancestor-or-self::xul:tabs[@tabbrowser]',
aNode,
Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE

View File

@ -647,8 +647,8 @@ TreeStyleTabBrowser.prototype = {
let pi = d.createProcessingInstruction(
'xml-stylesheet',
'type="text/css" href="data:text/css,'+encodeURIComponent(
('.tabbrowser-tabbox > tabpanels > notificationbox {' +
' background-color: %COLOR%;' +
('.tabbrowser-tabbox > tabpanels > notificationbox {\n' +
' background-color: %COLOR%;\n' +
'}').replace(/%COLOR%/, color)
)+'"'
);

View File

@ -66,20 +66,20 @@ var PseudoTreeBuilder = {
row.className += " "+this.kROOTITEM;
tree.setAttribute('onclick',
('var doc = event.target.ownerDocument;' +
'var label = doc.evaluate(' +
' "ancestor-or-self::*[local-name()=\'label\' and contains(@class, \'text-link\')][1]",' +
' event.target,' +
' null,' +
' Components.interfaces.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE,' +
' null' +
' ).singleNodeValue;' +
'if (label) {' +
' var customEvent = doc.createEvent("DataContainerEvent");' +
' customEvent.initEvent(%EVENT_TYPE%, true, true);' +
' customEvent.setData("id", label.getAttribute("tab-id"));' +
' customEvent.setData("sourceEvent", event);' +
' event.target.dispatchEvent(customEvent);' +
('var doc = event.target.ownerDocument;\n' +
'var label = doc.evaluate(\n' +
' "ancestor-or-self::*[local-name()=\'label\' and contains(@class, \'text-link\')][1]",\n' +
' event.target,\n' +
' null,\n' +
' Components.interfaces.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE,\n' +
' null\n' +
' ).singleNodeValue;\n' +
'if (label) {\n' +
' var customEvent = doc.createEvent("DataContainerEvent");\n' +
' customEvent.initEvent(%EVENT_TYPE%, true, true);\n' +
' customEvent.setData("id", label.getAttribute("tab-id"));\n' +
' customEvent.setData("sourceEvent", event);\n' +
' event.target.dispatchEvent(customEvent);\n' +
'}').replace('%EVENT_TYPE%', this.kTAB_LINK_CLICK.quote()));
return tree;