文字列やリンクのタブ上へのドロップの際の挙動を変更できるようにした
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1267 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
b9a4e45f68
commit
d808aec575
@ -68,6 +68,9 @@
|
||||
<preference id="browser.tabs.loadFolderAndReplace"
|
||||
name="browser.tabs.loadFolderAndReplace"
|
||||
type="bool"/>
|
||||
<preference id="extensions.treestyletab.loadDroppedLinkToNewChildTab"
|
||||
name="extensions.treestyletab.loadDroppedLinkToNewChildTab"
|
||||
type="bool"/>
|
||||
</preferences>
|
||||
|
||||
<groupbox>
|
||||
@ -98,6 +101,15 @@
|
||||
<radio value="replace" label="&config.openGroupBookmarkAsTabSubTree.replace;"/>
|
||||
</radiogroup>
|
||||
</groupbox>
|
||||
<groupbox>
|
||||
<caption label="&config.loadDroppedLinkToNewChildTab.caption;"/>
|
||||
<radiogroup id="extensions.treestyletab.loadDroppedLinkToNewChildTab-radiogroup"
|
||||
preference="extensions.treestyletab.loadDroppedLinkToNewChildTab"
|
||||
orient="vertical">
|
||||
<radio value="false" label="&config.loadDroppedLinkToNewChildTab.load;"/>
|
||||
<radio value="true" label="&config.loadDroppedLinkToNewChildTab.newTab;"/>
|
||||
</radiogroup>
|
||||
</groupbox>
|
||||
</prefpane>
|
||||
|
||||
<prefpane id="prefpane-advanced" label="&config.tabs.advanced;">
|
||||
|
@ -85,7 +85,7 @@ var TreeStyleTabService = {
|
||||
_ObserverService : null,
|
||||
|
||||
/* API */
|
||||
|
||||
|
||||
readyToOpenChildTab : function(aFrameOrTabBrowser, aMultiple)
|
||||
{
|
||||
var frame = this.getFrameFromTabBrowserElements(aFrameOrTabBrowser);
|
||||
@ -118,7 +118,7 @@ var TreeStyleTabService = {
|
||||
},
|
||||
|
||||
/* Utilities */
|
||||
|
||||
|
||||
isEventFiredOnTabIcon : function(aEvent)
|
||||
{
|
||||
var tab = this.getTabFromEvent(aEvent);
|
||||
@ -251,7 +251,7 @@ var TreeStyleTabService = {
|
||||
|
||||
return frame;
|
||||
},
|
||||
|
||||
|
||||
isTabVertical : function(aTabOrChild)
|
||||
{
|
||||
var b = this.getTabBrowserFromChildren(aTabOrChild);
|
||||
@ -288,7 +288,7 @@ var TreeStyleTabService = {
|
||||
},
|
||||
|
||||
/* Initializing */
|
||||
|
||||
|
||||
init : function()
|
||||
{
|
||||
if (!('gBrowser' in window)) return;
|
||||
@ -304,142 +304,8 @@ var TreeStyleTabService = {
|
||||
this.addPrefListener(this);
|
||||
this.observe(null, 'nsPref:changed', 'extensions.treestyletab.levelMargin');
|
||||
|
||||
eval('nsContextMenu.prototype.openLinkInTab = '+
|
||||
nsContextMenu.prototype.openLinkInTab.toSource().replace(
|
||||
'{',
|
||||
<><![CDATA[
|
||||
{
|
||||
TreeStyleTabService.readyToOpenChildTab(this.target.ownerDocument.defaultView);
|
||||
]]></>
|
||||
)
|
||||
);
|
||||
eval('nsContextMenu.prototype.openFrameInTab = '+
|
||||
nsContextMenu.prototype.openFrameInTab.toSource().replace(
|
||||
'{',
|
||||
<><![CDATA[
|
||||
{
|
||||
TreeStyleTabService.readyToOpenChildTab(this.target.ownerDocument.defaultView);
|
||||
]]></>
|
||||
)
|
||||
);
|
||||
|
||||
eval('window.handleLinkClick = '+
|
||||
window.handleLinkClick.toSource().replace(
|
||||
/openNewTabWith/g,
|
||||
<><![CDATA[
|
||||
TreeStyleTabService.readyToOpenChildTab(event.target.ownerDocument.defaultView);
|
||||
openNewTabWith]]></>
|
||||
)
|
||||
);
|
||||
|
||||
eval('window.gotoHistoryIndex = '+
|
||||
window.gotoHistoryIndex.toSource().replace(
|
||||
/openUILinkIn/g,
|
||||
<><![CDATA[
|
||||
if (where == 'tab' || where == 'tabshifted')
|
||||
TreeStyleTabService.readyToOpenChildTab();
|
||||
openUILinkIn]]></>
|
||||
)
|
||||
);
|
||||
|
||||
eval('window.BrowserForward = '+
|
||||
window.BrowserForward.toSource().replace(
|
||||
/openUILinkIn/g,
|
||||
<><![CDATA[
|
||||
if (where == 'tab' || where == 'tabshifted')
|
||||
TreeStyleTabService.readyToOpenChildTab();
|
||||
openUILinkIn]]></>
|
||||
)
|
||||
);
|
||||
|
||||
eval('window.BrowserBack = '+
|
||||
window.BrowserBack.toSource().replace(
|
||||
/openUILinkIn/g,
|
||||
<><![CDATA[
|
||||
if (where == 'tab' || where == 'tabshifted')
|
||||
TreeStyleTabService.readyToOpenChildTab();
|
||||
openUILinkIn]]></>
|
||||
)
|
||||
);
|
||||
|
||||
eval('window.nsBrowserAccess.prototype.openURI = '+
|
||||
window.nsBrowserAccess.prototype.openURI.toSource().replace(
|
||||
/switch\s*\(aWhere\)/,
|
||||
<><![CDATA[
|
||||
if (aOpener &&
|
||||
aWhere == Components.interfaces.nsIBrowserDOMWindow.OPEN_NEWTAB) {
|
||||
TreeStyleTabService.readyToOpenChildTab(aOpener);
|
||||
}
|
||||
switch(aWhere)
|
||||
]]></>
|
||||
)
|
||||
);
|
||||
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) {
|
||||
TreeStyleTabService.readyToOpenChildTab(openedTab, true);
|
||||
}
|
||||
]]></>
|
||||
).replace(
|
||||
'if (index == index0)',
|
||||
<><![CDATA[
|
||||
TreeStyleTabService.stopToOpenChildTab(browser);
|
||||
if (index == index0)]]></>
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
|
||||
if ('MultipleTabService' in window) {
|
||||
eval('MultipleTabService.showHideMenuItems = '+
|
||||
MultipleTabService.showHideMenuItems.toSource().replace(
|
||||
/var separators = /,
|
||||
<><![CDATA[
|
||||
(function(aPopup) {
|
||||
var b;
|
||||
var item;
|
||||
var tabs;
|
||||
if (aPopup.id == 'multipletab-selection-menu') {
|
||||
b = MultipleTabService.browser;
|
||||
item = document.getElementById(TreeStyleTabService.kMENUITEM_REMOVESUBTREE_SELECTION);
|
||||
tabs = MultipleTabService.getSelectedTabs();
|
||||
}
|
||||
else { // context
|
||||
b = TreeStyleTabService.getTabBrowserFromChildren(aPopup);
|
||||
item = TreeStyleTabService.evaluateXPath(
|
||||
'descendant::xul:menuitem[starts-with(@id, "'+TreeStyleTabService.kMENUITEM_REMOVESUBTREE_CONTEXT+'")]',
|
||||
aPopup,
|
||||
XPathResult.FIRST_ORDERED_NODE_TYPE
|
||||
).singleNodeValue;
|
||||
tabs = [b.mContextTab];
|
||||
}
|
||||
|
||||
if (item.getAttribute('hidden') == 'true') return;
|
||||
|
||||
var hasSubTree = false;
|
||||
for (var i = 0, maxi = tabs.length; i < maxi; i++)
|
||||
{
|
||||
if (!tabs[i].hasAttribute(TreeStyleTabService.kCHILDREN)) continue;
|
||||
hasSubTree = true;
|
||||
break;
|
||||
}
|
||||
if (hasSubTree)
|
||||
item.removeAttribute('hidden');
|
||||
else
|
||||
item.setAttribute('hidden', true);
|
||||
})(aPopup);
|
||||
var separators = ]]></>
|
||||
)
|
||||
);
|
||||
}
|
||||
this.overrideGlobalFunctions();
|
||||
this.overrideExtensions();
|
||||
|
||||
this.initTabBrowser(gBrowser);
|
||||
},
|
||||
@ -456,7 +322,7 @@ var TreeStyleTabService = {
|
||||
aTabBrowser.mTabContainer.addEventListener('dblclick', this, true);
|
||||
aTabBrowser.mTabContainer.addEventListener('mousedown', this, true);
|
||||
aTabBrowser.mTabContainer.addEventListener('select', this, true);
|
||||
aTabBrowser.mPanelContainer.addEventListener('click', this, true);
|
||||
// aTabBrowser.mPanelContainer.addEventListener('click', this, true);
|
||||
|
||||
aTabBrowser.__treestyletab__levelMargin = -1;
|
||||
|
||||
@ -619,7 +485,8 @@ catch(e) {
|
||||
'var tab = aEvent.target;',
|
||||
<><![CDATA[
|
||||
var tab = aEvent.target;
|
||||
if (dropActionInfo.position != TreeStyleTabService.kDROP_ON) {
|
||||
if (TreeStyleTabService.getPref('extensions.treestyletab.loadDroppedLinkToNewChildTab') ||
|
||||
dropActionInfo.position != TreeStyleTabService.kDROP_ON) {
|
||||
TreeStyleTabService.processDropAction(dropActionInfo, this, this.loadOneTab(getShortcutOrURI(url), null, null, null, bgLoad, false));
|
||||
return;
|
||||
}
|
||||
@ -822,7 +689,151 @@ catch(e) {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
overrideGlobalFunctions : function()
|
||||
{
|
||||
eval('nsContextMenu.prototype.openLinkInTab = '+
|
||||
nsContextMenu.prototype.openLinkInTab.toSource().replace(
|
||||
'{',
|
||||
<><![CDATA[
|
||||
{
|
||||
TreeStyleTabService.readyToOpenChildTab(this.target.ownerDocument.defaultView);
|
||||
]]></>
|
||||
)
|
||||
);
|
||||
eval('nsContextMenu.prototype.openFrameInTab = '+
|
||||
nsContextMenu.prototype.openFrameInTab.toSource().replace(
|
||||
'{',
|
||||
<><![CDATA[
|
||||
{
|
||||
TreeStyleTabService.readyToOpenChildTab(this.target.ownerDocument.defaultView);
|
||||
]]></>
|
||||
)
|
||||
);
|
||||
|
||||
eval('window.handleLinkClick = '+
|
||||
window.handleLinkClick.toSource().replace(
|
||||
/openNewTabWith/g,
|
||||
<><![CDATA[
|
||||
TreeStyleTabService.readyToOpenChildTab(event.target.ownerDocument.defaultView);
|
||||
openNewTabWith]]></>
|
||||
)
|
||||
);
|
||||
|
||||
eval('window.gotoHistoryIndex = '+
|
||||
window.gotoHistoryIndex.toSource().replace(
|
||||
/openUILinkIn/g,
|
||||
<><![CDATA[
|
||||
if (where == 'tab' || where == 'tabshifted')
|
||||
TreeStyleTabService.readyToOpenChildTab();
|
||||
openUILinkIn]]></>
|
||||
)
|
||||
);
|
||||
|
||||
eval('window.BrowserForward = '+
|
||||
window.BrowserForward.toSource().replace(
|
||||
/openUILinkIn/g,
|
||||
<><![CDATA[
|
||||
if (where == 'tab' || where == 'tabshifted')
|
||||
TreeStyleTabService.readyToOpenChildTab();
|
||||
openUILinkIn]]></>
|
||||
)
|
||||
);
|
||||
|
||||
eval('window.BrowserBack = '+
|
||||
window.BrowserBack.toSource().replace(
|
||||
/openUILinkIn/g,
|
||||
<><![CDATA[
|
||||
if (where == 'tab' || where == 'tabshifted')
|
||||
TreeStyleTabService.readyToOpenChildTab();
|
||||
openUILinkIn]]></>
|
||||
)
|
||||
);
|
||||
|
||||
eval('window.nsBrowserAccess.prototype.openURI = '+
|
||||
window.nsBrowserAccess.prototype.openURI.toSource().replace(
|
||||
/switch\s*\(aWhere\)/,
|
||||
<><![CDATA[
|
||||
if (aOpener &&
|
||||
aWhere == Components.interfaces.nsIBrowserDOMWindow.OPEN_NEWTAB) {
|
||||
TreeStyleTabService.readyToOpenChildTab(aOpener);
|
||||
}
|
||||
switch(aWhere)
|
||||
]]></>
|
||||
)
|
||||
);
|
||||
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) {
|
||||
TreeStyleTabService.readyToOpenChildTab(openedTab, true);
|
||||
}
|
||||
]]></>
|
||||
).replace(
|
||||
'if (index == index0)',
|
||||
<><![CDATA[
|
||||
TreeStyleTabService.stopToOpenChildTab(browser);
|
||||
if (index == index0)]]></>
|
||||
)
|
||||
);
|
||||
},
|
||||
|
||||
overrideExtensions : function()
|
||||
{
|
||||
if ('MultipleTabService' in window) {
|
||||
eval('MultipleTabService.showHideMenuItems = '+
|
||||
MultipleTabService.showHideMenuItems.toSource().replace(
|
||||
/var separators = /,
|
||||
<><![CDATA[
|
||||
(function(aPopup) {
|
||||
var b;
|
||||
var item;
|
||||
var tabs;
|
||||
if (aPopup.id == 'multipletab-selection-menu') {
|
||||
b = MultipleTabService.browser;
|
||||
item = document.getElementById(TreeStyleTabService.kMENUITEM_REMOVESUBTREE_SELECTION);
|
||||
tabs = MultipleTabService.getSelectedTabs();
|
||||
}
|
||||
else { // context
|
||||
b = TreeStyleTabService.getTabBrowserFromChildren(aPopup);
|
||||
item = TreeStyleTabService.evaluateXPath(
|
||||
'descendant::xul:menuitem[starts-with(@id, "'+TreeStyleTabService.kMENUITEM_REMOVESUBTREE_CONTEXT+'")]',
|
||||
aPopup,
|
||||
XPathResult.FIRST_ORDERED_NODE_TYPE
|
||||
).singleNodeValue;
|
||||
tabs = [b.mContextTab];
|
||||
}
|
||||
|
||||
if (item.getAttribute('hidden') == 'true') return;
|
||||
|
||||
var hasSubTree = false;
|
||||
for (var i = 0, maxi = tabs.length; i < maxi; i++)
|
||||
{
|
||||
if (!tabs[i].hasAttribute(TreeStyleTabService.kCHILDREN)) continue;
|
||||
hasSubTree = true;
|
||||
break;
|
||||
}
|
||||
if (hasSubTree)
|
||||
item.removeAttribute('hidden');
|
||||
else
|
||||
item.setAttribute('hidden', true);
|
||||
})(aPopup);
|
||||
var separators = ]]></>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ('autoHIDE' in window) {
|
||||
}
|
||||
},
|
||||
|
||||
destroy : function()
|
||||
{
|
||||
this.destroyTabBrowser(gBrowser);
|
||||
@ -843,7 +854,7 @@ catch(e) {
|
||||
this.destroyTab(tabs[i]);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
destroyTabBrowser : function(aTabBrowser)
|
||||
{
|
||||
aTabBrowser.__treestyletab__observer.destroy();
|
||||
@ -866,7 +877,7 @@ catch(e) {
|
||||
aTabBrowser.mTabContainer.removeEventListener('dblclick', this, true);
|
||||
aTabBrowser.mTabContainer.removeEventListener('mousedown', this, true);
|
||||
aTabBrowser.mTabContainer.removeEventListener('select', this, true);
|
||||
aTabBrowser.mPanelContainer.removeEventListener('click', this, true);
|
||||
// aTabBrowser.mPanelContainer.removeEventListener('click', this, true);
|
||||
},
|
||||
|
||||
destroyTab : function(aTab, aTabBrowser)
|
||||
@ -901,6 +912,7 @@ catch(e) {
|
||||
this.onTabClick(aEvent);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
var isMiddleClick = (
|
||||
aEvent.button == 1 ||
|
||||
aEvent.button == 0 && (aEvent.ctrlKey || aEvent.metaKey)
|
||||
@ -914,6 +926,7 @@ catch(e) {
|
||||
var b = this.getTabBrowserFromChildren(aEvent.currentTarget);
|
||||
this.readyToOpenChildTab(b.selectedTab);
|
||||
}
|
||||
*/
|
||||
return;
|
||||
|
||||
case 'dblclick':
|
||||
|
@ -1,16 +1,19 @@
|
||||
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.tabbar.style", "default");
|
||||
pref("extensions.treestyletab.levelMargin", 12);
|
||||
|
||||
pref("extensions.treestyletab.openGroupBookmarkAsTabSubTree", true);
|
||||
pref("extensions.treestyletab.loadDroppedLinkToNewChildTab", false);
|
||||
|
||||
pref("extensions.treestyletab.autoCollapseExpandSubTreeOnSelect", true);
|
||||
pref("extensions.treestyletab.collapseExpandSubTree.dblclick", false);
|
||||
pref("extensions.treestyletab.autoExpandSubTreeOnAppendChild", true);
|
||||
pref("extensions.treestyletab.attachChildrenToGrandParentOnRemoveTab", true);
|
||||
// 0 = default, 1 = only visible tabs
|
||||
pref("extensions.treestyletab.focusMode", 1);
|
||||
pref("extensions.treestyletab.levelMargin", 12);
|
||||
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("extensions.treestyletab.tabbar.style", "default");
|
||||
|
||||
|
||||
pref("browser.link.open_newwindow.restriction", 0);
|
||||
|
@ -30,6 +30,10 @@
|
||||
<!ENTITY config.openGroupBookmarkAsTabSubTree.flat "Open as separate tabs">
|
||||
<!ENTITY config.openGroupBookmarkAsTabSubTree.replace "Replace all tabs to the pages in the folder (Firefox default)">
|
||||
|
||||
<!ENTITY config.loadDroppedLinkToNewChildTab.caption "Action for drag drop of links or URLs to existing tab">
|
||||
<!ENTITY config.loadDroppedLinkToNewChildTab.load "Load link into the tab (Firefox default)">
|
||||
<!ENTITY config.loadDroppedLinkToNewChildTab.newTab "Open link in a new child tab of the tab">
|
||||
|
||||
|
||||
<!ENTITY config.tabs.advanced "Advanced">
|
||||
|
||||
|
@ -30,6 +30,10 @@
|
||||
<!ENTITY config.openGroupBookmarkAsTabSubTree.flat "ばらばらのタブとして開く">
|
||||
<!ENTITY config.openGroupBookmarkAsTabSubTree.replace "現在開いているすべてのタブをブックマークの内容で置き換える(Firefox初期状態)">
|
||||
|
||||
<!ENTITY config.loadDroppedLinkToNewChildTab.caption "リンクやURLをタブにドラッグ&ドロップした時">
|
||||
<!ENTITY config.loadDroppedLinkToNewChildTab.load "ドロップ先のタブの中に読み込む(Firefox初期状態)">
|
||||
<!ENTITY config.loadDroppedLinkToNewChildTab.newTab "ドロップ先のタブのサブツリーに新しいタブを開く">
|
||||
|
||||
|
||||
<!ENTITY config.tabs.advanced "詳細">
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user