Zotero Everywhere megacommit

- Implement connector for Firefox (should switch in/out of connector mode automatically when Standalone is launched or closed, although this has only been tested extensively on OS X)
- Share core translation code between Zotero and connectors

Still to be done:

- Run translators in non-Fx connectors (this works in theory, but it's not currently enabled for any translators)
- Show translation results in non-Fx connectors
- Ability to translate to server when Zotero Standalone is not running
This commit is contained in:
Simon Kornblith 2011-06-14 00:36:21 +00:00
parent fd5d9496fd
commit 8268d1b01c
33 changed files with 3582 additions and 1645 deletions

View file

@ -852,13 +852,21 @@ function ChromeExtensionHandler() {
var [path, queryString] = uri.path.substr(1).split('?');
var [type, id] = path.split('/');
//currently only able to select one item
// currently only able to select one item
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow(null);
var win = wm.getMostRecentWindow("navigator:browser");
// restore window if it's in the dock
if(win.windowState == Components.interfaces.nsIDOMChromeWindow.STATE_MINIMIZED) {
win.restore();
}
// open Zotero pane
win.ZoteroPane.show();
if(!id) return;
var lkh = Zotero.Items.parseLibraryKeyHash(id);
if (lkh) {
var item = Zotero.Items.getByLibraryAndKey(lkh.libraryID, lkh.key);
@ -1026,10 +1034,10 @@ function ChromeExtensionHandler() {
try {
var originalURI = uri.path;
originalURI = decodeURIComponent(originalURI.substr(originalURI.indexOf("/")+1));
if(!Zotero.Connector.Data[originalURI]) {
if(!Zotero.Server.Connector.Data[originalURI]) {
return null;
} else {
return new ConnectorChannel(originalURI, Zotero.Connector.Data[originalURI]);
return new ConnectorChannel(originalURI, Zotero.Server.Connector.Data[originalURI]);
}
} catch(e) {
Zotero.debug(e);