188BET靠谱吗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.188BET靠谱吗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:
188BET靠谱吗Zotero-show-item-key/
├── chrome/
│ └── content/
188BET靠谱吗│ └── zotero-show-item-key.js
└── manifest.json
manifest.json with the following content
{
"manifest_version": 2,
188BET靠谱吗"name": "Zotero Show Item Key",
"version": "1.0",
188BET靠谱吗"description": "Displays the item key in the Zotero Info panel",
"applications": {
"gecko": {
188BET靠谱吗"id": "show-item-key@zotero.org"
}
},
"content_scripts": [
{
188BET靠谱吗"matches": ["*://*.zotero.org/*"],
188BET靠谱吗"js": ["chrome/content/zotero-show-item-key.js"]
}
]
}
188BET靠谱吗zotero.show-item.key.js with the following content
window.addEventListener('load', function () {
188BET靠谱吗const updateInfoPane = ZoteroPane_Local.prototype.updateInfoPane;
188BET靠谱吗ZoteroPane_Local.prototype.updateInfoPane = function () {
updateInfoPane.apply(this, arguments);
188BET靠谱吗const item = ZoteroPane.getSelectedItems()[0];
if (!item) return;
const itemKey = item.key;
188BET靠谱吗const infoBox = document.getElementById('zotero-editpane-item-box');
if (!infoBox) return;
188BET靠谱吗let keyField = document.getElementById('zotero-info-item-key');
if (!keyField) {
keyField = document.createElement('div');
188BET靠谱吗keyField.id = 'zotero-info-item-key';
keyField.className = 'item-element';
infoBox.appendChild(keyField);
}
keyField.textContent = 'Key: ' + itemKey;
};
}, false);
188BET靠谱吗I always get the following error in Zotero error console
188BET靠谱吗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.
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.188BET靠谱吗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:
188BET靠谱吗Zotero-show-item-key/
├── chrome/
│ └── content/
188BET靠谱吗│ └── zotero-show-item-key.js
└── manifest.json
manifest.json with the following content
{
"manifest_version": 2,
188BET靠谱吗"name": "Zotero Show Item Key",
"version": "1.0",
188BET靠谱吗"description": "Displays the item key in the Zotero Info panel",
"applications": {
"gecko": {
188BET靠谱吗"id": "show-item-key@zotero.org"
}
},
"content_scripts": [
{
188BET靠谱吗"matches": ["*://*.zotero.org/*"],
188BET靠谱吗"js": ["chrome/content/zotero-show-item-key.js"]
}
]
}
188BET靠谱吗zotero.show-item.key.js with the following content
window.addEventListener('load', function () {
188BET靠谱吗const updateInfoPane = ZoteroPane_Local.prototype.updateInfoPane;
188BET靠谱吗ZoteroPane_Local.prototype.updateInfoPane = function () {
updateInfoPane.apply(this, arguments);
188BET靠谱吗const item = ZoteroPane.getSelectedItems()[0];
if (!item) return;
const itemKey = item.key;
188BET靠谱吗const infoBox = document.getElementById('zotero-editpane-item-box');
if (!infoBox) return;
188BET靠谱吗let keyField = document.getElementById('zotero-info-item-key');
if (!keyField) {
keyField = document.createElement('div');
188BET靠谱吗keyField.id = 'zotero-info-item-key';
keyField.className = 'item-element';
infoBox.appendChild(keyField);
}
keyField.textContent = 'Key: ' + itemKey;
};
}, false);
188BET靠谱吗I always get the following error in Zotero error console
188BET靠谱吗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.
-
filipesb90188BET靠谱吗I forgot to add that I then made a .zip of the directory, changed extension to .xpi and tried to install the .xpi file in Zotero Tools > Plugins > Install Addon from file
-
poettliProbably better to post here: 188BET靠谱吗https://groups.google.com/g/zotero-dev