Simplify codes dynamically inserted by eval()
This commit is contained in:
parent
d1977a1695
commit
d7121d9042
@ -33,12 +33,7 @@ var TreeStyleTabWindowHelper = {
|
|||||||
eval('nsBrowserAccess.prototype.openURI = '+
|
eval('nsBrowserAccess.prototype.openURI = '+
|
||||||
nsBrowserAccess.prototype.openURI.toSource().replace(
|
nsBrowserAccess.prototype.openURI.toSource().replace(
|
||||||
/(switch\s*\(aWhere\))/,
|
/(switch\s*\(aWhere\))/,
|
||||||
<![CDATA[
|
'TreeStyleTabService.onBeforeBrowserAccessOpenURI(aOpener, aWhere); $1'
|
||||||
if (aOpener &&
|
|
||||||
aWhere == Components.interfaces.nsIBrowserDOMWindow.OPEN_NEWTAB) {
|
|
||||||
TreeStyleTabService.readyToOpenChildTab(aOpener);
|
|
||||||
}
|
|
||||||
$1]]>
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -190,28 +185,19 @@ var TreeStyleTabWindowHelper = {
|
|||||||
eval('nsContextMenu.prototype.'+viewImageMethod+' = '+
|
eval('nsContextMenu.prototype.'+viewImageMethod+' = '+
|
||||||
nsContextMenu.prototype[viewImageMethod].toSource().replace(
|
nsContextMenu.prototype[viewImageMethod].toSource().replace(
|
||||||
'openUILink(',
|
'openUILink(',
|
||||||
<![CDATA[
|
'TreeStyleTabService.onBeforeViewMedia(e, this.target.ownerDocument.defaultView); $&'
|
||||||
if (String(whereToOpenLink(e, false, true)).indexOf('tab') == 0)
|
|
||||||
TreeStyleTabService.readyToOpenChildTab(this.target.ownerDocument.defaultView);
|
|
||||||
$&]]>
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
eval('nsContextMenu.prototype.viewBGImage = '+
|
eval('nsContextMenu.prototype.viewBGImage = '+
|
||||||
nsContextMenu.prototype.viewBGImage.toSource().replace(
|
nsContextMenu.prototype.viewBGImage.toSource().replace(
|
||||||
'openUILink(',
|
'openUILink(',
|
||||||
<![CDATA[
|
'TreeStyleTabService.onBeforeViewMedia(e, this.target.ownerDocument.defaultView); $&'
|
||||||
if (String(whereToOpenLink(e, false, true)).indexOf('tab') == 0)
|
|
||||||
TreeStyleTabService.readyToOpenChildTab(this.target.ownerDocument.defaultView);
|
|
||||||
$&]]>
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
eval('nsContextMenu.prototype.addDictionaries = '+
|
eval('nsContextMenu.prototype.addDictionaries = '+
|
||||||
nsContextMenu.prototype.addDictionaries.toSource().replace(
|
nsContextMenu.prototype.addDictionaries.toSource().replace(
|
||||||
'openUILinkIn(',
|
'openUILinkIn(',
|
||||||
<![CDATA[
|
'TreeStyleTabService.onBeforeOpenLink(aWhere, this.target.ownerDocument.defaultView); $&'
|
||||||
if (where.indexOf('tab') == 0)
|
|
||||||
TreeStyleTabService.readyToOpenChildTab(this.target.ownerDocument.defaultView);
|
|
||||||
$&]]>
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -219,19 +205,8 @@ var TreeStyleTabWindowHelper = {
|
|||||||
'loadSearch' in BrowserSearch) {
|
'loadSearch' in BrowserSearch) {
|
||||||
eval('BrowserSearch.loadSearch = '+
|
eval('BrowserSearch.loadSearch = '+
|
||||||
BrowserSearch.loadSearch.toSource().replace(
|
BrowserSearch.loadSearch.toSource().replace(
|
||||||
// for old Firefox 4 and olders
|
|
||||||
'if (useNewTab) {',
|
|
||||||
<![CDATA[$&
|
|
||||||
if (TreeStyleTabService.shouldOpenSearchResultAsChild(arguments[0]))
|
|
||||||
TreeStyleTabService.readyToOpenChildTab();
|
|
||||||
]]>
|
|
||||||
).replace(
|
|
||||||
// for Firefox 5 and later
|
|
||||||
'openLinkIn(',
|
'openLinkIn(',
|
||||||
<![CDATA[
|
'TreeStyleTabService.onBeforeBrowserSearch(arguments[0], useNewTab); $&'
|
||||||
if (useNewTab && TreeStyleTabService.shouldOpenSearchResultAsChild(arguments[0]))
|
|
||||||
TreeStyleTabService.readyToOpenChildTab();
|
|
||||||
$&]]>
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -262,11 +237,7 @@ var TreeStyleTabWindowHelper = {
|
|||||||
eval('window.openLinkIn = '+
|
eval('window.openLinkIn = '+
|
||||||
window.openLinkIn.toSource().replace(
|
window.openLinkIn.toSource().replace(
|
||||||
'browser.loadOneTab(',
|
'browser.loadOneTab(',
|
||||||
<![CDATA[
|
'TreeStyleTabService.onBeforeOpenLinkWithParams(params); $&'
|
||||||
if (params.linkNode &&
|
|
||||||
!TreeStyleTabService.checkToOpenChildTab(params.linkNode.ownerDocument.defaultView))
|
|
||||||
TreeStyleTabService.readyToOpenChildTab(params.linkNode.ownerDocument.defaultView);
|
|
||||||
$&]]>.toString()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -287,9 +258,7 @@ var TreeStyleTabWindowHelper = {
|
|||||||
// for Tab Utilities, etc. Some addons insert openNewTabWith() to the function.
|
// for Tab Utilities, etc. Some addons insert openNewTabWith() to the function.
|
||||||
// (calls for the function is not included by Firefox default.)
|
// (calls for the function is not included by Firefox default.)
|
||||||
/(openNewTabWith\()/g,
|
/(openNewTabWith\()/g,
|
||||||
<![CDATA[
|
'TreeStyleTabService.onBeforeOpenNewTabByThirdParty(event.target.ownerDocument.defaultView); $1'
|
||||||
if (!TreeStyleTabService.checkToOpenChildTab(event.target.ownerDocument.defaultView)) TreeStyleTabService.readyToOpenChildTab(event.target.ownerDocument.defaultView);
|
|
||||||
$1]]>
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,10 +284,7 @@ var TreeStyleTabWindowHelper = {
|
|||||||
continue;
|
continue;
|
||||||
eval(func+' = '+source.replace(
|
eval(func+' = '+source.replace(
|
||||||
/((?:openUILinkIn|duplicateTabIn)\()/g,
|
/((?:openUILinkIn|duplicateTabIn)\()/g,
|
||||||
<![CDATA[
|
'TreeStyleTabService.onBeforeOpenLink(where); $1'
|
||||||
if (where == 'tab' || where == 'tabshifted')
|
|
||||||
TreeStyleTabService.readyToOpenChildTab();
|
|
||||||
$1]]>
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,10 +300,7 @@ var TreeStyleTabWindowHelper = {
|
|||||||
continue;
|
continue;
|
||||||
eval(func+' = '+source.replace(
|
eval(func+' = '+source.replace(
|
||||||
/((?:openUILinkIn|duplicateTabIn)\()/g,
|
/((?:openUILinkIn|duplicateTabIn)\()/g,
|
||||||
<![CDATA[
|
'TreeStyleTabService.onBeforeTabReloadOrDuplicate(where); $&'
|
||||||
if (where == 'tab' || where == 'tabshifted')
|
|
||||||
TreeStyleTabService.onBeforeTabDuplicate(null);
|
|
||||||
$&]]>
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -355,9 +318,7 @@ var TreeStyleTabWindowHelper = {
|
|||||||
continue;
|
continue;
|
||||||
eval(func+' = '+source.replace(
|
eval(func+' = '+source.replace(
|
||||||
'gBrowser.loadTabs(',
|
'gBrowser.loadTabs(',
|
||||||
<![CDATA[
|
'TreeStyleTabService.readyToOpenNewTabGroup(gBrowser); $&'
|
||||||
TreeStyleTabService.readyToOpenNewTabGroup(gBrowser);
|
|
||||||
$&]]>
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -365,10 +326,7 @@ var TreeStyleTabWindowHelper = {
|
|||||||
eval('FeedHandler.loadFeed = '+
|
eval('FeedHandler.loadFeed = '+
|
||||||
FeedHandler.loadFeed.toSource().replace(
|
FeedHandler.loadFeed.toSource().replace(
|
||||||
'openUILink(',
|
'openUILink(',
|
||||||
<![CDATA[
|
'TreeStyleTabService.onBeforeViewMedia(event, gBrowser); $&'
|
||||||
if (String(whereToOpenLink(event, false, true)).indexOf('tab') == 0)
|
|
||||||
TreeStyleTabService.readyToOpenChildTab(gBrowser);
|
|
||||||
$&]]>
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -381,15 +339,7 @@ var TreeStyleTabWindowHelper = {
|
|||||||
eval('FullScreen.toggle = '+
|
eval('FullScreen.toggle = '+
|
||||||
FullScreen.toggle.toSource().replace(
|
FullScreen.toggle.toSource().replace(
|
||||||
'{',
|
'{',
|
||||||
<![CDATA[{
|
'{ gBrowser.treeStyleTab.onBeforeFullScreenToggle(); '
|
||||||
var treeStyleTab = gBrowser.treeStyleTab;
|
|
||||||
if (treeStyleTab.position != 'top') {
|
|
||||||
if (window.fullScreen)
|
|
||||||
treeStyleTab.autoHide.endForFullScreen();
|
|
||||||
else
|
|
||||||
treeStyleTab.autoHide.startForFullScreen();
|
|
||||||
}
|
|
||||||
]]>
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -458,8 +408,7 @@ var TreeStyleTabWindowHelper = {
|
|||||||
eval('searchbar.doSearch = '+searchbar.doSearch.toSource().replace(
|
eval('searchbar.doSearch = '+searchbar.doSearch.toSource().replace(
|
||||||
/(openUILinkIn\(.+?\);)/,
|
/(openUILinkIn\(.+?\);)/,
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
if (TreeStyleTabService.shouldOpenSearchResultAsChild(arguments[0]))
|
TreeStyleTabService.onBeforeBrowserSearch(arguments[0]);
|
||||||
TreeStyleTabService.readyToOpenChildTab();
|
|
||||||
$1
|
$1
|
||||||
TreeStyleTabService.stopToOpenChildTab();
|
TreeStyleTabService.stopToOpenChildTab();
|
||||||
]]>.toString()
|
]]>.toString()
|
||||||
|
@ -4628,6 +4628,16 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onBeforeFullScreenToggle : function TSTBrowser_onBeforeFullScreenToggle()
|
||||||
|
{
|
||||||
|
if (this.position != 'top') {
|
||||||
|
if (this.window.fullScreen)
|
||||||
|
this.autoHide.endForFullScreen();
|
||||||
|
else
|
||||||
|
this.autoHide.startForFullScreen();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onTreeStyleTabPrintPreviewEntered : function TSTBrowser_onTreeStyleTabPrintPreviewEntered(aEvent)
|
onTreeStyleTabPrintPreviewEntered : function TSTBrowser_onTreeStyleTabPrintPreviewEntered(aEvent)
|
||||||
{
|
{
|
||||||
this.setTabbrowserAttribute(this.kPRINT_PREVIEW, true);
|
this.setTabbrowserAttribute(this.kPRINT_PREVIEW, true);
|
||||||
|
@ -1171,6 +1171,50 @@ TreeStyleTabWindow.prototype = {
|
|||||||
this._handleNewTabCommand(aTab || b.selectedTab, this.getTreePref('autoAttach.duplicateTabCommand'));
|
this._handleNewTabCommand(aTab || b.selectedTab, this.getTreePref('autoAttach.duplicateTabCommand'));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onBeforeTabReloadOrDuplicate : function TSTWindow_onBeforeTabReloadOrDuplicate(aWhere)
|
||||||
|
{
|
||||||
|
if (aWhere == 'tab' || aWhere == 'tabshifted')
|
||||||
|
this.onBeforeTabDuplicate(null);
|
||||||
|
},
|
||||||
|
|
||||||
|
onBeforeOpenLink : function TSTWindow_onBeforeOpenLink(aWhere, aOwner)
|
||||||
|
{
|
||||||
|
if (aWhere == 'tab' || aWhere == 'tabshifted')
|
||||||
|
this.readyToOpenChildTab(aOwner);
|
||||||
|
},
|
||||||
|
|
||||||
|
onBeforeOpenLinkWithParams : function TSTWindow_onBeforeOpenLinkWithParams(aParams)
|
||||||
|
{
|
||||||
|
if (aParams.linkNode &&
|
||||||
|
!this.checkToOpenChildTab(aParams.linkNode.ownerDocument.defaultView))
|
||||||
|
this.readyToOpenChildTab(aParams.linkNode.ownerDocument.defaultView);
|
||||||
|
},
|
||||||
|
|
||||||
|
onBeforeOpenNewTabByThirdParty : function TSTWindow_onBeforeOpenNewTabByThirdParty(aOwner)
|
||||||
|
{
|
||||||
|
if (!this.checkToOpenChildTab(aOwner))
|
||||||
|
this.readyToOpenChildTab(aOwner);
|
||||||
|
},
|
||||||
|
|
||||||
|
onBeforeBrowserAccessOpenURI : function TSTWindow_onBeforeBrowserAccessOpenURI(aOpener, aWhere)
|
||||||
|
{
|
||||||
|
if (aOpener && aWhere == Ci.nsIBrowserDOMWindow.OPEN_NEWTAB)
|
||||||
|
this.readyToOpenChildTab(aOpener);
|
||||||
|
},
|
||||||
|
|
||||||
|
onBeforeViewMedia : function TSTWindow_onBeforeViewMedia(aEvent, aOwner)
|
||||||
|
{
|
||||||
|
if (String(this.window.whereToOpenLink(aEvent, false, true)).indexOf('tab') == 0)
|
||||||
|
this.readyToOpenChildTab(aOwner);
|
||||||
|
},
|
||||||
|
|
||||||
|
onBeforeBrowserSearch : function TSTWindow_onBeforeBrowserSearch(aTerm, aForceNewTab)
|
||||||
|
{
|
||||||
|
if ((argumeuts.length == 1 || aForceNewTab) &&
|
||||||
|
this.shouldOpenSearchResultAsChild(aTerm))
|
||||||
|
this.readyToOpenChildTab();
|
||||||
|
},
|
||||||
|
|
||||||
/* Tree Style Tabの初期化が行われる前に復元されたセッションについてツリー構造を復元 */
|
/* Tree Style Tabの初期化が行われる前に復元されたセッションについてツリー構造を復元 */
|
||||||
|
|
||||||
onTabRestored : function TSTWindow_onTabRestored(aEvent)
|
onTabRestored : function TSTWindow_onTabRestored(aEvent)
|
||||||
|
Loading…
Reference in New Issue
Block a user