常にすべてのリンクをタブで開く設定や、常にロケーションバーのすべての入力を

タブで開く設定の時、Ctrl、Command、Altなどのモディファイアキーによる挙動の反転が
機能していなかったのを修正


git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1386 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2007-10-29 15:49:00 +00:00
parent 5c292d477a
commit 0385c462c4

View File

@ -141,7 +141,7 @@ var TreeStyleTabService = {
return ownerBrowser.__treestyletab__readyToAttachNewTab || ownerBrowser.__treestyletab__readyToAttachNewTabGroup ? true : false ; return ownerBrowser.__treestyletab__readyToAttachNewTab || ownerBrowser.__treestyletab__readyToAttachNewTabGroup ? true : false ;
}, },
checkReadyToOpenNewChildTab : function(aInfo) checkReadyToOpenNewTab : function(aInfo)
{ {
/* /*
®Ì<EFBFBD>ྠ®Ì<EFBFBD>à¾
@ -184,29 +184,40 @@ var TreeStyleTabService = {
var b = this.getTabBrowserFromFrame(frame); var b = this.getTabBrowserFromFrame(frame);
var nextTab = this.getNextSiblingTab(currentTab); var nextTab = this.getNextSiblingTab(currentTab);
return ( var openTab = false;
( var parent = null;
internal.newTab && var insertBefore = null;
currentHost == targetHost &&
currentURI != 'about:blank' && if (info.modifier) openTab = true;
currentURI.split('#')[0] != info.uri.split('#')[0] &&
(this.readyToOpenChildTab( if (
(parentHost == targetHost && !internal.forceChild ? parentTab : frame), internal.newTab &&
false, currentHost == targetHost &&
(parentHost == targetHost && !internal.forceChild && ( currentURI != 'about:blank' &&
this.getTabById(currentTab.__treestyletab__next, b) || currentURI.split('#')[0] != info.uri.split('#')[0]
(nextTab ? (currentTab.__treestyletab__next = nextTab.getAttribute(this.kID), nextTab) : null ) ) {
)) openTab = info.modifier && info.invert ? !openTab : true ;
), parent = parentHost == targetHost && !internal.forceChild ? parentTab : frame ;
true) insertBefore = parentHost == targetHost && !internal.forceChild && (
) || this.getTabById(currentTab.__treestyletab__next, b) ||
( (nextTab ? (currentTab.__treestyletab__next = nextTab.getAttribute(this.kID), nextTab) : null )
external.newTab && );
currentHost != targetHost && }
currentURI != 'about:blank' && else if (
(external.forceChild ? (this.readyToOpenChildTab(frame), true) : true ) external.newTab &&
) currentHost != targetHost &&
); currentURI != 'about:blank'
) {
openTab = info.modifier && info.invert ? !openTab : true ;
if (external.forceChild) {
parent = frame;
}
}
if (openTab && parent) {
this.readyToOpenChildTab(parent, false, insertBefore);
}
return openTab;
}, },
/* Utilities */ /* Utilities */
@ -827,22 +838,13 @@ catch(e) {
window.BrowserLoadURL.toSource().replace( window.BrowserLoadURL.toSource().replace(
'aTriggeringEvent && aTriggeringEvent.altKey', 'aTriggeringEvent && aTriggeringEvent.altKey',
<><![CDATA[ <><![CDATA[
( TreeStyleTabService.checkReadyToOpenNewTab({
(aTriggeringEvent && aTriggeringEvent.altKey) || uri : url,
TreeStyleTabService.checkReadyToOpenNewChildTab({ external : { newTab : TreeStyleTabService.getTreePref('urlbar.loadDifferentDomainToNewTab') },
uri : url, internal : { newTab : TreeStyleTabService.getTreePref('urlbar.loadSameDomainToNewChildTab') },
external : { newTab : TreeStyleTabService.getTreePref('urlbar.loadDifferentDomainToNewTab') }, modifier : aTriggeringEvent && aTriggeringEvent.altKey,
internal : { newTab : TreeStyleTabService.getTreePref('urlbar.loadSameDomainToNewChildTab') } invert : TreeStyleTabService.getTreePref('urlbar.invertDefaultBehavior')
}) })
) &&
(
(aTriggeringEvent && aTriggeringEvent.altKey) != TreeStyleTabService.checkToOpenChildTab() ||
!TreeStyleTabService.getTreePref('urlbar.invertDefaultBehavior') ||
(
TreeStyleTabService.checkToOpenChildTab() &&
(TreeStyleTabService.stopToOpenChildTab(), false)
)
)
]]></> ]]></>
) )
); );
@ -906,32 +908,22 @@ catch(e) {
).replace( ).replace(
/(event.ctrlKey|event.metaKey)/, /(event.ctrlKey|event.metaKey)/,
<><![CDATA[ <><![CDATA[
( TreeStyleTabService.checkReadyToOpenNewTab({
$1 || uri : href,
TreeStyleTabService.checkReadyToOpenNewChildTab({ external : {
uri : href, newTab : TreeStyleTabService.getTreePref('openOuterLinkInNewTab') || TreeStyleTabService.getTreePref('openAnyLinkInNewTab'),
external : { forceChild : true
newTab : TreeStyleTabService.getTreePref('openOuterLinkInNewTab') || TreeStyleTabService.getTreePref('openAnyLinkInNewTab'), },
forceChild : true internal : {
}, newTab : TreeStyleTabService.getTreePref('openAnyLinkInNewTab')
internal : { },
newTab : TreeStyleTabService.getTreePref('openAnyLinkInNewTab') modifier : $1,
} invert : TreeStyleTabService.getTreePref('link.invertDefaultBehavior')
}) }) ? true : (TreeStyleTabService.readyToOpenChildTab(), false)
) &&
(
$1 != TreeStyleTabService.checkToOpenChildTab() ||
!TreeStyleTabService.getTreePref('link.invertDefaultBehavior') ||
(
TreeStyleTabService.readyToOpenChildTab(),
false
)
) // don't cancel child tab at this point, because I reuse the flag to load link after this block.
]]></> ]]></>
).replace( ).replace(
'return false;case 1:', 'return false;case 1:',
<><![CDATA[ <><![CDATA[
// cancel child tab at this point and load link to imitate default link behavior.
if (TreeStyleTabService.checkToOpenChildTab()) { if (TreeStyleTabService.checkToOpenChildTab()) {
TreeStyleTabService.stopToOpenChildTab(); TreeStyleTabService.stopToOpenChildTab();
urlSecurityCheck(href, linkNode.ownerDocument.location.href); urlSecurityCheck(href, linkNode.ownerDocument.location.href);
@ -956,7 +948,7 @@ catch(e) {
/(openWebPanel\([^\(]+\("webPanels"\), wrapper.href\);event.preventDefault\(\);return false;\})/, /(openWebPanel\([^\(]+\("webPanels"\), wrapper.href\);event.preventDefault\(\);return false;\})/,
<><![CDATA[ <><![CDATA[
$1 $1
else if (TreeStyleTabService.checkReadyToOpenNewChildTab({ else if (TreeStyleTabService.checkReadyToOpenNewTab({
uri : wrapper.href, uri : wrapper.href,
external : { external : {
newTab : TreeStyleTabService.getTreePref('openOuterLinkInNewTab') || TreeStyleTabService.getTreePref('openAnyLinkInNewTab'), newTab : TreeStyleTabService.getTreePref('openOuterLinkInNewTab') || TreeStyleTabService.getTreePref('openAnyLinkInNewTab'),