We’re in the process of updating the documentation for Zotero 5.0. Some documentation may be outdated in the meantime. Thanks for your understanding.
Modifying Zotero Files
Since Zotero is open-source software, you can make changes to the code yourself to add new features or adjust the behavior of current ones.
Most of the Zotero code is stored within the zotero.jar file in the chrome folder of the Zotero extension directory, located in the extensions subdirectory of the Firefox profile. JAR files in Firefox are simply ZIP files, so you can extract the contents using any unzipping program, edit the files, and zip them back up. For performance reasons, it’s best not to use compression when zipping the files.
Note that any changes you make to Zotero code will be lost the next time you upgrade to a new version, so be sure to make copies of your changes—or better yet, create diff files so that you can more quickly patch new versions. You can also submit patches on the dev list for potential inclusion in future builds of Zotero. Many changes can also be implemented as separate Firefox extensions that either modify parts of Zotero or add new functionality using the Zotero Notifier and data API. For more information, see Interacting with Zotero from Within Firefox.
A basic modification
Here's how you'd change the keystroke used to activate the Zotero pane using Terminal on a Mac. (The keystroke can be changed in the Zotero preferences, but this is an example of a simple change.)
% cd ~/Library/Application\ Support/Firefox/Profiles/ % ls -la drwxr-xr-x 10 dan staff 340 Oct 7 11:24 . drwxr-xr-x 6 dan staff 204 Feb 15 2006 .. drwx------ 51 dan staff 1734 Oct 16 01:18 d2xizht4.2.0 drwx------ 59 dan staff 2006 Oct 8 21:47 ng6qa73p.1.5 drwx------ 32 dan staff 1088 Oct 13 17:46 oh3nnxos.Test drwx------ 32 dan staff 1088 Oct 14 20:43 sfwx9etk.Trunk drwx------ 33 dan staff 1122 Mar 24 2006 u28ujoyh.1.0
(Note that the profile directory is a random string—yours will be different from the example.)
% cd email@example.com/chrome % unzip zotero.jar creating: content/ creating: content/zotero/ extracting: content/zotero/about.xul extracting: content/zotero/addCitationDialog.js extracting: content/zotero/addCitationDialog.xul extracting: content/zotero/bibliography.js ...etc... % vi content/zotero/overlay.xul
Modify the file as desired. For this example, we'll change the key attribute of the <key> element at the bottom of the overlay.xul file from “Z” to “O”.
<keyset id="mainKeyset"> <key id="key_openZotero" key="O" oncommand="ZoteroPane.toggleDisplay();" modifiers="alt accel" /> </keyset>
When you're done, save the file. Delete the old jar file, zip the files without compression (the -0 flag for the zip command) into a new jar in the parent directory, remove the unzipped directories, and move the jar back into place.
% rm zotero.jar % zip -r0 ../zotero.jar * adding: content/ (stored 0%) adding: content/zotero/ (stored 0%) adding: content/zotero/about.xul (stored 0%) adding: content/zotero/addCitationDialog.js (stored 0%) adding: content/zotero/addCitationDialog.xul (stored 0%) ...etc... % rm -rf content locale skin % mv ../zotero.jar .
That's it. The next time you start up Firefox, you can open the Zotero pane with command-option-o instead of command-option-z.
Note: Running Zotero from a Git clone is the recommended practice for long-term development.
The above approach is fine for quick changes that don't require testing. However, for more involved changes, you'll want to tell Zotero to run using the uncompressed files rather than the jar file.1) This can be done by editing the paths in the first three lines of chrome.manifest in the root of the Zotero extension directory.
content zotero jar:chrome/zotero.jar!/content/zotero/ locale zotero en-US jar:chrome/zotero.jar!/locale/en-US/zotero/ skin zotero default jar:chrome/zotero.jar!/skin/default/zotero/ overlay chrome://browser/content/browser.xul chrome://zotero/content/overlay.xul overlay chrome://browser/content/browser.xul chrome://zotero/content/ingester/browser.xul style chrome://browser/content/browser.xul chrome://zotero/skin/zotero.css style chrome://global/content/customizeToolbar.xul chrome://zotero/skin/zotero.css
content zotero chrome/content/zotero/ locale zotero en-US chrome/locale/en-US/zotero/ skin zotero default chrome/skin/default/zotero/ overlay chrome://browser/content/browser.xul chrome://zotero/content/overlay.xul overlay chrome://browser/content/browser.xul chrome://zotero/content/ingester/browser.xul style chrome://browser/content/browser.xul chrome://zotero/skin/zotero.css style chrome://global/content/customizeToolbar.xul chrome://zotero/skin/zotero.css