mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-09 04:25:38 +00:00
+ Fixed: Quit Firefox with TabCandy open then open Firefox again. Your tabs and and navbar get hidden.
+ Fixed: If you quit tab candy (but not the browser), all of the tabs need to be reshown. + Starting firefox with tab candy selected now hides the tab bar + Utils.activeTab now returns a Tabs tab, rather than a raw tab
This commit is contained in:
parent
ca5e82c95a
commit
89d57285f3
@ -60,8 +60,14 @@ var Tabbar = {
|
||||
// so we still have access to that information during the window's unload event,
|
||||
// when window.Tabs no longer exists.
|
||||
_hidden: false,
|
||||
|
||||
// ----------
|
||||
get el(){ return window.Tabs[0].raw.parentNode; },
|
||||
|
||||
// ----------
|
||||
height: window.Tabs[0].raw.parentNode.getBoundingClientRect().height,
|
||||
|
||||
// ----------
|
||||
hide: function(animate) {
|
||||
var self = this;
|
||||
this._hidden = true;
|
||||
@ -73,14 +79,18 @@ var Tabbar = {
|
||||
self.el.collapsed = true;
|
||||
});
|
||||
},
|
||||
|
||||
// ----------
|
||||
show: function(animate) {
|
||||
this._hidden = false;
|
||||
|
||||
if( animate == false ) speed = 0;
|
||||
else speed = 150;
|
||||
|
||||
this.el.collapsed = false;
|
||||
$(this.el).animate({"marginTop":0}, speed);
|
||||
|
||||
if(animate == false) {
|
||||
$(this.el).css({"marginTop":0});
|
||||
} else {
|
||||
var speed = 150;
|
||||
$(this.el).animate({"marginTop":0}, speed);
|
||||
}
|
||||
},
|
||||
|
||||
// ----------
|
||||
@ -135,8 +145,19 @@ var Tabbar = {
|
||||
tab.collapsed = false;
|
||||
Utils.activeWindow.gBrowser.moveTabTo(tab, UI.tabBar.el.children.length-1);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: showAllTabs
|
||||
// Shows all of the tabs in the tab bar.
|
||||
showAllTabs: function(){
|
||||
for( var i=0; i<UI.tabBar.el.children.length; i++ ){
|
||||
var tab = UI.tabBar.el.children[i];
|
||||
tab.collapsed = false;
|
||||
}
|
||||
},
|
||||
|
||||
// ----------
|
||||
get isHidden(){ return this._hidden; }
|
||||
}
|
||||
|
||||
@ -403,7 +424,7 @@ function UIClass(){
|
||||
this.navBar = Navbar;
|
||||
this.tabBar = Tabbar;
|
||||
this.devMode = false;
|
||||
this.focused = true;
|
||||
this.focused = (Utils.activeTab == Utils.homeTab);
|
||||
|
||||
var self = this;
|
||||
|
||||
@ -423,7 +444,10 @@ function UIClass(){
|
||||
}
|
||||
|
||||
// ___ Navbar
|
||||
this.navBar.hide();
|
||||
if(this.focused) {
|
||||
this.tabBar.hide();
|
||||
this.navBar.hide();
|
||||
}
|
||||
|
||||
Tabs.onFocus(function() {
|
||||
try{
|
||||
@ -464,6 +488,9 @@ function UIClass(){
|
||||
$(window).bind('beforeunload', function() {
|
||||
if(self.initialized)
|
||||
self.save();
|
||||
|
||||
self.tabBar.show();
|
||||
self.tabBar.showAllTabs();
|
||||
});
|
||||
|
||||
// ___ resizing
|
||||
|
@ -319,6 +319,8 @@ function EventListenerMixIn(options) {
|
||||
});
|
||||
}
|
||||
|
||||
// Class: Tabs
|
||||
// Singelton for dealing with the actual tabs in the browser.
|
||||
function Tabs() {
|
||||
var trackedWindows = new Dictionary();
|
||||
var trackedTabs = new Dictionary();
|
||||
|
@ -310,20 +310,45 @@ window.Subscribable.prototype = {
|
||||
// Singelton with common utility functions.
|
||||
var Utils = {
|
||||
// ___ Windows and Tabs
|
||||
|
||||
// ----------
|
||||
// Variable: activeWindow
|
||||
get activeWindow(){
|
||||
var win = Cc["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Ci.nsIWindowWatcher)
|
||||
.activeWindow;
|
||||
|
||||
if( win != null ) return win;
|
||||
else return homeWindow;
|
||||
if( win != null )
|
||||
return win;
|
||||
|
||||
if(homeWindow != null)
|
||||
return homeWindow;
|
||||
|
||||
win = Cc["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator)
|
||||
.getMostRecentWindow("navigator:browser");
|
||||
|
||||
return win;
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Variable: activeTab
|
||||
// The <Tabs> tab that represents the active tab in the active window.
|
||||
get activeTab(){
|
||||
var tabBrowser = this.activeWindow.gBrowser;
|
||||
return tabBrowser.selectedTab;
|
||||
var rawTab = tabBrowser.selectedTab;
|
||||
for( var i=0; i<Tabs.length; i++){
|
||||
if(Tabs[i].raw == rawTab)
|
||||
return Tabs[i];
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Variable: homeTab
|
||||
// The <Tabs> tab that represents the tab candy tab.
|
||||
// TODO: what if there are multiple tab candy tabs?
|
||||
get homeTab(){
|
||||
for( var i=0; i<Tabs.length; i++){
|
||||
if(Tabs[i].contentWindow.location.host == "tabcandy"){
|
||||
|
Loading…
x
Reference in New Issue
Block a user