Yeah, this isn't listed on those pages - I looked there first. But I also didn't see any other doc on an API for monkey patching, which is why I wrote the post. I dug a bit into the Zotero source code last night but finding stuff was difficult.
The AI suggests something like this inside startup()
patchCiteProc() {
if (!Zotero.CiteProc || !Zotero.CiteProc.System) return;
const self = this;
// --- PATCH 1: Inject Custom Fields ---
this.originalRetrieveItem = Zotero.CiteProc.System.prototype.retrieveItem;
Zotero.CiteProc.System.prototype.retrieveItem = function (id) {
let itemData = self.originalRetrieveItem.apply(this, arguments);
And then later something like this to intercept abbreviations
this.originalGetAbbreviation = Zotero.CiteProc.System.prototype.getAbbreviation;
Zotero.CiteProc.System.prototype.getAbbreviation = function (styleID, abbrevs, name, category, itemData) {
And later this to intercept the style creation to load different case styles
this.originalRetrieveStyleModule = Zotero.CiteProc.System.prototype.retrieveStyleModule;
Zotero.CiteProc.System.prototype.retrieveStyleModule = function (jurisdiction, preference) {
As far as I can tell through debug logs, none of these get fired, ever. I didn't think to get rid of
if (!Zotero.CiteProc || !Zotero.CiteProc.System) return; - maybe that's the issue. But any other input on if this monkey patching is even feasible, I would appreciate it.