タブバーを自動で隠す処理のためのコードを入れた
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1522 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
d1159d0949
commit
f545bd8e7d
@ -16,7 +16,7 @@ TreeStyleTabService.overrideExtensions = function() {
|
|||||||
eval('autoHIDE.ShowMenu = '+
|
eval('autoHIDE.ShowMenu = '+
|
||||||
autoHIDE.ShowMenu.toSource().replace(
|
autoHIDE.ShowMenu.toSource().replace(
|
||||||
'{',
|
'{',
|
||||||
'{ var treeStyleTabPos = TreeStyleTabService.getPref("extensions.treestyletab.tabbar.position");'
|
'{ var treeStyleTabPos = TreeStyleTabService.getTreePref("tabbar.position");'
|
||||||
).replace(
|
).replace(
|
||||||
'e.screenY <= autoHIDE.Win.boxObject.screenY + autoHIDE.space',
|
'e.screenY <= autoHIDE.Win.boxObject.screenY + autoHIDE.space',
|
||||||
<><![CDATA[(e.screenY <= autoHIDE.Win.boxObject.screenY + autoHIDE.space ||
|
<><![CDATA[(e.screenY <= autoHIDE.Win.boxObject.screenY + autoHIDE.space ||
|
||||||
@ -48,7 +48,7 @@ TreeStyleTabService.overrideExtensions = function() {
|
|||||||
'if (this.Show) {',
|
'if (this.Show) {',
|
||||||
<><![CDATA[
|
<><![CDATA[
|
||||||
window.setTimeout('TreeStyleTabService.checkTabsIndentOverflow(gBrowser);', 0);
|
window.setTimeout('TreeStyleTabService.checkTabsIndentOverflow(gBrowser);', 0);
|
||||||
var treeStyleTabPos = TreeStyleTabService.getPref("extensions.treestyletab.tabbar.position");
|
var treeStyleTabPos = TreeStyleTabService.getTreePref("tabbar.position");
|
||||||
if (this.Show) {
|
if (this.Show) {
|
||||||
var appcontent = document.getElementById('appcontent');
|
var appcontent = document.getElementById('appcontent');
|
||||||
if (appcontent.__treestyletab__resized) {
|
if (appcontent.__treestyletab__resized) {
|
||||||
@ -92,7 +92,7 @@ TreeStyleTabService.overrideExtensions = function() {
|
|||||||
'{',
|
'{',
|
||||||
<><![CDATA[
|
<><![CDATA[
|
||||||
{
|
{
|
||||||
var treeStyleTabPos = TreeStyleTabService.getPref("extensions.treestyletab.tabbar.position");
|
var treeStyleTabPos = TreeStyleTabService.getTreePref("tabbar.position");
|
||||||
if (!arguments.length) {
|
if (!arguments.length) {
|
||||||
var appcontent = document.getElementById('appcontent');
|
var appcontent = document.getElementById('appcontent');
|
||||||
if (treeStyleTabPos == 'left' &&
|
if (treeStyleTabPos == 'left' &&
|
||||||
|
@ -17,6 +17,8 @@ tabbrowser[treestyletab-allow-subtree-collapse="true"] .tabbrowser-tab[treestyle
|
|||||||
|
|
||||||
tabbrowser[treestyletab-allow-subtree-collapse="true"] .tabbrowser-tab[treestyletab-collapsed="true"],
|
tabbrowser[treestyletab-allow-subtree-collapse="true"] .tabbrowser-tab[treestyletab-collapsed="true"],
|
||||||
.tabbrowser-strip[collapsed="true"]+splitter,
|
.tabbrowser-strip[collapsed="true"]+splitter,
|
||||||
|
tabbrowser[treestyletab-tabbar-autohide="true"] .tabbrowser-strip,
|
||||||
|
tabbrowser[treestyletab-tabbar-autohide="true"] .tabbrowser-strip+splitter,
|
||||||
#appcontent[ahFull="true"] .tabbrowser-strip[ahHIDE="true"]+splitter /* AutoHide */ {
|
#appcontent[ahFull="true"] .tabbrowser-strip[ahHIDE="true"]+splitter /* AutoHide */ {
|
||||||
visibility: collapse;
|
visibility: collapse;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ var TreeStyleTabService = {
|
|||||||
kALLOW_COLLAPSE : 'treestyletab-allow-subtree-collapse',
|
kALLOW_COLLAPSE : 'treestyletab-allow-subtree-collapse',
|
||||||
kSTYLE : 'treestyletab-style',
|
kSTYLE : 'treestyletab-style',
|
||||||
kFIRSTTAB_BORDER : 'treestyletab-firsttab-border',
|
kFIRSTTAB_BORDER : 'treestyletab-firsttab-border',
|
||||||
|
kAUTOHIDE : 'treestyletab-tabbar-autohide',
|
||||||
|
|
||||||
kTWISTY : 'treestyletab-twisty',
|
kTWISTY : 'treestyletab-twisty',
|
||||||
kTWISTY_CONTAINER : 'treestyletab-twisty-container',
|
kTWISTY_CONTAINER : 'treestyletab-twisty-container',
|
||||||
@ -97,7 +98,7 @@ var TreeStyleTabService = {
|
|||||||
_IOService : null,
|
_IOService : null,
|
||||||
|
|
||||||
/* API */
|
/* API */
|
||||||
|
|
||||||
readyToOpenChildTab : function(aFrameOrTabBrowser, aMultiple, aInsertBefore)
|
readyToOpenChildTab : function(aFrameOrTabBrowser, aMultiple, aInsertBefore)
|
||||||
{
|
{
|
||||||
var frame = this.getFrameFromTabBrowserElements(aFrameOrTabBrowser);
|
var frame = this.getFrameFromTabBrowserElements(aFrameOrTabBrowser);
|
||||||
@ -231,7 +232,7 @@ var TreeStyleTabService = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/* Utilities */
|
/* Utilities */
|
||||||
|
|
||||||
isEventFiredOnTwisty : function(aEvent)
|
isEventFiredOnTwisty : function(aEvent)
|
||||||
{
|
{
|
||||||
var tab = this.getTabFromEvent(aEvent);
|
var tab = this.getTabFromEvent(aEvent);
|
||||||
@ -403,7 +404,7 @@ var TreeStyleTabService = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/* Initializing */
|
/* Initializing */
|
||||||
|
|
||||||
init : function()
|
init : function()
|
||||||
{
|
{
|
||||||
if (!('gBrowser' in window)) return;
|
if (!('gBrowser' in window)) return;
|
||||||
@ -748,6 +749,7 @@ catch(e) {
|
|||||||
aTabBrowser.__treestyletab__observer.observe(null, 'nsPref:changed', 'extensions.treestyletab.showBorderForFirstTab');
|
aTabBrowser.__treestyletab__observer.observe(null, 'nsPref:changed', 'extensions.treestyletab.showBorderForFirstTab');
|
||||||
aTabBrowser.__treestyletab__observer.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.invertScrollbar');
|
aTabBrowser.__treestyletab__observer.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.invertScrollbar');
|
||||||
aTabBrowser.__treestyletab__observer.observe(null, 'nsPref:changed', 'extensions.treestyletab.allowSubtreeCollapseExpand');
|
aTabBrowser.__treestyletab__observer.observe(null, 'nsPref:changed', 'extensions.treestyletab.allowSubtreeCollapseExpand');
|
||||||
|
aTabBrowser.__treestyletab__observer.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.autoHide');
|
||||||
|
|
||||||
delete i;
|
delete i;
|
||||||
delete maxi;
|
delete maxi;
|
||||||
@ -1215,6 +1217,10 @@ catch(e) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case 'mousemove':
|
||||||
|
this.showHideTabbar(aEvent);
|
||||||
|
return;
|
||||||
|
|
||||||
case 'SubBrowserAdded':
|
case 'SubBrowserAdded':
|
||||||
this.initTabBrowser(aEvent.originalTarget.browser);
|
this.initTabBrowser(aEvent.originalTarget.browser);
|
||||||
return;
|
return;
|
||||||
@ -1498,6 +1504,9 @@ catch(e) {
|
|||||||
this.getTreePref('autoCollapseExpandSubTreeOnSelect')) {
|
this.getTreePref('autoCollapseExpandSubTreeOnSelect')) {
|
||||||
this.collapseExpandTreesIntelligentlyFor(tab);
|
this.collapseExpandTreesIntelligentlyFor(tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.getTreePref('tabbar.autoHide') && this.tabbarShown)
|
||||||
|
this.redrawContentArea();
|
||||||
},
|
},
|
||||||
|
|
||||||
onTabbarResized : function(aEvent)
|
onTabbarResized : function(aEvent)
|
||||||
@ -1573,7 +1582,7 @@ catch(e) {
|
|||||||
else
|
else
|
||||||
aMenuItem.setAttribute('hidden', true);
|
aMenuItem.setAttribute('hidden', true);
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Tab Utilities */
|
/* Tab Utilities */
|
||||||
|
|
||||||
getTabValue : function(aTab, aKey)
|
getTabValue : function(aTab, aKey)
|
||||||
@ -1937,7 +1946,7 @@ catch(e) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/* Commands */
|
/* Commands */
|
||||||
|
|
||||||
initTabbar : function(aTabBrowser, aPosition)
|
initTabbar : function(aTabBrowser, aPosition)
|
||||||
{
|
{
|
||||||
if (!aPosition) aPosition = this.getTreePref('tabbar.position');
|
if (!aPosition) aPosition = this.getTreePref('tabbar.position');
|
||||||
@ -2599,7 +2608,7 @@ catch(e) {
|
|||||||
});
|
});
|
||||||
this.stopToOpenChildTab(targetWindow);
|
this.stopToOpenChildTab(targetWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
getSelectionLinks : function()
|
getSelectionLinks : function()
|
||||||
{
|
{
|
||||||
var links = [];
|
var links = [];
|
||||||
@ -2690,7 +2699,156 @@ catch(e) {
|
|||||||
|
|
||||||
return node.href ? node : null ;
|
return node.href ? node : null ;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/* auto hide */
|
||||||
|
tabbarShown : true,
|
||||||
|
tabbarWidth : 0,
|
||||||
|
tabbarHeight : 0,
|
||||||
|
|
||||||
|
startAutoHide : function(aTabBrowser)
|
||||||
|
{
|
||||||
|
var appcontent = document.getElementById('appcontent');
|
||||||
|
appcontent.addEventListener('mousemove', this, true);
|
||||||
|
},
|
||||||
|
|
||||||
|
endAutoHide : function(aTabBrowser)
|
||||||
|
{
|
||||||
|
var appcontent = document.getElementById('appcontent');
|
||||||
|
appcontent.removeEventListener('mousemove', this, true);
|
||||||
|
|
||||||
|
if (appcontent.__treestyletab__resized) {
|
||||||
|
appcontent.__treestyletab__resized = false;
|
||||||
|
appcontent.style.marginRight = 0;
|
||||||
|
appcontent.style.marginLeft = 0;
|
||||||
|
}
|
||||||
|
this.browser.removeAttribute(this.kAUTOHIDE);
|
||||||
|
},
|
||||||
|
|
||||||
|
showHideTabbar : function(aEvent)
|
||||||
|
{
|
||||||
|
if ('gestureInProgress' in window && window.gestureInProgress) return;
|
||||||
|
|
||||||
|
this.cancelShowHideTabbar();
|
||||||
|
|
||||||
|
var pos = this.getTreePref('tabbar.position');
|
||||||
|
var b = this.browser;
|
||||||
|
if (!this.tabbarShown &&
|
||||||
|
(
|
||||||
|
pos == 'left' ?
|
||||||
|
(aEvent.screenX <= b.boxObject.screenX + this.tabbarWidth) :
|
||||||
|
pos == 'right' ?
|
||||||
|
(aEvent.screenX >= b.boxObject.screenX + b.boxObject.width - this.tabbarWidth) :
|
||||||
|
pos == 'bottom' ?
|
||||||
|
(aEvent.screenY >= b.boxObject.screenY + b.boxObject.height - this.tabbarHeight) :
|
||||||
|
(aEvent.screenY <= b.boxObject.screenY + this.tabbarHeight)
|
||||||
|
))
|
||||||
|
this.showHideTabbarTimer = window.setTimeout(
|
||||||
|
'TreeStyleTabService.delayedShowHideTabbar();',
|
||||||
|
this.getTreePref('tabbar.autoHide.delay')
|
||||||
|
);
|
||||||
|
|
||||||
|
if (this.tabbarShown &&
|
||||||
|
(
|
||||||
|
pos == 'left' ?
|
||||||
|
(aEvent.screenX > b.mCurrentBrowser.boxObject.screenX + 25) :
|
||||||
|
pos == 'right' ?
|
||||||
|
(aEvent.screenX < b.mCurrentBrowser.boxObject.screenX + b.mCurrentBrowser.boxObject.width - 25) :
|
||||||
|
pos == 'bottom' ?
|
||||||
|
(aEvent.screenY < b.mCurrentBrowser.boxObject.screenY + b.mCurrentBrowser.boxObject.height - 25) :
|
||||||
|
(aEvent.screenY > b.mCurrentBrowser.boxObject.screenY + 25)
|
||||||
|
))
|
||||||
|
this.showHideTabbarTimer = window.setTimeout(
|
||||||
|
'TreeStyleTabService.delayedShowHideTabbar();',
|
||||||
|
10
|
||||||
|
);
|
||||||
|
},
|
||||||
|
showHideTabbarTimer : null,
|
||||||
|
|
||||||
|
delayedShowHideTabbar : function()
|
||||||
|
{
|
||||||
|
window.setTimeout('TreeStyleTabService.checkTabsIndentOverflow(TreeStyleTabService.browser);', 0);
|
||||||
|
var b = this.browser;
|
||||||
|
if (this.tabbarShown) {
|
||||||
|
var splitter = document.getAnonymousElementByAttribute(b, 'class', this.kSPLITTER);
|
||||||
|
this.tabbarHeight = b.mStrip.boxObject.height;
|
||||||
|
this.tabbarWidth = b.mStrip.boxObject.width +
|
||||||
|
(splitter ? splitter.boxObject.width : 0 );
|
||||||
|
var appcontent = document.getElementById('appcontent');
|
||||||
|
if (appcontent.__treestyletab__resized) {
|
||||||
|
appcontent.__treestyletab__resized = false;
|
||||||
|
appcontent.style.margin = 0;
|
||||||
|
}
|
||||||
|
this.tabbarShown = false;
|
||||||
|
b.setAttribute(this.kAUTOHIDE, true);
|
||||||
|
this.forceRedraw();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.tabbarShown = true;
|
||||||
|
b.removeAttribute(this.kAUTOHIDE);
|
||||||
|
this.redrawContentArea();
|
||||||
|
this.forceRedraw();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
cancelShowHideTabbar : function()
|
||||||
|
{
|
||||||
|
if (this.showHideTabbarTimer) {
|
||||||
|
window.clearTimeout(this.showHideTabbarTimer);
|
||||||
|
this.showHideTabbarTimer = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
redrawContentArea : function(aDelayed)
|
||||||
|
{
|
||||||
|
var pos = this.getTreePref('tabbar.position');
|
||||||
|
if (!aDelayed) {
|
||||||
|
var appcontent = document.getElementById('appcontent');
|
||||||
|
if (!appcontent.__treestyletab__resized) {
|
||||||
|
switch (pos)
|
||||||
|
{
|
||||||
|
case 'left':
|
||||||
|
appcontent.style.marginRight = '-'+this.tabbarWidth+'px';
|
||||||
|
break;
|
||||||
|
case 'right':
|
||||||
|
appcontent.style.marginLeft = '-'+this.tabbarWidth+'px';
|
||||||
|
break;
|
||||||
|
case 'bottom':
|
||||||
|
appcontent.style.marginTop = '-'+this.tabbarHeight+'px';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
appcontent.style.marginBottom = '-'+this.tabbarHeight+'px';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
appcontent.__treestyletab__resized = true;
|
||||||
|
}
|
||||||
|
window.setTimeout('TreeStyleTabService.redrawContentArea(true);', 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
this.browser.markupDocumentViewer.move(
|
||||||
|
(
|
||||||
|
pos == 'left' ? -this.tabbarWidth :
|
||||||
|
pos == 'right' ? this.tabbarWidth :
|
||||||
|
0
|
||||||
|
),
|
||||||
|
(
|
||||||
|
pos == 'top' ? -this.tabbarHeight :
|
||||||
|
pos == 'bottom' ? this.tabbarHeight :
|
||||||
|
0
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
}
|
||||||
|
this.forceRedraw();
|
||||||
|
},
|
||||||
|
|
||||||
|
forceRedraw : function()
|
||||||
|
{
|
||||||
|
// this.browser.markupDocumentViewer.enableRendering = false;
|
||||||
|
// window.setTimeout('TreeStyleService.browser.markupDocumentViewer.enableRendering = true;', 100);
|
||||||
|
},
|
||||||
|
|
||||||
/* Pref Listener */
|
/* Pref Listener */
|
||||||
|
|
||||||
domain : 'extensions.treestyletab',
|
domain : 'extensions.treestyletab',
|
||||||
@ -2892,6 +3050,13 @@ TreeStyleTabBrowserObserver.prototype = {
|
|||||||
this.mTabBrowser.removeAttribute(TreeStyleTabService.kALLOW_COLLAPSE);
|
this.mTabBrowser.removeAttribute(TreeStyleTabService.kALLOW_COLLAPSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'extensions.treestyletab.tabbar.autoHide':
|
||||||
|
if (value)
|
||||||
|
TreeStyleTabService.startAutoHide(this.mTabBrowser);
|
||||||
|
else
|
||||||
|
TreeStyleTabService.endAutoHide(this.mTabBrowser);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ pref("extensions.treestyletab.tabbar.invertUI", true);
|
|||||||
pref("extensions.treestyletab.tabbar.scroll.smooth", true);
|
pref("extensions.treestyletab.tabbar.scroll.smooth", true);
|
||||||
pref("extensions.treestyletab.tabbar.scroll.timeout", 250);
|
pref("extensions.treestyletab.tabbar.scroll.timeout", 250);
|
||||||
pref("extensions.treestyletab.tabbar.style", "mixed");
|
pref("extensions.treestyletab.tabbar.style", "mixed");
|
||||||
|
pref("extensions.treestyletab.tabbar.autoHide", false);
|
||||||
|
pref("extensions.treestyletab.tabbar.autoHide.delay", 50);
|
||||||
pref("extensions.treestyletab.enableSubtreeIndent", true);
|
pref("extensions.treestyletab.enableSubtreeIndent", true);
|
||||||
pref("extensions.treestyletab.allowSubtreeCollapseExpand", true);
|
pref("extensions.treestyletab.allowSubtreeCollapseExpand", true);
|
||||||
pref("extensions.treestyletab.showBorderForFirstTab", false);
|
pref("extensions.treestyletab.showBorderForFirstTab", false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user