If the list is relatively small (in the hundreds of kilobytes) then it
might be suitable for inclusion in a translator. If not, it might be
worth considering whether it's possible to create or convince Cornell
to create a simple web-facing lookup API that could be used without a
plugin. However, if neither of these things are feasible, the
translators are run on the main thread, and a plugin could run SQL
either synchronously on the main thread (which is not recommended
because it will hang the Firefox UI, although Zotero does it in plenty
of places) or asynchronously with a callback. Exposing something to
the translator sandbox is easy:
var Zotero = Components.classes["@
zotero.org/Zotero;1"]
.getService(Components.interfaces.nsISupports).wrappedJSObject;
Zotero.Utilities.Translate.prototype.myFunction =
function(some,arguments,here) {
// Do something
}
Creating a function that takes a callback is a little more
complicated, because Zotero.Translate needs to know that translation
isn't done until the callback completes, but it's not difficult. If
you'd like some example code,
Zotero.Utilities.Translate.prototype.doPost is a thin wrapper around
Zotero.HTTP.doPost that does this and not much else.
Simon