他のアドオンから連携しやすいようにAPIを整えた

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1261 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2007-10-21 08:04:39 +00:00
parent 904582b14a
commit 59f1cf2aff

View File

@ -330,17 +330,13 @@ var TreeStyleTabService = {
if (!TreeStyleTabService.getPref('browser.tabs.loadFolderAndReplace') && if (!TreeStyleTabService.getPref('browser.tabs.loadFolderAndReplace') &&
TreeStyleTabService.getPref('extensions.treestyletab.openGroupBookmarkAsTabSubTree') && TreeStyleTabService.getPref('extensions.treestyletab.openGroupBookmarkAsTabSubTree') &&
!browser.__treestyletab__parentTab) { !browser.__treestyletab__parentTab) {
browser.__treestyletab__readyToAttachNewTab = true; TreeStyleTabService.readyToOpenChildTab(openedTab, true);
browser.__treestyletab__readyToAttachMultiple = true;
browser.__treestyletab__parentTab = openedTab.getAttribute(TreeStyleTabService.kID);
} }
]]></> ]]></>
).replace( ).replace(
'if (index == index0)', 'if (index == index0)',
<><![CDATA[ <><![CDATA[
browser.__treestyletab__readyToAttachNewTab = false; TreeStyleTabService.stopToOpenChildTab(browser);
browser.__treestyletab__readyToAttachMultiple = false;
browser.__treestyletab__parentTab = null;
if (index == index0)]]></> if (index == index0)]]></>
) )
); );
@ -861,9 +857,7 @@ catch(e) {
} }
if (node.href && isMiddleClick) { if (node.href && isMiddleClick) {
var b = this.getTabBrowserFromChildren(aEvent.currentTarget); var b = this.getTabBrowserFromChildren(aEvent.currentTarget);
b.__treestyletab__readyToAttachNewTab = true; this.readyToOpenChildTab(b.selectedTab);
b.__treestyletab__readyToAttachMultiple = false;
b.__treestyletab__parentTab = b.selectedTab.getAttribute(this.kID);
} }
return; return;
@ -920,9 +914,7 @@ catch(e) {
} }
if (!b.__treestyletab__readyToAttachMultiple) { if (!b.__treestyletab__readyToAttachMultiple) {
b.__treestyletab__readyToAttachNewTab = false; this.stopToOpenChildTab(b);
b.__treestyletab__readyToAttachMultiple = false;
b.__treestyletab__parentTab = '';
} }
}, },
@ -1586,15 +1578,45 @@ catch(e) {
} }
}, },
readyToOpenChildTab : function(aFrame) readyToOpenChildTab : function(aFrameOrTabBrowser, aMultiple)
{ {
if (!aFrame) var frame = aFrameOrTabBrowser;
aFrame = TreeStyleTabService.browser.contentWindow; if (frame == '[object XULElement]') {
if (frame.localName == 'tab') {
frame = frame.linkedBrowser.contentWindow;
}
else if (frame.localName == 'browser') {
frame = frame.contentWindow;
}
else {
frame = this.getTabBrowserFromChildren(frame);
if (!frame) return;
frame = frame.contentWindow;
}
}
if (!frame)
frame = this.browser.contentWindow;
var ownerBrowser = ('SplitBrowser' in window) ? this.getTabBrowserFromChildren(SplitBrowser.getSubBrowserAndBrowserFromFrame(aFrame.top).browser) : gBrowser ; var ownerBrowser = ('SplitBrowser' in window) ? this.getTabBrowserFromChildren(SplitBrowser.getSubBrowserAndBrowserFromFrame(aFrame.top).browser) : gBrowser ;
ownerBrowser.__treestyletab__readyToAttachNewTab = true; ownerBrowser.__treestyletab__readyToAttachNewTab = true;
ownerBrowser.__treestyletab__readyToAttachMultiple = aMultiple || false ;
ownerBrowser.__treestyletab__parentTab = this.getTabFromFrame(frame, ownerBrowser).getAttribute(this.kID);
},
stopToOpenChildTab : function(aFrameOrTabBrowser)
{
var frame = aFrameOrTabBrowser;
if (frame == '[object XULElement]') {
frame = this.getTabBrowserFromChildren(frame);
if (!frame) return;
frame = frame.contentWindow;
}
if (!frame)
frame = this.browser.contentWindow;
var ownerBrowser = ('SplitBrowser' in window) ? this.getTabBrowserFromChildren(SplitBrowser.getSubBrowserAndBrowserFromFrame(frame.top).browser) : gBrowser ;
ownerBrowser.__treestyletab__readyToAttachNewTab = false;
ownerBrowser.__treestyletab__readyToAttachMultiple = false; ownerBrowser.__treestyletab__readyToAttachMultiple = false;
ownerBrowser.__treestyletab__parentTab = this.getTabFromFrame(aFrame, ownerBrowser).getAttribute(this.kID); ownerBrowser.__treestyletab__parentTab = null;
}, },
/* attach/part */ /* attach/part */