support for standalone Zotero

This commit is contained in:
Simon Kornblith 2010-03-28 07:21:17 +00:00
parent 78a37e7dbc
commit 99690742f9
7 changed files with 388 additions and 75 deletions

View file

@ -302,11 +302,11 @@ var Zotero_Browser = new function() {
var reset = document.getElementById('cmd_fullZoomReset'); var reset = document.getElementById('cmd_fullZoomReset');
} }
reduce.addEventListener("command", if(reduce) reduce.addEventListener("command",
function(e) { Zotero_Browser.resize(e) }, false); function(e) { Zotero_Browser.resize(e) }, false);
enlarge.addEventListener("command", if(enlarge) enlarge.addEventListener("command",
function(e) { Zotero_Browser.resize(e) }, false); function(e) { Zotero_Browser.resize(e) }, false);
reset.addEventListener("command", if(reset) reset.addEventListener("command",
function(e) { Zotero_Browser.resize(e) }, false); function(e) { Zotero_Browser.resize(e) }, false);
} }

View file

@ -218,6 +218,11 @@ var ZoteroPane = new function()
document.getElementById("zotero-tb-search-label").hidden = false; document.getElementById("zotero-tb-search-label").hidden = false;
document.getElementById("zotero-tb-search").setAttribute("type", "conditional-timed"); document.getElementById("zotero-tb-search").setAttribute("type", "conditional-timed");
} }
if(Zotero.isStandalone) {
this.toggleDisplay();
this.fullScreen(true);
}
} }

View file

@ -475,6 +475,7 @@
<![CDATA[ <![CDATA[
window.addEventListener('load', function(e){ window.addEventListener('load', function(e){
var icon = document.getElementById('zotero-status-bar-icon'); var icon = document.getElementById('zotero-status-bar-icon');
if(icon) {
if (Zotero && Zotero.initialized){ if (Zotero && Zotero.initialized){
switch (Zotero.Prefs.get('statusBarIcon')) { switch (Zotero.Prefs.get('statusBarIcon')) {
case 2: case 2:
@ -519,6 +520,7 @@
if (Zotero.initialURL) { if (Zotero.initialURL) {
setTimeout("gBrowser.selectedTab = gBrowser.addTab(Zotero.initialURL); Zotero.initialURL = null;", 1); setTimeout("gBrowser.selectedTab = gBrowser.addTab(Zotero.initialURL); Zotero.initialURL = null;", 1);
} }
}
}, false); }, false);
document.getElementById('appcontent').addEventListener('keydown', ZoteroPane.handleKeyDown, true); document.getElementById('appcontent').addEventListener('keydown', ZoteroPane.handleKeyDown, true);

View file

@ -0,0 +1,221 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<!DOCTYPE window [
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
<!ENTITY % globalRegionDTD SYSTEM "chrome://global-region/locale/region.dtd">
%globalRegionDTD;
<!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;
]>
<window id="main-window"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="window.sizeToContent()"
width="1100" height="700"
persist="screenX screenY width height sizemode">
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/x-javascript" src="chrome://global/content/viewZoomOverlay.js"/>
<script type="application/x-javascript" src="chrome://global/content/contentAreaUtils.js"/>
<script type="application/x-javascript" src="chrome://global/content/inlineSpellCheckUI.js"/>
<commandset id="mainCommandSet">
<command id="cmd_toggleTaskbar" oncommand="goToggleToolbar('status-bar','toggle_taskbar');"/>
<command id="cmd_quitApplication" oncommand="goQuitApplication()"/>
<commandset id="editMenuCommands"/>
<command id="cmd_find"
oncommand="gFindBar.onFindCommand();"
observes="isImage"/>
<command id="cmd_findAgain"
oncommand="gFindBar.onFindAgainCommand(false);"
observes="isImage"/>
<command id="cmd_findPrevious"
oncommand="gFindBar.onFindAgainCommand(true);"
observes="isImage"/>
<command id="cmd_fullZoomReduce" oncommand="FullZoom.reduce()"/>
<command id="cmd_fullZoomEnlarge" oncommand="FullZoom.enlarge()"/>
<command id="cmd_fullZoomReset" oncommand="FullZoom.reset()"/>
<command id="cmd_fullZoomToggle" oncommand="ZoomManager.toggleZoom();"/>
</commandset>
<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="&copyCmd.label;"
accesskey="&copyCmd.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>
<toolbox id="navigator-toolbox" class="toolbox-top" mode="icons" defaultmode="icons">
<!-- Menu -->
<toolbar type="menubar" id="toolbar-menubar" class="chromeclass-menubar" customizable="true"
defaultset="menubar-items"
mode="icons" iconsize="small" defaulticonsize="small"
context="toolbar-context-menu">
<toolbaritem id="menubar-items" align="center">
<menubar id="main-menubar"
style="border:0px;padding:0px;margin:0px;-moz-appearance:none">
<menu id="file-menu" label="&fileMenu.label;" accesskey="&fileMenu.accesskey;">
<menupopup id="menu_FilePopup">
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close"
accesskey="&closeCmd.accesskey;" command="cmd_close"/>
<menuseparator/>
<menuitem id="menu_FileQuitItem"
label="&quitApplicationCmdMac.label;"
key="key_quitApplication"
command="cmd_quitApplication"/>
</menupopup>
</menu>
<menu id="edit-menu" label="&editMenu.label;" accesskey="&editMenu.accesskey;">
<menupopup id="menu_EditPopup">
<menuitem label="&undoCmd.label;"
id="menu_undo"
key="key_undo"
accesskey="&undoCmd.accesskey;"
command="cmd_undo"/>
<menuitem label="&redoCmd.label;"
id="menu_redo"
key="key_redo"
accesskey="&redoCmd.accesskey;"
command="cmd_redo"/>
<menuseparator/>
<menuitem label="&cutCmd.label;"
id="menu_cut"
key="key_cut"
accesskey="&cutCmd.accesskey;"
command="cmd_cut"/>
<menuitem label="&copyCmd.label;"
id="menu_copy"
key="key_copy"
accesskey="&copyCmd.accesskey;"
command="cmd_copy"/>
<menuitem label="&pasteCmd.label;"
id="menu_paste"
key="key_paste"
accesskey="&pasteCmd.accesskey;"
command="cmd_paste"/>
<menuitem label="&deleteCmd.label;"
id="menu_delete"
key="key_delete"
accesskey="&deleteCmd.accesskey;"
command="cmd_delete"/>
<menuseparator/>
<menuitem id="menu_selectAll"
label="&selectAllCmd.label;"
key="key_selectAll"
accesskey="&selectAllCmd.accesskey;"
command="cmd_selectAll"/>
<menuseparator/>
<menuitem id="menu_find" label="&findOnCmd.label;" accesskey="&findOnCmd.accesskey;" key="key_find" command="cmd_find"/>
<menuitem label="&findAgainCmd.label;" accesskey="&findAgainCmd.accesskey;" key="key_findAgain" command="cmd_findAgain"
id="menu_findAgain" />
<menuseparator hidden="true" id="textfieldDirection-separator"/>
<menuitem id="textfieldDirection-swap"
command="cmd_switchTextDirection"
key="key_switchTextDirection"
label="&bidiSwitchTextDirectionItem.label;"
accesskey="&bidiSwitchTextDirectionItem.accesskey;"
hidden="true"/>
</menupopup>
</menu>
<menu id="windowMenu" />
<menu id="helpMenu" />
</menubar>
</toolbaritem>
</toolbar>
</toolbox>
<keyset id="mainKeyset">
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
<key id="key_undo"
key="&undoCmd.key;"
modifiers="accel"/>
<key id="key_redo" key="&undoCmd.key;" modifiers="accel,shift"/>
<key id="key_cut"
key="&cutCmd.key;"
modifiers="accel"/>
<key id="key_copy"
key="&copyCmd.key;"
modifiers="accel"/>
<key id="key_paste"
key="&pasteCmd.key;"
modifiers="accel"/>
<key id="key_delete" keycode="VK_DELETE" command="cmd_delete"/>
<key id="key_selectAll" key="&selectAllCmd.key;" modifiers="accel"/>
<key id="key_find" key="&findOnCmd.commandkey;" command="cmd_find" modifiers="accel"/>
<key id="key_findAgain" key="&findAgainCmd.commandkey;" command="cmd_findAgain" modifiers="accel"/>
<key id="key_findPrevious" key="&findAgainCmd.commandkey;" command="cmd_findPrevious" modifiers="accel,shift"/>
<key keycode="&findAgainCmd.commandkey2;" command="cmd_findAgain"/>
<key keycode="&findAgainCmd.commandkey2;" command="cmd_findPrevious" modifiers="shift"/>
<key id="key_fullZoomReduce" key="&fullZoomReduceCmd.commandkey;" command="cmd_fullZoomReduce" modifiers="accel"/>
<key key="&fullZoomReduceCmd.commandkey2;" command="cmd_fullZoomReduce" modifiers="accel"/>
<key id="key_fullZoomEnlarge" key="&fullZoomEnlargeCmd.commandkey;" command="cmd_fullZoomEnlarge" modifiers="accel"/>
<key key="&fullZoomEnlargeCmd.commandkey2;" command="cmd_fullZoomEnlarge" modifiers="accel"/>
<key key="&fullZoomEnlargeCmd.commandkey3;" command="cmd_fullZoomEnlarge" modifiers="accel"/>
<key id="key_fullZoomReset" key="&fullZoomResetCmd.commandkey;" command="cmd_fullZoomReset" modifiers="accel"/>
<key key="&fullZoomResetCmd.commandkey2;" command="cmd_fullZoomReset" modifiers="accel"/>
<key id="key_switchTextDirection" key="&bidiSwitchTextDirectionItem.commandkey;" command="cmd_switchTextDirection" modifiers="accel,shift" />
<key id="key_quitApplication" key="&quitApplicationCmdMac.key;" command="cmd_quitApplication" modifiers="accel"/>
</keyset>
<!--<toolbarpalette/>
<toolbar id="nav-bar" class="toolbar-primary chromeclass-toolbar"
fullscreentoolbar="true" mode="icons" iconsize="large"
customizable="true"
defaultset="unified-back-forward-button,reload-button,stop-button,home-button,urlbar-container,search-container"
context="toolbar-context-menu"/>
<toolbarset id="customToolbars" context="toolbar-context-menu"/>
<toolbar id="PersonalToolbar"
mode="icons" iconsize="small" defaulticonsize="small"
class="chromeclass-directories"
context="toolbar-context-menu"
defaultset="personal-bookmarks"
customizable="true"/>-->
<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"
ondrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);"
onclick="return contentAreaClick(event, false);"/>
</vbox>
</hbox>
<keyset id="mainKeyset"/>
</window>

View file

@ -914,10 +914,7 @@ Zotero.Schema = new function(){
return _schemaVersions[schema]; return _schemaVersions[schema];
} }
var file = Components.classes["@mozilla.org/extensions/manager;1"] var file = Zotero.getInstallDirectory();
.getService(Components.interfaces.nsIExtensionManager)
.getInstallLocation(ZOTERO_CONFIG['GUID'])
.getItemLocation(ZOTERO_CONFIG['GUID']);
file.append(schemaFile); file.append(schemaFile);
// Open an input stream from file // Open an input stream from file
@ -952,10 +949,7 @@ Zotero.Schema = new function(){
// We pull the schema from an external file so we only have to process // We pull the schema from an external file so we only have to process
// it when necessary // it when necessary
var file = Components.classes["@mozilla.org/extensions/manager;1"] var file = Zotero.getInstallDirectory();
.getService(Components.interfaces.nsIExtensionManager)
.getInstallLocation(ZOTERO_CONFIG['GUID'])
.getItemLocation(ZOTERO_CONFIG['GUID']);
file.append(schemaFile); file.append(schemaFile);
// Open an input stream from file // Open an input stream from file
@ -998,10 +992,7 @@ Zotero.Schema = new function(){
// We pull the schema from an external file so we only have to process // We pull the schema from an external file so we only have to process
// it when necessary // it when necessary
var file = Components.classes["@mozilla.org/extensions/manager;1"] var file = Zotero.getInstallDirectory();
.getService(Components.interfaces.nsIExtensionManager)
.getInstallLocation(ZOTERO_CONFIG['GUID'])
.getItemLocation(ZOTERO_CONFIG['GUID']);
file.append(schemaFile); file.append(schemaFile);
// Open an input stream from file // Open an input stream from file

View file

@ -186,17 +186,15 @@ var Zotero = new function(){
this.mainThread = Components.classes["@mozilla.org/thread-manager;1"].getService().mainThread; this.mainThread = Components.classes["@mozilla.org/thread-manager;1"].getService().mainThread;
// Load in the extension version from the extension manager
var nsIUpdateItem = Components.interfaces.nsIUpdateItem;
var gExtensionManager =
Components.classes["@mozilla.org/extensions/manager;1"]
.getService(Components.interfaces.nsIExtensionManager);
this.version
= gExtensionManager.getItemForID(ZOTERO_CONFIG['GUID']).version;
var appInfo = var appInfo =
Components.classes["@mozilla.org/xre/app-info;1"]. Components.classes["@mozilla.org/xre/app-info;1"].
getService(Components.interfaces.nsIXULAppInfo) getService(Components.interfaces.nsIXULAppInfo)
this.isStandalone = appInfo.ID == ZOTERO_CONFIG['GUID'];
Zotero.debug(this.isStandalone);
if(this.isStandalone) {
this.isFx35 = true;
this.version = appInfo.version;
} else {
this.appName = appInfo.name; this.appName = appInfo.name;
this.isFx2 = appInfo.platformVersion.indexOf('1.8') === 0; // TODO: remove this.isFx2 = appInfo.platformVersion.indexOf('1.8') === 0; // TODO: remove
this.isFx3 = appInfo.platformVersion.indexOf('1.9') === 0; this.isFx3 = appInfo.platformVersion.indexOf('1.9') === 0;
@ -204,6 +202,15 @@ var Zotero = new function(){
|| appInfo.platformVersion.indexOf('1.9.0') === 0; || appInfo.platformVersion.indexOf('1.9.0') === 0;
this.isFx35 = appInfo.platformVersion.indexOf('1.9.1') === 0; this.isFx35 = appInfo.platformVersion.indexOf('1.9.1') === 0;
this.isFx31 = this.isFx35; this.isFx31 = this.isFx35;
// Load in the extension version from the extension manager
var nsIUpdateItem = Components.interfaces.nsIUpdateItem;
var gExtensionManager =
Components.classes["@mozilla.org/extensions/manager;1"]
.getService(Components.interfaces.nsIExtensionManager);
this.version
= gExtensionManager.getItemForID(ZOTERO_CONFIG['GUID']).version;
}
this.isFx36 = appInfo.platformVersion.indexOf('1.9.2') === 0; this.isFx36 = appInfo.platformVersion.indexOf('1.9.2') === 0;
// OS platform // OS platform
@ -443,11 +450,18 @@ var Zotero = new function(){
function getInstallDirectory() { function getInstallDirectory() {
if(this.isStandalone) {
var dir = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("CurProcD", Components.interfaces.nsILocalFile);
Zotero.debug(dir.path);
return dir;
} else {
var id = ZOTERO_CONFIG.GUID; var id = ZOTERO_CONFIG.GUID;
var em = Components.classes["@mozilla.org/extensions/manager;1"]. var em = Components.classes["@mozilla.org/extensions/manager;1"].
getService(Components.interfaces.nsIExtensionManager); getService(Components.interfaces.nsIExtensionManager);
var installDir = em.getInstallLocation(id).getItemLocation(id); return em.getInstallLocation(id).getItemLocation(id);
return installDir; }
} }

View file

@ -0,0 +1,80 @@
<!ENTITY fileMenu.label "File">
<!ENTITY fileMenu.accesskey "F">
<!ENTITY closeCmd.label "Close">
<!ENTITY closeCmd.key "W">
<!ENTITY closeCmd.accesskey "C">
<!ENTITY quitApplicationCmdWin.label "Exit">
<!ENTITY quitApplicationCmdWin.accesskey "x">
<!ENTITY quitApplicationCmd.label "Quit">
<!ENTITY quitApplicationCmd.accesskey "Q">
<!ENTITY quitApplicationCmdMac.label "Quit Zotero">
<!ENTITY quitApplicationCmdMac.key "Q">
<!ENTITY editMenu.label "Edit">
<!ENTITY editMenu.accesskey "E">
<!ENTITY undoCmd.label "Undo">
<!ENTITY undoCmd.key "Z">
<!ENTITY undoCmd.accesskey "U">
<!ENTITY redoCmd.label "Redo">
<!ENTITY redoCmd.key "Y">
<!ENTITY redoCmd.accesskey "R">
<!ENTITY cutCmd.label "Cut">
<!ENTITY cutCmd.key "X">
<!ENTITY cutCmd.accesskey "t">
<!ENTITY copyCmd.label "Copy">
<!ENTITY copyCmd.key "C">
<!ENTITY copyCmd.accesskey "C">
<!ENTITY pasteCmd.label "Paste">
<!ENTITY pasteCmd.key "V">
<!ENTITY pasteCmd.accesskey "P">
<!ENTITY deleteCmd.label "Delete">
<!ENTITY deleteCmd.key "D">
<!ENTITY deleteCmd.accesskey "D">
<!ENTITY selectAllCmd.label "Select All">
<!ENTITY selectAllCmd.key "A">
<!ENTITY selectAllCmd.accesskey "A">
<!ENTITY preferencesCmd.label "Options…">
<!ENTITY preferencesCmd.accesskey "O">
<!ENTITY preferencesCmdUnix.label "Preferences">
<!ENTITY preferencesCmdUnix.accesskey "n">
<!ENTITY findOnCmd.label "Find in This Page…">
<!ENTITY findOnCmd.accesskey "F">
<!ENTITY findOnCmd.commandkey "f">
<!ENTITY findAgainCmd.label "Find Again">
<!ENTITY findAgainCmd.accesskey "g">
<!ENTITY findAgainCmd.commandkey "g">
<!ENTITY findAgainCmd.commandkey2 "VK_F3">
<!ENTITY bidiSwitchPageDirectionItem.label "Switch Page Direction">
<!ENTITY bidiSwitchPageDirectionItem.accesskey "g">
<!ENTITY bidiSwitchTextDirectionItem.label "Switch Text Direction">
<!ENTITY bidiSwitchTextDirectionItem.accesskey "w">
<!ENTITY bidiSwitchTextDirectionItem.commandkey "X">
<!-- LOCALIZATION NOTE :
fullZoomEnlargeCmd.commandkey3, fullZoomReduceCmd.commandkey2 and
fullZoomResetCmd.commandkey2 are alternative acceleration keys for zoom.
If shift key is needed with your locale popular keyboard for them,
you can use these alternative items. Otherwise, their values should be empty. -->
<!ENTITY fullZoomEnlargeCmd.label "Zoom In">
<!ENTITY fullZoomEnlargeCmd.accesskey "I">
<!ENTITY fullZoomEnlargeCmd.commandkey "+">
<!ENTITY fullZoomEnlargeCmd.commandkey2 "="> <!-- + is above this key on many keyboards -->
<!ENTITY fullZoomEnlargeCmd.commandkey3 "">
<!ENTITY fullZoomReduceCmd.label "Zoom Out">
<!ENTITY fullZoomReduceCmd.accesskey "O">
<!ENTITY fullZoomReduceCmd.commandkey "-">
<!ENTITY fullZoomReduceCmd.commandkey2 "">
<!ENTITY fullZoomResetCmd.label "Reset">
<!ENTITY fullZoomResetCmd.accesskey "R">
<!ENTITY fullZoomResetCmd.commandkey "0">
<!ENTITY fullZoomResetCmd.commandkey2 "">
<!ENTITY fullZoomToggleCmd.label "Zoom Text Only">
<!ENTITY fullZoomToggleCmd.accesskey "T">
<!ENTITY fullZoom.label "Zoom">
<!ENTITY fullZoom.accesskey "Z">