Skip to content

Upgrade to Zotero 7/8 with new citation sources and custom column - #47

Open
craighit wants to merge 2 commits into
eschnett:masterfrom
craighit:master
Open

Upgrade to Zotero 7/8 with new citation sources and custom column#47
craighit wants to merge 2 commits into
eschnett:masterfrom
craighit:master

Conversation

@craighit

Copy link
Copy Markdown

! Caution : All modifications are made by Cursor, may not be tested thoroughly

Summary

This PR upgrades the plugin from Zotero 6.x to Zotero 7/8, migrating the entire plugin architecture and adding new citation data sources.

Breaking Changes

  • Drops Zotero 6.x support. Minimum version is now 6.999 (i.e., Zotero 7+).

Architecture Migration (Zotero 6 → 7/8)

  • Replaced install.rdf with manifest.json (WebExtension-style metadata)
  • Replaced update.rdf with update.json
  • Removed chrome.manifest and all XUL overlay files (overlay.xul, options.xul)
  • Removed DTD locale files (no longer used in Zotero 7/8)
  • Removed defaults/preferences/prefs.js (prefs now managed via Zotero.Prefs API)
  • Added bootstrap.js as the plugin lifecycle entry point (startup, shutdown, install, uninstall)
  • All UI elements (right-click menus, progress windows) are now dynamically created via JavaScript instead of XUL overlays
  • Preferences are handled via an XHTML panel (preferences.xhtml) and a native prompt fallback

New Features

New Citation Data Sources

  • OpenAlex — Free, open, no API key required. Uses DOI with fallback to title search.
  • Google Scholar (via SerpAPI) — Requires a free API key from serpapi.com (100 free searches/month). Uses DOI or title for lookup.

Custom "Citations" Column

  • Registers a custom sortable column "Citations" in the Zotero items list via Zotero.ItemTreeManager.registerColumns()
  • Users can enable it by right-clicking the column header
  • Displays only the numeric citation count, extracted from the Extra field

Simplified Extra Field Format

  • Citation counts are now stored as Citations: N (e.g., Citations: 22) instead of the verbose 22 citations (Source) [2026-02-27] format
  • Old formats are automatically cleaned up when new counts are fetched

Preferences Dialog

  • Added SerpAPI key input via Tools menu → "Citation Counts Manager Preferences…"
  • Supports auto-retrieve source selection, tag customization, and API key management

Windows Build Support

  • Added bin/build.ps1 PowerShell build script using .NET System.IO.Compression.ZipArchive to ensure correct forward-slash paths in .xpi files (critical for Zotero's jar: URI loader)

Files Changed

Action File Description
Added manifest.json Plugin metadata (replaces install.rdf)
Added bootstrap.js Plugin lifecycle entry point
Added update.json Update manifest (replaces update.rdf)
Added chrome/content/preferences.xhtml Preferences UI
Added bin/build.ps1 Windows PowerShell build script
Modified chrome/content/scripts/zoterocitationcounts.js Core rewrite for Zotero 7/8 APIs + new sources
Modified bin/build.sh Updated file list for new structure
Modified README.md Updated docs for v2.0.0
Modified .gitignore Added cross-platform ignore rules
Deleted install.rdf, update.rdf, chrome.manifest Deprecated Zotero 6 files
Deleted chrome/content/overlay.xul, options.xul Deprecated XUL UI
Deleted chrome/locale/en-US/* Deprecated DTD locale files
Deleted defaults/preferences/prefs.js Deprecated prefs file

Testing

  • Tested on Zotero 8.0.3 on Windows 11
  • Verified: Crossref, Semantic Scholar, OpenAlex, and Google Scholar (SerpAPI) all return correct citation counts
  • Verified: Custom "Citations" column displays and sorts correctly
  • Verified: Preferences dialog saves and loads settings correctly
  • Verified: Both build.sh (Linux/macOS) and build.ps1 (Windows) produce valid .xpi files

Screenshots

  • set SerpAPI key dialog
image
  • get citations from various source
image

- Migrate from XUL overlay to bootstrap.js plugin architecture
- Replace install.rdf with manifest.json (Zotero 7/8 format)
- Replace XUL preference window with native Services.prompt dialog
- Dynamic UI injection via Zotero.ItemTreeManager and createXULElement
- Add OpenAlex data source (free, no API key needed)
- Add Google Scholar data source via SerpAPI (requires free API key)
- Add custom 'Citations' column in items list (sortable, shows only numbers)
- Simplify Extra field format to 'Citations: N' (clean, compact)
- Add Windows PowerShell build script (bin/build.ps1)
- Replace update.rdf with update.json
- Remove deprecated XUL overlays, chrome.manifest, DTD locale files
- Remove local Windows paths from README build instructions
- Add proper build instructions for both Linux/macOS (sh) and Windows (PowerShell)
- Update README with new data sources, custom column docs, and setup guide
- Update manifest.json description to include new data sources
- Add *.xht, .DS_Store, Thumbs.db to .gitignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants