www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 7f8fe0ce7845680faa3989355c15494f55d9d0c2
parent f5b2f77a3a51e8931a946b920e831e2c9515f010
Author: Simon Kornblith <simon@simonster.com>
Date:   Thu,  9 Apr 2009 05:54:05 +0000

restore toolbars properly when Zotero pane is closed


Diffstat:
Mchrome/content/zotero/overlay.js | 44+++++++++++++++++++++++++++++---------------
1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js @@ -90,7 +90,7 @@ var ZoteroPane = new function() const COLLECTIONS_HEIGHT = 125; // minimum height of the collections pane and toolbar var self = this; - var titlebarcolorState, collapseState, titleState; + var titlebarcolorState, toolbarCollapseState, titleState; /* * Called when the window is open @@ -360,6 +360,9 @@ var ZoteroPane = new function() document.getElementById('content').setAttribute('collapsed', false); + // turn off full window mode, if it was on + _setFullWindowMode(false) + // Return focus to the browser content pane window.content.window.focus(); } @@ -390,12 +393,18 @@ var ZoteroPane = new function() document.getElementById('zotero-splitter').setAttribute('hidden', makeFullScreen); fs.setAttribute('fullscreenmode', makeFullScreen); + _setFullWindowMode(makeFullScreen); + } + + /** + * Hides or shows navigation toolbars + * @param set {Boolean} Whether navigation toolbars should be hidden or shown + */ + function _setFullWindowMode(set) { // hide or show navigation toolbars var toolbox = getNavToolbox(); - if(makeFullScreen) { - titleState = document.title; - document.title = "Zotero"; - + Zotero.debug(toolbarCollapseState); + if(set) { // the below would be a good thing to do if the whole title bar (and not just the center // part) got updated when it happened... /*if(Zotero.isMac) { @@ -403,28 +412,33 @@ var ZoteroPane = new function() document.documentElement.removeAttribute("activetitlebarcolor"); }*/ if(Zotero.isMac) document.getElementById("zotero-pane").style.borderTop = "1px solid black"; - - collapseState = [node.collapsed for each (node in toolbox.childNodes)]; - for(var i=0; i<toolbox.childNodes.length; i++) { - toolbox.childNodes[i].collapsed = true; + if(document.title != "Zotero") { + titleState = document.title; + document.title = "Zotero"; } - window.focus(); + if(!toolbarCollapseState) { + toolbarCollapseState = [node.collapsed for each (node in toolbox.childNodes)]; + for(var i=0; i<toolbox.childNodes.length; i++) { + toolbox.childNodes[i].collapsed = true; + } + } } else { - document.title = titleState; - /*if(Zotero.isMac) { document.documentElement.setAttribute("activetitlebarcolor", titlebarcolorState); }*/ if(Zotero.isMac) document.getElementById("zotero-pane").style.borderTop = ""; + if(document.title == "Zotero") document.title = titleState; - for(var i=0; i<toolbox.childNodes.length; i++) { - toolbox.childNodes[i].collapsed = collapseState[i]; + if(toolbarCollapseState) { + for(var i=0; i<toolbox.childNodes.length; i++) { + toolbox.childNodes[i].collapsed = toolbarCollapseState[i]; + } + toolbarCollapseState = undefined; } } } - function isFullScreen() { var fs = document.getElementById('zotero-tb-fullscreen'); return fs.getAttribute('fullscreenmode') == 'true'