This is an old revision of the document!


Changes in Zotero 2.1

Changes to citation API

With the introduction of citeproc-js, all Zotero.CSL APIs have been removed. Styles can be loaded in the usual way by accessing Zotero.Styles, but developers should use Zotero.Style.csl to acquire a citeproc-js engine instance for citation formatting.

Zotero.Cite.makeFormattedBibliography(engine, format)

can be used to generate a fully-formatted bibliography.

Zotero as a tab and Zotero Standalone have required us to further abstract the interface layer. While the code for the interface has changed little, and most overlays should continue to work, as of the present Zotero trunk, plug-ins and add-ons should now overlay zoteroPane.xul instead of browser.xul or overlay.xul in chrome.manifest, e.g., using:

overlay	chrome://zotero/content/zoteroPane.xul	chrome://zotero-addon/content/overlay.xul

Changes to translators

  • Several functions in Zotero.Utilities have been eliminated, as they were essential duplications of built-in JavaScript methods.
  • Zotero.configure() and Zotero.displayOptions() no longer exist. Instead, translators should specify config and display options in the metadata block at the top of the translator, e.g.
    {
    	"translatorID":"32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7",
    	[...]
    	"configOptions":{"dataMode":"rdf/xml"},
    	"displayOptions":{"exportNotes":true},
    	"lastUpdated":"2011-01-11 04:31:00"
    }
  • It is no longer necessary to specify “dataMode”:“block” or “dataMode”:“line”. If Zotero.read() is passed a numeric value, it reads a specified number of bytes; otherwise, it reads a full line.
  • Import and export translators now show determinate progress bars. By default, Zotero computes progress by the percentage of the file read for import, or the percentage of items retrieved using Zotero.nextItem() for export. Translators can override this by calling Zotero.setProgress(percentage) to set the percentage the progress bar displays, or Zotero.setProgress(null) to show an indeterminate indicator.

Changes to translate interface

New code should create new instances of the translate interface using type-specific constructors, e.g., to create a web translator:

new Zotero.Translate.Web();

Changes in Zotero Standalone (not yet implemented)

Changes to translators

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 must be avoided. This includes “for each” loops, array comprehension, E4X, and several other structures.
  • Zotero.Utilities.retrieveDocument() and Zotero.Utilities.retrieveSource() should be avoided if possible. The former is unlikely to work outside of Firefox, while the latter may freeze the browser interface during operation. Zotero.Utilities.processDocuments() and Zotero.Utilities.HTTP.doGet() will continue to be available.
  • Translate.getTranslatorObject() should now be called with a callback function as an argument, which will receive the translator object when it is available.
  • 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.