From 9197a8b4ded382c33fa720e76d0bfdbad0290ac6 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 29 Jan 2007 23:16:43 +0000 Subject: [PATCH] Fixes #515, Zotero pane min-height remains in effect when pane is closed Also: - Changed default Zotero pane min-height to 32px, which lets you shrink it to just the controls -- it would be better if we had a notification popup for the various non-translator save functions, since this way there's no feedback when you click the buttons, but at least it's possible. A dedicated mode with a keyboard shortcut would probably be better. - Fixed bug (I think) whereby resizing the Z pane downward after resizing the tag selector up and then down sometimes caused the Z pane to stay at a fixed size and get pushed below the bottom --- chrome/content/zotero/advancedSearch.js | 2 +- chrome/content/zotero/overlay.js | 40 +++++++++++++++++-------- chrome/content/zotero/overlay.xul | 6 ++-- chrome/skin/default/zotero/overlay.css | 2 +- 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/chrome/content/zotero/advancedSearch.js b/chrome/content/zotero/advancedSearch.js index 3172a2183..1d2c3d2f1 100644 --- a/chrome/content/zotero/advancedSearch.js +++ b/chrome/content/zotero/advancedSearch.js @@ -106,7 +106,7 @@ var ZoteroAdvancedSearch = new function() { return; } - if (lastWin.document.getElementById('zotero-pane').getAttribute('collapsed') == 'true') { + if (lastWin.document.getElementById('zotero-pane').getAttribute('hidden') == 'true') { lastWin.ZoteroPane.toggleDisplay(); } diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index ca693e66a..adadd5a62 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -89,7 +89,7 @@ var ZoteroPane = new function() var newPane = document.createElement('hbox'); newPane.setAttribute('id','zotero-pane'); newPane.setAttribute('persist','height'); - newPane.setAttribute('collapsed',true); + newPane.setAttribute('hidden', true); newPane.height = oldPane.height; while(oldPane.hasChildNodes()) newPane.appendChild(oldPane.firstChild); @@ -98,7 +98,7 @@ var ZoteroPane = new function() var newSplitter = document.createElement('splitter'); newSplitter.setAttribute('id','zotero-splitter'); - newSplitter.setAttribute('collapsed',true); + newSplitter.setAttribute('hidden', true); newSplitter.setAttribute('resizebefore','closest'); newSplitter.setAttribute('resizeafter','closest'); newSplitter.setAttribute('onmouseup', 'ZoteroPane.updateTagSelectorSize()'); @@ -168,10 +168,10 @@ var ZoteroPane = new function() function toggleDisplay() { // Visible == target visibility - var visible = document.getElementById('zotero-pane').getAttribute('collapsed') == 'true'; + var visible = document.getElementById('zotero-pane').getAttribute('hidden') == 'true'; - document.getElementById('zotero-pane').setAttribute('collapsed',!visible); - document.getElementById('zotero-splitter').setAttribute('collapsed',!visible); + document.getElementById('zotero-pane').setAttribute('hidden', !visible); + document.getElementById('zotero-splitter').setAttribute('hidden', !visible); if (visible) { document.getElementById('zotero-pane').focus(); @@ -191,14 +191,14 @@ var ZoteroPane = new function() // Turn Z-pane flex on to stretch to window in full-screen, but off otherwise so persist works document.getElementById('zotero-pane').setAttribute('flex', collapsed ? "0" : "1"); document.getElementById('content').setAttribute('collapsed', !collapsed); - document.getElementById('zotero-splitter').setAttribute('collapsed', !collapsed); + document.getElementById('zotero-splitter').setAttribute('hidden', !collapsed); document.getElementById('zotero-tb-fullscreen').setAttribute('fullscreenmode', !collapsed); } function handleKeyPress(event) { // Ignore keystrokes if Zotero pane is closed - if (document.getElementById('zotero-pane').getAttribute('collapsed') == 'true') { + if (document.getElementById('zotero-pane').getAttribute('hidden') == 'true') { return; } @@ -367,14 +367,28 @@ var ZoteroPane = new function() zoteroPane.setAttribute('height', zoteroPane.boxObject.height); } - if (tagSelector.getAttribute('collapsed') != 'true' && !height) { - height = parseInt(tagSelector.getAttribute('height')); + if (tagSelector.getAttribute('collapsed') == 'true') { + // 32px is the default Z pane min-height in overlay.css + height = 32; + } + else { + // tS.boxObject.height doesn't exist at startup, so get from attribute + if (!height) { + height = parseInt(tagSelector.getAttribute('height')); + } + // 121px seems to be enough room for the toolbar and collections + // tree at minimum height + height = height + 121; } - // 170px is the Z-pane min-height sans tag selector; 120px seems to be - // enough room for the toolbar and collections tree at minimum height - //Zotero.debug('Setting tag selector minheight to ' + (Math.max(170, 120 + height))); - zoteroPane.setAttribute('minheight', Math.max(170, 120 + height)); + Zotero.debug('Setting Zotero pane minheight to ' + height); + zoteroPane.setAttribute('minheight', height); + + // Fix bug whereby resizing the Z pane downward after resizing + // the tag selector up and then down sometimes caused the Z pane to + // stay at a fixed size and get pushed below the bottom + tagSelector.height++; + tagSelector.height--; } diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul index 040cecd61..548613c18 100644 --- a/chrome/content/zotero/overlay.xul +++ b/chrome/content/zotero/overlay.xul @@ -64,9 +64,9 @@ - - diff --git a/chrome/skin/default/zotero/overlay.css b/chrome/skin/default/zotero/overlay.css index cebebb677..f68d8747e 100644 --- a/chrome/skin/default/zotero/overlay.css +++ b/chrome/skin/default/zotero/overlay.css @@ -20,7 +20,7 @@ #zotero-pane { background: #f5f5f5; - min-height: 170px; + min-height: 32px; /* must match value in ZoteroPane.updateTagSelectorSize() */ height: 300px; padding: 4px; overflow: hidden;