commit 8427ebdf2a064362d03b7c7649207ccc8734ef17
parent 785954f4f5217d529f4e05ead41fa6ebd763e30d
Author: David Norton <david@nortoncrew.com>
Date: Wed, 19 Jul 2006 16:14:27 +0000
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)
Diffstat:
7 files changed, 56 insertions(+), 29 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js
@@ -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);
}
/*
diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul
@@ -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"/>
diff --git a/chrome/chromeFiles/content/scholar/preferences.js b/chrome/chromeFiles/content/scholar/preferences.js
@@ -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)
}
\ No newline at end of file
diff --git a/chrome/chromeFiles/content/scholar/preferences.xul b/chrome/chromeFiles/content/scholar/preferences.xul
@@ -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>
\ No newline at end of file
diff --git a/chrome/chromeFiles/skin/default/scholar/overlay.css b/chrome/chromeFiles/skin/default/scholar/overlay.css
@@ -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;
diff --git a/chrome/chromeFiles/skin/default/scholar/scholar.css b/chrome/chromeFiles/skin/default/scholar/scholar.css
@@ -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
{
diff --git a/defaults/preferences/scholar.js b/defaults/preferences/scholar.js
@@ -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);
-\ No newline at end of file
+pref("extensions.scholar.automaticScraperUpdates",true);
+pref("extensions.scholar.scholarPaneOnTop",false);
+\ No newline at end of file