commit 1a3d616c2d2d2502cf1f04712ccc1eb354775447
parent c9bd1b015bc47b468d7e5c00a3477f656a56fe48
Author: Simon Kornblith <simon@simonster.com>
Date: Mon, 24 Jan 2011 10:29:36 +0000
- add support for Zotero as a separate tab (currently only via loading chrome://zotero/content/tab.xul)
- tweak twisty appearance on OS X (highlight-on-click is gone, but this seems preferable to the previous behavior)
- simplify chrome.manifest for standalone
Diffstat:
12 files changed, 132 insertions(+), 11 deletions(-)
diff --git a/chrome/content/zotero-platform/mac/overlay.css b/chrome/content/zotero-platform/mac/overlay.css
@@ -396,4 +396,49 @@
#zotero-items-tree treechildren::-moz-tree-cell,
#zotero-items-tree treechildren::-moz-tree-column {
border-right: 1px solid #d7dad7;
+}
+
+treechildren::-moz-tree-twisty {
+ -moz-appearance: none;
+ width: 11px;
+ height: 11px;
+ list-style-image: url("chrome://zotero/skin/mac/twisty.png");
+ -moz-padding-start: 5px;
+ -moz-padding-end: 6px;
+}
+
+treechildren::-moz-tree-twisty(open) {
+ -moz-appearance: none;
+ width: 11px;
+ height: 11px;
+ list-style-image: url("chrome://zotero/skin/mac/twisty-open.png");
+ -moz-padding-start: 4px;
+ -moz-padding-end: 7px;
+}
+
+/* How to get active twisty?
+treechildren::-moz-tree-twisty(active) {
+ -moz-appearance: none;
+ list-style-image: url("chrome://zotero/skin/mac/twisty-active.png") !important;
+}
+
+treechilren::-moz-tree-twisty(active) {
+ -moz-appearance: none;
+ list-style-image: url("chrome://zotero/skin/mac/twisty-active-open.png");
+}
+*/
+
+:root[active] treechildren::-moz-tree-twisty(selected) {
+ -moz-appearance: none;
+ list-style-image: url("chrome://zotero/skin/mac/twisty-selected.png");
+}
+
+:root[active] treechildren::-moz-tree-twisty(selected, open) {
+ -moz-appearance: none;
+ list-style-image: url("chrome://zotero/skin/mac/twisty-selected-open.png");
+}
+
+treechildren::-moz-tree-image {
+ height: 16px;
+ padding-bottom: 1px;
}
\ No newline at end of file
diff --git a/chrome/content/zotero/browser.js b/chrome/content/zotero/browser.js
@@ -104,7 +104,12 @@ var Zotero_Browser = new function() {
* Initialize some variables and prepare event listeners for when chrome is done loading
*/
function init() {
- if (!Zotero || !Zotero.initialized || Zotero.isStandalone) {
+ try {
+ var gb = gBrowser;
+ } catch(e) {
+ return;
+ }
+ if (!Zotero || !Zotero.initialized || !gb) {
return;
}
diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js
@@ -90,6 +90,7 @@ var ZoteroPane = new function()
var self = this;
var _loaded = false;
+ var _isStandaloneOrTab = false;
var titlebarcolorState, toolbarCollapseState, titleState;
// Also needs to be changed in collectionTreeView.js
@@ -100,9 +101,11 @@ var ZoteroPane = new function()
*/
function onLoad()
{
+ _isStandaloneOrTab = Zotero.isStandalone || document.getElementById('zotero-tab');
+
if (!Zotero) return;
if (!Zotero.initialized) {
- if(Zotero.isStandalone) {
+ if(_isStandaloneOrTab) {
_loaded = true;
this.toggleDisplay();
}
@@ -229,7 +232,7 @@ var ZoteroPane = new function()
document.getElementById('zotero-tb-actions-showDuplicates').hidden = false;
}
- if(Zotero.isStandalone) {
+ if(_isStandaloneOrTab) {
this.toggleDisplay(true);
this.fullScreen(true);
}
@@ -350,7 +353,7 @@ var ZoteroPane = new function()
var isCollapsed = true;
}
- if (isHidden || isCollapsed || Zotero.isStandalone) {
+ if (isHidden || isCollapsed || _isStandaloneOrTab) {
var makeVisible = true;
}
@@ -510,7 +513,7 @@ var ZoteroPane = new function()
*/
function _setFullWindowMode(set) {
// hide or show navigation toolbars
- if(Zotero.isStandalone) return;
+ if(_isStandaloneOrTab) return;
var toolbox = getNavToolbox();
if(set) {
diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul
@@ -478,11 +478,11 @@
Zotero.getString('errorReport.reportErrors'));
}
+ var fx36Icon = document.getElementById('zotero-status-bar-icon');
+ var addonBar = document.getElementById('addon-bar');
+
// Check whether standalone is running, and return if so
- var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
- .getService(Components.interfaces.nsIXULAppInfo);
- var isStandalone = appInfo.ID === "zotero@chnm.gmu.edu";
- if(isStandalone) return;
+ if(!addonBar && !fx36Icon) return;
// THE FOLLOWING CODE IS NOT APPLIED IN STANDALONE
// (It relates almost entirely to the Zotero icon)
@@ -491,10 +491,12 @@
.getService(Components.interfaces.nsIPrefService)
.getBranch('extensions.zotero.').getIntPref('statusBarIcon');
+ var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
+ .getService(Components.interfaces.nsIXULAppInfo);
var isFx36 = appInfo.platformVersion.indexOf('1.9') === 0;
// Status bar in Fx3.6
if (isFx36) {
- var icon = document.getElementById('zotero-status-bar-icon');
+ var icon = fx36Icon;
}
// In >=Fx4, add to add-on bar
else {
@@ -502,7 +504,6 @@
icon.id = 'zotero-addon-bar-icon';
icon.setAttribute('oncommand', 'ZoteroPane.toggleDisplay()');
icon.setAttribute('hidden', true);
- var addonBar = document.getElementById('addon-bar');
addonBar.appendChild(icon);
if (addonBar.collapsed) {
// If no Zotero or icon isn't set to hidden, show add-on bar
diff --git a/chrome/content/zotero/standalone.xul b/chrome/content/zotero/standalone.xul
@@ -1,8 +1,11 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/standalone.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
+<?xul-overlay href="chrome://zotero/content/overlay.xul"?>
+<?xul-overlay href="chrome://zotero/content/itemPane.xul"?>
<!DOCTYPE window [
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
diff --git a/chrome/content/zotero/tab.xul b/chrome/content/zotero/tab.xul
@@ -0,0 +1,64 @@
+<?xml version="1.0"?>
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?>
+<?xml-stylesheet href="chrome://zotero/skin/standalone.css" type="text/css"?>
+<?xul-overlay href="chrome://zotero/content/overlay.xul"?>
+<?xul-overlay href="chrome://zotero/content/itemPane.xul"?>
+
+<!DOCTYPE window [
+<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
+%globalDTD;
+<!ENTITY % charsetDTD SYSTEM "chrome://global/locale/charsetOverlay.dtd" >
+%charsetDTD;
+<!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd" >
+%textcontextDTD;
+<!ENTITY % standaloneDTD SYSTEM "chrome://zotero/locale/standalone.dtd" >
+%standaloneDTD;
+<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
+%brandDTD;
+]>
+
+<window id="zotero-tab" title="Zotero"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ flex="1">
+ <popup id="contentAreaContextMenu">
+ <menuitem id="context-undo"
+ label="&undoCmd.label;"
+ accesskey="&undoCmd.accesskey;"
+ command="cmd_undo"/>
+ <menuseparator id="context-sep-undo"/>
+ <menuitem id="context-cut"
+ label="&cutCmd.label;"
+ accesskey="&cutCmd.accesskey;"
+ command="cmd_cut"/>
+ <menuitem id="context-copy"
+ label="©Cmd.label;"
+ accesskey="©Cmd.accesskey;"
+ command="cmd_copy"/>
+ <menuitem id="context-paste"
+ label="&pasteCmd.label;"
+ accesskey="&pasteCmd.accesskey;"
+ command="cmd_paste"/>
+ <menuitem id="context-delete"
+ label="&deleteCmd.label;"
+ accesskey="&deleteCmd.accesskey;"
+ command="cmd_delete"/>
+ <menuseparator id="context-sep-paste"/>
+ <menuitem id="context-selectall"
+ label="&selectAllCmd.label;"
+ accesskey="&selectAllCmd.accesskey;"
+ command="cmd_selectAll"/>
+ </popup>
+ <hbox flex="1" id="browser">
+ <vbox id="appcontent" flex="1">
+ <tabbrowser id="content" disablehistory="true"
+ flex="1" contenttooltip="aHTMLTooltip"
+ contentcontextmenu="contentAreaContextMenu"
+ onnewtab="BrowserOpenTab();"
+ autocompletepopup="PopupAutoComplete"
+ onclick="return contentAreaClick(event, false);"/>
+ </vbox>
+ </hbox>
+ <keyset id="mainKeyset"/>
+</window>
diff --git a/chrome/skin/default/zotero/mac/twisty-active-open.png b/chrome/skin/default/zotero/mac/twisty-active-open.png
Binary files differ.
diff --git a/chrome/skin/default/zotero/mac/twisty-active.png b/chrome/skin/default/zotero/mac/twisty-active.png
Binary files differ.
diff --git a/chrome/skin/default/zotero/mac/twisty-open.png b/chrome/skin/default/zotero/mac/twisty-open.png
Binary files differ.
diff --git a/chrome/skin/default/zotero/mac/twisty-selected-open.png b/chrome/skin/default/zotero/mac/twisty-selected-open.png
Binary files differ.
diff --git a/chrome/skin/default/zotero/mac/twisty-selected.png b/chrome/skin/default/zotero/mac/twisty-selected.png
Binary files differ.
diff --git a/chrome/skin/default/zotero/mac/twisty.png b/chrome/skin/default/zotero/mac/twisty.png
Binary files differ.