Issues trying to display item 'key' value on the right side Info panel of Zotero 7 Beta

Hi,

I was trying to write a simple .xpi extension (with the assistance of ChatGPT 4o) just to display the specific 'key' value in addition to the other fields. By displaying this value, I can make it easier to reference a given paper in my notes app and also to retrieve it on Zotero search function.

I created the directory structure:

Zotero-show-item-key/
├── chrome/
│ └── content/
│ └── zotero-show-item-key.js
└── manifest.json

manifest.json with the following content

{
"manifest_version": 2,
"name": "Zotero Show Item Key",
"version": "1.0",
"description": "Displays the item key in the Zotero Info panel",
"applications": {
"gecko": {
"id": "show-item-key@zotero.org"
}
},
"content_scripts": [
{
"matches": ["*://*.zotero.org/*"],
"js": ["chrome/content/zotero-show-item-key.js"]
}
]
}

zotero.show-item.key.js with the following content

window.addEventListener('load', function () {
const updateInfoPane = ZoteroPane_Local.prototype.updateInfoPane;
ZoteroPane_Local.prototype.updateInfoPane = function () {
updateInfoPane.apply(this, arguments);

const item = ZoteroPane.getSelectedItems()[0];
if (!item) return;

const itemKey = item.key;

const infoBox = document.getElementById('zotero-editpane-item-box');
if (!infoBox) return;

let keyField = document.getElementById('zotero-info-item-key');
if (!keyField) {
keyField = document.createElement('div');
keyField.id = 'zotero-info-item-key';
keyField.className = 'item-element';
infoBox.appendChild(keyField);
}

keyField.textContent = 'Key: ' + itemKey;
};
}, false);


I always get the following error in Zotero error console

1716636456021 addons.xpi WARN Invalid XPI: Error: File C:\Users\fbm\Desktop\zotero-show-item-key.xpi does not contain a valid manifest(resource://gre/modules/addons/XPIInstall.jsm:685:11) JS Stack trace: loadManifest@XPIInstall.jsm:685:11

Can anyone figure out what's wrong with it and how it might be fixed?

Thank you.
Sign In or Register to comment.