### Install Dependencies with npm ci
Source: https://www.zotero.org/support/dev/translators
Installs project dependencies, including ESLint, for translator development. Run this command within your clone of the zotero/translators repository.
```bash
npm ci
```
--------------------------------
### Launch Zotero with Debug Logging on macOS
Source: https://www.zotero.org/support/reporting_problems
Execute this command in the Terminal to start Zotero with debug logging enabled.
```bash
/Applications/Zotero.app/Contents/MacOS/zotero -ZoteroDebug
```
--------------------------------
### Install Zotero via Terminal
Source: https://www.zotero.org/support/kb/installing_on_a_chromebook
Use these commands in the Linux terminal to install Zotero. Ensure Linux is set up on your Chromebook first. You can install Zotero or Zotero-beta.
```bash
curl -sL https://raw.githubusercontent.com/retorquere/zotero-deb/master/install.sh | sudo bash
sudo apt update
sudo apt install zotero # Or 'zotero-beta' to install the Zotoro 8 beta on an ARM Chromebook
```
--------------------------------
### Complex Service Description (Google Scholar)
Source: https://www.zotero.org/support/dev/creating_locate_engines_using_opensearch
This example demonstrates a more complex OpenSearch description for Google Scholar, utilizing various OpenURL and Zotero-specific fields for detailed search queries.
```xml
Google Scholar
Google Scholar Search Engine
http://scholar.google.com/favicon.ico
```
--------------------------------
### Create default applications file content
Source: https://www.zotero.org/support/kb/file_handling_issues
Template content for creating a new defaults.list file if it does not exist.
```text
[Default Applications]
application/pdf=kde4-okularApplication_pdf.desktop
```
--------------------------------
### Initialize Zotero Plugin and Observer
Source: https://www.zotero.org/support/dev/sample_plugin
Defines the Zotero.HelloWorldZotero object, initializes a database connection, and registers a notifier callback to track item changes.
```javascript
Zotero.HelloWorldZotero = {
DB: null,
init: function () {
// Connect to (and create, if necessary) helloworld.sqlite in the Zotero directory
this.DB = new Zotero.DBConnection('helloworld');
if (!this.DB.tableExists('changes')) {
this.DB.query("CREATE TABLE changes (num INT)");
this.DB.query("INSERT INTO changes VALUES (0)");
}
// Register the callback in Zotero as an item observer
var notifierID = Zotero.Notifier.registerObserver(this.notifierCallback, ['item']);
// Unregister callback when the window closes (important to avoid a memory leak)
window.addEventListener('unload', function(e) {
Zotero.Notifier.unregisterObserver(notifierID);
}, false);
},
insertHello: function() {
var data = {
title: "Zotero",
company: "Center for History and New Media",
creators: [
['Dan', 'Stillman', 'programmer'],
['Simon', 'Kornblith', 'programmer']
],
version: '1.0.1',
company: 'Center for History and New Media',
place: 'Fairfax, VA',
url: 'http://www.zotero.org'
};
Zotero.Items.add('computerProgram', data); // returns a Zotero.Item instance
},
// Callback implementing the notify() method to pass to the Notifier
notifierCallback: {
notify: function(event, type, ids, extraData) {
if (event == 'add' || event == 'modify' || event == 'delete') {
// Increment a counter every time an item is changed
Zotero.HelloWorldZotero.DB.query("UPDATE changes SET num = num + 1");
if (event != 'delete') {
// Retrieve the added/modified items as Item objects
var items = Zotero.Items.get(ids);
}
else {
var items = extraData;
}
// Loop through array of items and grab titles
var titles = [];
for each(var item in items) {
// For deleted items, get title from passed data
if (event == 'delete') {
titles.push(item.old.title ? item.old.title : '[No title]');
}
else {
titles.push(item.getField('title'));
}
}
if (!titles.length) {
return;
}
// Get the localized string for the notification message and
// append the titles of the changed items
var stringName = 'notification.item' + (titles.length==1 ? '' : 's');
switch (event) {
case 'add':
stringName += "Added";
break;
case 'modify':
stringName += "Modified";
break;
case 'delete':
stringName += "Deleted";
break;
}
var str = document.getElementById('hello-world-zotero-strings').
getFormattedString(stringName, [titles.length]) + ":\n\n" +
titles.join("\n");
}
alert(str);
}
}
};
// Initialize the plugin
window.addEventListener('load', function(e) { Zotero.HelloWorldZotero.init(); }, false);
```
--------------------------------
### Example COinS HTML spans
Source: https://www.zotero.org/support/dev/exposing_metadata/coins
These spans contain URL-encoded bibliographic metadata for journal articles and books, designed to be invisible to users while readable by Zotero.
```html
```
--------------------------------
### Launch Zotero with Debug Logging on Windows
Source: https://www.zotero.org/support/reporting_problems
Add the debug flag to the Zotero executable path in the Windows Run dialog.
```cmd
"C:\Program Files\Zotero\zotero.exe" -ZoteroDebug
```
--------------------------------
### Embedded Metadata Example (Highwire)
Source: https://www.zotero.org/support/dev/exposing_metadata
Use HTML meta tags with the Highwire vocabulary to embed bibliographic data. Ensure creators are listed in repeated or semicolon-separated tags.
```html
```
```html
```
--------------------------------
### Import ZOTERO_CONFIG
Source: https://www.zotero.org/support/dev/zotero_8_for_developers
ZOTERO_CONFIG must now be imported explicitly. Ensure it is imported before use.
```javascript
const { ZOTERO_CONFIG } = ChromeUtils.import("resource://gre/modules/ZoteroConfig.jsm");
console.log(ZOTERO_CONFIG.ZOTERO_LOCAL_CONFIG_FILE);
```
--------------------------------
### Open Zotero Profile Manager on Windows
Source: https://www.zotero.org/support/kb/multiple_profiles
Execute this command in the Windows Run dialog to access the Zotero Profile Manager for creating or managing profiles.
```batch
C:\Program Files (x86)\Zotero\zotero.exe -P
```
--------------------------------
### Format Date Ranges in Extra Field
Source: https://www.zotero.org/support/kb/item_types_and_fields
Dates entered in the 'Extra' field override Zotero's Date field and must be in ISO format. This example shows how to format a date range for the 'Issued' variable.
```text
Issued: 2001-12-15/2001-12-31
```
--------------------------------
### Add Citation Fields to Extra Field
Source: https://www.zotero.org/support/kb/item_types_and_fields
When Zotero item types lack necessary citation fields, add them to the 'Extra' field using the 'CSL Variable: Value' format. This example shows adding DOI, PMC ID, and Original Date.
```text
CSL Variable: Value
```
```text
DOI: 10.1128/AEM.02591-07
```
```text
Original Date: 1824
```
```text
PMCID: PMC3531190
```
--------------------------------
### Launch Zotero with Debug Logging on Linux
Source: https://www.zotero.org/support/reporting_problems
Run the Zotero executable from the terminal with the debug flag.
```bash
./zotero -ZoteroDebug
```
--------------------------------
### Locate Linux default applications file
Source: https://www.zotero.org/support/kb/file_handling_issues
Path to the configuration file managing default application associations on Linux.
```text
~/.local/share/applications/defaults.list
```
--------------------------------
### Open Specific Zotero Profile
Source: https://www.zotero.org/support/kb/multiple_profiles
Use the `-p` flag with the profile name to launch Zotero with a specific profile. This is useful for creating shortcuts.
```bash
zotero -p Work
```