The code addition starts at https://github.com/retorquere/zotero-better-bibtex/blob/master/content/ItemPane.xul#L12
, but that's mostly done by the overlay, that won't work for the contextPane. The first thing I'd need to know is how to get called after that init runs. I usually do this with monkey-patches started from an overlay; that gives me a trigger whenever the pane is loaded, and I get access to `document`, but since contextPane is not loaded as a xul pane, I don't know where to start.
This goes more for more places in Zotero for me. I'm looking to convert to restartless, where I have the same problem with other panes that I currently start from an overlay.