This is an old revision of the document!


Changes in Zotero 3.0

Changes to translators

Zotero.done() and Zotero.wait() are deprecated

  • Calling Zotero.done() and Zotero.wait() during translation is no longer necessary. Zotero.done() is still used to indicate item type in translators that implement asynchronous detection (currently only unAPI).

Zotero connectors require changes to translator code

Zotero Everywhere will soon allow translators to operate outside of Firefox/XULRunner. Legacy translators can still run inside Zotero Standalone, but will require that Zotero Standalone is running to operate. This will require the following code changes:

  • Firefox-specific JavaScript, with the exception of “for each”, must be avoided. This includes
    • array comprehensions
    • destructuring assignment
    • several other features
  • E4X functionality is not available. As of Zotero 2.1b6, Zotero also offers DOM XML interfaces to translators. Current trunk builds offer cross-browser utility functions for working with XPaths detailed above, which greatly simplify migration away from E4X.
  • Zotero.Utilities.retrieveDocument() and Zotero.Utilities.retrieveSource() should be avoided. Zotero.Utilities.retrieveDocument() will throw an error outside of Firefox, whereas Zotero.Utilities.retrieveSource() will freeze the main thread and will not work across domains. Code should be rewritten to use Zotero.Utilities.processDocuments(), Zotero.Utilities.HTTP.doGet(), or Zotero.Utilities.HTTP.doPost(), which remain available in all environments.
  • Translate#getTranslatorObject() should now be called with a callback function as an argument, which will receive the translator object when it is available. This is backwards compatible with Zotero 2.1b6 and later.
    • In Chrome and Safari, the “exports” object is exposed to other translators, rather than the entire translator sandbox. Any variables or functions that need to be accessible to other translators should be properties or methods of this object. In Zotero 2.1.9 and later, Translate#getTranslatorObject() will always return the “exports” object if it has properties.
  • Translators should not expect a return value from Translate#getTranslators(). Instead, they should register a “translators” handler, which will receive the list of translators as the second argument. This is backwards compatible with Zotero 1.0 and later.
  • Zotero.selectItems() should now be called with a callback function as an argument, which will receive the list of selected items when it is available. Translators may still use Zotero.selectItems() synchronously, but this will require that the first part of the translator be executed twice. This is backwards compatible with Zotero 2.1b6 and later.

Making add-ons for Zotero Standalone

It is possible to create add-ons for Zotero Standalone just as one would create add-ons for Firefox. To do so, simply add the following lines to install.rdf:

	<em:targetApplication>
		<Description>
			<em:id>zotero@chnm.gmu.edu</em:id>
			<em:minVersion>3.0b1</em:minVersion>
			<em:maxVersion>3.0.*</em:maxVersion>
		</Description>
	</em:targetApplication>

where minVersion is the lowest Zotero Standalone version you have tested with, and maxVersion is the maximum version you can reasonably expect your add-on to work with. For add-ons that overlay zoteroPane.xul, this addition should be sufficient, and the same XPI should work in both Firefox and Zotero Standalone.

To install an add-on in Zotero Standalone, go to Tools→Add-ons and choose “Install Add-on From File…” from the cog menu.

dev/client_coding/changes_in_zotero_3.0.1313916453.txt.gz · Last modified: 2011/08/21 04:47 by simon