ブックマークグループの開き方を制御する機能を加えた

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1252 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2007-10-20 17:52:42 +00:00
parent 81e9155879
commit 92957a9466
6 changed files with 136 additions and 46 deletions

View File

@ -0,0 +1,21 @@
var gGroupBookmarkRadio, gGroupBookmarkTreeCheck, gGroupBookmarkReplaceCheck;
function initGroupBookmarkRadio()
{
gGroupBookmarkRadio = document.getElementById('openGroupBookmarkAsTabSubTree-radiogroup');
gGroupBookmarkTree = document.getElementById('extensions.treestyletab.openGroupBookmarkAsTabSubTree');
gGroupBookmarkReplace = document.getElementById('browser.tabs.loadFolderAndReplace');
gGroupBookmarkRadio.value =
gGroupBookmarkTree.value && !gGroupBookmarkReplace.value ? 'subtree' :
!gGroupBookmarkTree.value && !gGroupBookmarkReplace.value ? 'flat' :
'replace';
}
function onChangeGroupBookmarkRadio()
{
gGroupBookmarkTree.value = gGroupBookmarkRadio.value == 'subtree';
gGroupBookmarkReplace.value = gGroupBookmarkRadio.value == 'replace';
}

View File

@ -7,9 +7,10 @@
<prefwindow id="treestyletab-config"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&config.title;"
onload="sizeToContent();">
onload="sizeToContent(); initGroupBookmarkRadio();">
<prefpane id="prefpane-general" label="&config.tabs.general;">
<prefpane id="prefpane-general" label="&config.tabs.general;"
onpaneload="">
<preferences>
<preference id="extensions.treestyletab.autoCollapseExpandSubTreeOnSelect"
name="extensions.treestyletab.autoCollapseExpandSubTreeOnSelect"
@ -27,12 +28,24 @@
<preference id="extensions.treestyletab.focusMode"
name="extensions.treestyletab.focusMode"
type="int"/>
<preference id="extensions.treestyletab.tabbar.scroll.smooth"
name="extensions.treestyletab.tabbar.scroll.smooth"
type="bool"/>
<preference id="extensions.treestyletab.tabbar.position"
name="extensions.treestyletab.tabbar.position"
type="string"/>
<preference id="browser.link.open_newwindow"
name="browser.link.open_newwindow"
type="int"/>
<preference id="browser.link.open_newwindow.restriction"
name="browser.link.open_newwindow.restriction"
type="int"/>
<preference id="extensions.treestyletab.openGroupBookmarkAsTabSubTree"
name="extensions.treestyletab.openGroupBookmarkAsTabSubTree"
type="bool"/>
<preference id="browser.tabs.loadFolderAndReplace"
name="browser.tabs.loadFolderAndReplace"
type="bool"/>
</preferences>
<checkbox id="extensions.treestyletab.autoCollapseExpandSubTreeOnSelect-check"
@ -52,47 +65,49 @@
label="&config.focusMode;"
onsyncfrompreference="return document.getElementById('extensions.treestyletab.focusMode').value == 0;"
onsynctopreference="return document.getElementById('extensions.treestyletab.focusMode-check').checked ? 0 : 1 ;"/>
<checkbox id="extensions.treestyletab.tabbar.scroll.smooth-check"
preference="extensions.treestyletab.tabbar.scroll.smooth"
label="&config.tabbar.scroll.smooth;"/>
<groupbox>
<caption label="&config.tabbar.position.caption;"/>
<radiogroup id="extensions.treestyletab.tabbar.position-radiogroup"
preference="extensions.treestyletab.tabbar.position"
orient="horizontal">
<radio value="left" label="&config.tabbar.position.left;"/>
<radio value="right" label="&config.tabbar.position.right;"/>
</radiogroup>
</groupbox>
<groupbox>
<caption label="&config.open_newwindow.caption;"/>
<vbox>
<radiogroup id="browser.link.open_newwindow-radiogroup"
preference="browser.link.open_newwindow"
orient="vertical">
<radio value="2" label="&config.open_newwindow.window;"/>
<radio value="3" label="&config.open_newwindow.tab;"/>
</radiogroup>
</vbox>
</groupbox>
<groupbox>
<caption label="&config.jsopen.caption;"/>
<vbox>
<radiogroup id="browser.link.open_newwindow.restriction-radiogroup"
preference="browser.link.open_newwindow.restriction"
orient="vertical">
<radio value="2" label="&config.jsopen.default;"/>
<radio value="0" label="&config.jsopen.forcetab;"/>
</radiogroup>
</vbox>
</groupbox>
<groupbox>
<caption label="&config.openGroupBookmarkAsTabSubTree.caption;"/>
<radiogroup id="openGroupBookmarkAsTabSubTree-radiogroup"
orient="vertical"
oncommand="onChangeGroupBookmarkRadio();">
<radio value="subtree" label="&config.openGroupBookmarkAsTabSubTree.subtree;"/>
<radio value="flat" label="&config.openGroupBookmarkAsTabSubTree.flat;"/>
<radio value="replace" label="&config.openGroupBookmarkAsTabSubTree.replace;"/>
</radiogroup>
</groupbox>
</prefpane>
<!--
<prefpane id="prefpane-selection-menu" label="&config.tabs.selectionMenu;">
<preferences id="prefpane-selection-menu-preferences">
<preference id="extensions.treestyletab."
name="extensions.treestyletab."
type="bool"/>
</preferences>
<groupbox>
<caption label="&config..caption;"/>
<vbox>
<checkbox id="extensions.treestyletab.-check"
preference="extensions.treestyletab."
label="&popup.;"/>
</vbox>
</groupbox>
</prefpane>
-->
<script src="config.js" type="application/x-javascript"/>
</prefwindow>

View File

@ -259,6 +259,7 @@ var TreeStyleTabService = {
var parentTab = TreeStyleTabService.getTabFromFrame(aOpener, ownerBrowser);
ownerBrowser.__treestyletab__readyToAttachNewTab = true;
ownerBrowser.__treestyletab__readyToAttachMultiple = false;
ownerBrowser.__treestyletab__parentTab = parentTab.getAttribute(TreeStyleTabService.kID);
})(aOpener);
}
@ -269,6 +270,31 @@ var TreeStyleTabService = {
window.QueryInterface(Components.interfaces.nsIDOMChromeWindow).browserDOMWindow = null;
window.QueryInterface(Components.interfaces.nsIDOMChromeWindow).browserDOMWindow = new nsBrowserAccess();
eval('BookmarksCommand.openGroupBookmark = '+
BookmarksCommand.openGroupBookmark.toSource().replace(
'browser.addTab(uri);',
<><![CDATA[
var openedTab = browser.addTab(uri);
if (!TreeStyleTabService.getPref('browser.tabs.loadFolderAndReplace') &&
TreeStyleTabService.getPref('extensions.treestyletab.openGroupBookmarkAsTabSubTree') &&
!browser.__treestyletab__parentTab) {
browser.__treestyletab__readyToAttachNewTab = true;
browser.__treestyletab__readyToAttachMultiple = true;
browser.__treestyletab__parentTab = openedTab.getAttribute(TreeStyleTabService.kID);
}
]]></>
).replace(
'if (index == index0)',
<><![CDATA[
browser.__treestyletab__readyToAttachNewTab = false;
browser.__treestyletab__readyToAttachMultiple = false;
browser.__treestyletab__parentTab = null;
if (index == index0)]]></>
)
);
if ('MultipleTabService' in window) {
eval('MultipleTabService.showHideMenuItems = '+
MultipleTabService.showHideMenuItems.toSource().replace(
@ -795,6 +821,7 @@ catch(e) {
if (node.href && isMiddleClick) {
var b = this.getTabBrowserFromChildren(aEvent.currentTarget);
b.__treestyletab__readyToAttachNewTab = true;
b.__treestyletab__readyToAttachMultiple = false;
b.__treestyletab__parentTab = b.selectedTab.getAttribute(this.kID);
}
return;
@ -851,8 +878,11 @@ catch(e) {
this.attachTabTo(tab, parent);
}
if (!b.__treestyletab__readyToAttachMultiple) {
b.__treestyletab__readyToAttachNewTab = false;
b.__treestyletab__readyToAttachMultiple = false;
b.__treestyletab__parentTab = '';
}
},
onTabRemoved : function(aEvent)

View File

@ -9,9 +9,11 @@ pref("extensions.treestyletab.tabbar.width", 200);
pref("extensions.treestyletab.tabbar.position", "left");
pref("extensions.treestyletab.tabbar.scroll.smooth", true);
pref("extensions.treestyletab.tabbar.scroll.timeout", 250);
pref("extensions.treestyletab.openGroupBookmarkAsTabSubTree", true);
pref("browser.link.open_newwindow.restriction", 0);
pref("browser.tabs.loadFolderAndReplace", false);
pref("extensions.multipletab.show.multipletab-selection-item-removeTabSubTree", true);

View File

@ -12,13 +12,24 @@
<!ENTITY config.focusMode "Focus to the next/previous tab even if it is invisible, by Control(Command)-Tab">
<!ENTITY config.tabbar.scroll.smooth "Scroll the tab bar smoothly">
<!ENTITY config.tabbar.position.caption "Tab bar position">
<!ENTITY config.tabbar.position.left "Leftside">
<!ENTITY config.tabbar.position.right "Rightside">
<!ENTITY config.open_newwindow.caption "New window opened from links in webpages unexpectedly">
<!ENTITY config.open_newwindow.window "Open as Window">
<!ENTITY config.open_newwindow.tab "Open as Tab (default)">
<!ENTITY config.open_newwindow.tab "Open as Tab (Firefox default)">
<!ENTITY config.jsopen.caption "New window opened from scripts in webpages">
<!ENTITY config.jsopen.default "Open as Window when it have special width, height, etc. (default)">
<!ENTITY config.jsopen.forcetab "Open as Tab instead of Window anyway">
<!ENTITY config.jsopen.default "Open as Window when it have special width, height, etc. (Firefox default)">
<!ENTITY config.jsopen.forcetab "Open as Tab instead of Window anyway (Recommended)">
<!ENTITY config.openGroupBookmarkAsTabSubTree.caption "&quot;Open All in Tabs&quot; from bookmrak folders">
<!ENTITY config.openGroupBookmarkAsTabSubTree.subtree "Open as a sub tree (Recommended)">
<!ENTITY config.openGroupBookmarkAsTabSubTree.flat "Open as separate tabs">
<!ENTITY config.openGroupBookmarkAsTabSubTree.replace "Replace all tabs to the pages in the folder (Firefox default)">

View File

@ -12,13 +12,24 @@
<!ENTITY config.focusMode "Control(Command)-Tabでタブを切り替える時、折りたたまれたタブにもフォーカスする">
<!ENTITY config.tabbar.scroll.smooth "タブバーをなめらかにスクロールする">
<!ENTITY config.tabbar.position.caption "タブバーの表示位置">
<!ENTITY config.tabbar.position.left "ウィンドウの左側">
<!ENTITY config.tabbar.position.right "ウィンドウの右側">
<!ENTITY config.open_newwindow.caption "Webページのリンクから勝手に開かれたウィンドウの制御">
<!ENTITY config.open_newwindow.window "ウィンドウで開く">
<!ENTITY config.open_newwindow.tab "タブで開く(初期値)">
<!ENTITY config.open_newwindow.tab "タブで開く(Firefox初期状態">
<!ENTITY config.jsopen.caption "Webページのスクリプトで開かれるウィンドウの制御">
<!ENTITY config.jsopen.default "大きさや位置を指定されたウィンドウはウィンドウとして開く(初期値)">
<!ENTITY config.jsopen.forcetab "スクリプトで開かれるウィンドウはすべてタブで開く">
<!ENTITY config.jsopen.default "大きさや位置を指定されたウィンドウはウィンドウとして開くFirefox初期状態">
<!ENTITY config.jsopen.forcetab "スクリプトで開かれるウィンドウはすべてタブで開く(推奨)">
<!ENTITY config.openGroupBookmarkAsTabSubTree.caption "ブックマークフォルダの内容をタブで開く時の扱い">
<!ENTITY config.openGroupBookmarkAsTabSubTree.subtree "一つのサブツリーとして開く(推奨)">
<!ENTITY config.openGroupBookmarkAsTabSubTree.flat "ばらばらのタブとして開く">
<!ENTITY config.openGroupBookmarkAsTabSubTree.replace "現在開いているすべてのタブをブックマークの内容で置き換えるFirefox初期状態">