Fixes #114, Preference for Scholar location (top, bottom).

(I had to go a little roundabout way of doing it, as you can't use the overlay-related positioning attributes on-the-fly)
This commit is contained in:
David Norton 2006-07-19 16:14:27 +00:00
parent 785954f4f5
commit 8427ebdf2a
7 changed files with 55 additions and 28 deletions

View file

@ -35,18 +35,29 @@ var ScholarPane = new function()
collectionsView = new Scholar.CollectionTreeView();
document.getElementById('collections-tree').view = collectionsView;
/*
if(window.opener)
if(Scholar.Prefs.get("scholarPaneOnTop"))
{
var pane = window.opener.document.getElementById('scholar-pane');
if(pane)
{
var b = pane.getAttribute('collapsed');
if(b != document.getElementById('scholar-pane').getAttribute('collapsed'))
toggleDisplay();
}
var oldPane = document.getElementById('scholar-pane');
var oldSplitter = document.getElementById('scholar-splitter');
var appContent = document.getElementById('appcontent');
var newPane = document.createElement('hbox');
newPane.setAttribute('id','scholar-pane');
newPane.setAttribute('collapsed',true);
newPane.setAttribute('flex','1');
while(oldPane.hasChildNodes())
newPane.appendChild(oldPane.firstChild);
appContent.removeChild(oldPane);
appContent.insertBefore(newPane, document.getElementById('content'));
var newSplitter = document.createElement('splitter');
newSplitter.setAttribute('id','scholar-splitter');
newSplitter.setAttribute('collapsed',true);
newSplitter.setAttribute('resizebefore','closest');
newSplitter.setAttribute('resizeafter','closest');
appContent.removeChild(oldSplitter);
appContent.insertBefore(newSplitter, document.getElementById('content'));
}
*/
//Create the add menu with each item type
var addMenu = document.getElementById('tb-add').firstChild;
@ -75,10 +86,10 @@ var ScholarPane = new function()
*/
function toggleDisplay()
{
var visible = document.getElementById('scholar-pane').getAttribute('hidden') == 'true';
var visible = document.getElementById('scholar-pane').getAttribute('collapsed') == 'true';
document.getElementById('scholar-pane').setAttribute('hidden',!visible);
document.getElementById('scholar-splitter').setAttribute('hidden',!visible);
document.getElementById('scholar-pane').setAttribute('collapsed',!visible);
document.getElementById('scholar-splitter').setAttribute('collapsed',!visible);
if(!visible)
document.getElementById('content').setAttribute('collapsed', false);
@ -88,7 +99,7 @@ var ScholarPane = new function()
{
var visible = document.getElementById('content').getAttribute('collapsed') == 'true';
document.getElementById('content').setAttribute('collapsed', !visible);
document.getElementById('scholar-splitter').setAttribute('hidden', !visible);
document.getElementById('scholar-splitter').setAttribute('collapsed', !visible);
}
/*

View file

@ -21,8 +21,9 @@
</commandset>
<vbox id="appcontent">
<splitter id="scholar-splitter" resizebefore="closest" resizeafter="closest" hidden="true"/>
<hbox id="scholar-pane" hidden="true" flex="1">
<!-- Changes to attributes of scholar-splitter and scholar-pane must be mirrored on overlay.js's onLoad() function -->
<splitter id="scholar-splitter" resizebefore="closest" resizeafter="closest" collapsed="true"/>
<hbox id="scholar-pane" collapsed="true" flex="1">
<popupset>
<popup id="scholar-collectionmenu" onpopupshowing="ScholarPane.buildCollectionContextMenu();">
<menuitem label="&toolbar.newCollection.label;" command="cmd_scholar_newCollection"/>

View file

@ -1,4 +1,5 @@
var autoUpdateBox;
var positionMenu;
/*
To add a new preference:
@ -17,10 +18,14 @@ function init()
{
autoUpdateBox = document.getElementById('autoUpdateBox');
autoUpdateBox.checked = Scholar.Prefs.get('automaticScraperUpdates');
positionMenu = document.getElementById('positionMenu');
positionMenu.selectedIndex = Scholar.Prefs.get('scholarPaneOnTop') ? 0 : 1;
}
function accept()
{
Scholar.Prefs.set('automaticScraperUpdates', autoUpdateBox.checked)
Scholar.Prefs.set('scholarPaneOnTop', positionMenu.selectedIndex == 0)
}

View file

@ -14,5 +14,14 @@
<checkbox id="autoUpdateBox" label="&scholar.preferences.autoUpdate.label;"/>
<hbox>
<label value="Display Scholar:" control="positionMenu"/>
<menulist id="positionMenu">
<menupopup>
<menuitem label="Above browser content"/>
<menuitem label="Below browser content"/>
</menupopup>
</menulist>
</hbox>
</dialog>

View file

@ -108,22 +108,12 @@
{
margin-left: 5px;
}
#scholar-view-item tabpanels
{
padding: 8px 0px 0px 0px;
}
#scholar-view-item .clicky
{
-moz-border-radius: 6px;
}
#scholar-view-item .clicky:hover
{
color: white;
background: #666666;
}
#scholar-splitter
{
border-top: none;

View file

@ -13,6 +13,16 @@ tagsbox
-moz-binding: url('chrome://scholar/content/customControls.xml#tags-box');
}
.clicky
{
-moz-border-radius: 6px;
}
.clicky:hover
{
color: white;
background: #666666;
}
#scholar-progress-box
{

View file

@ -1,4 +1,5 @@
// These are DEFAULT prefs for the INSTALL. You will have to reinstall the extension to see differences!
// Display internal shortcut
pref("extensions.scholar.automaticScraperUpdates",true);
pref("extensions.scholar.automaticScraperUpdates",true);
pref("extensions.scholar.scholarPaneOnTop",false);