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

タブで開く設定の時、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;
var insertBefore = null;
if (info.modifier) openTab = true;
if (
internal.newTab && internal.newTab &&
currentHost == targetHost && currentHost == targetHost &&
currentURI != 'about:blank' && currentURI != 'about:blank' &&
currentURI.split('#')[0] != info.uri.split('#')[0] && currentURI.split('#')[0] != info.uri.split('#')[0]
(this.readyToOpenChildTab( ) {
(parentHost == targetHost && !internal.forceChild ? parentTab : frame), openTab = info.modifier && info.invert ? !openTab : true ;
false, parent = parentHost == targetHost && !internal.forceChild ? parentTab : frame ;
(parentHost == targetHost && !internal.forceChild && ( insertBefore = parentHost == targetHost && !internal.forceChild && (
this.getTabById(currentTab.__treestyletab__next, b) || this.getTabById(currentTab.__treestyletab__next, b) ||
(nextTab ? (currentTab.__treestyletab__next = nextTab.getAttribute(this.kID), nextTab) : null ) (nextTab ? (currentTab.__treestyletab__next = nextTab.getAttribute(this.kID), nextTab) : null )
)) );
), }
true) else if (
) ||
(
external.newTab && external.newTab &&
currentHost != targetHost && currentHost != targetHost &&
currentURI != 'about:blank' && currentURI != 'about:blank'
(external.forceChild ? (this.readyToOpenChildTab(frame), true) : true ) ) {
) 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) ||
TreeStyleTabService.checkReadyToOpenNewChildTab({
uri : url, uri : url,
external : { newTab : TreeStyleTabService.getTreePref('urlbar.loadDifferentDomainToNewTab') }, external : { newTab : TreeStyleTabService.getTreePref('urlbar.loadDifferentDomainToNewTab') },
internal : { newTab : TreeStyleTabService.getTreePref('urlbar.loadSameDomainToNewChildTab') } internal : { newTab : TreeStyleTabService.getTreePref('urlbar.loadSameDomainToNewChildTab') },
modifier : aTriggeringEvent && aTriggeringEvent.altKey,
invert : TreeStyleTabService.getTreePref('urlbar.invertDefaultBehavior')
}) })
) &&
(
(aTriggeringEvent && aTriggeringEvent.altKey) != TreeStyleTabService.checkToOpenChildTab() ||
!TreeStyleTabService.getTreePref('urlbar.invertDefaultBehavior') ||
(
TreeStyleTabService.checkToOpenChildTab() &&
(TreeStyleTabService.stopToOpenChildTab(), false)
)
)
]]></> ]]></>
) )
); );
@ -906,9 +908,7 @@ catch(e) {
).replace( ).replace(
/(event.ctrlKey|event.metaKey)/, /(event.ctrlKey|event.metaKey)/,
<><![CDATA[ <><![CDATA[
( TreeStyleTabService.checkReadyToOpenNewTab({
$1 ||
TreeStyleTabService.checkReadyToOpenNewChildTab({
uri : href, uri : href,
external : { external : {
newTab : TreeStyleTabService.getTreePref('openOuterLinkInNewTab') || TreeStyleTabService.getTreePref('openAnyLinkInNewTab'), newTab : TreeStyleTabService.getTreePref('openOuterLinkInNewTab') || TreeStyleTabService.getTreePref('openAnyLinkInNewTab'),
@ -916,22 +916,14 @@ catch(e) {
}, },
internal : { internal : {
newTab : TreeStyleTabService.getTreePref('openAnyLinkInNewTab') 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'),