This commit is contained in:
Tom Najdek 2026-08-21 21:21:48 +02:00 committed by GitHub
commit 2b099a5298
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 37 additions and 0 deletions

View file

@ -41,6 +41,7 @@
<radio id="save-as-rtf" data-l10n-id="bibliography-outputMethod-saveAsRTF"/>
<radio id="save-as-html" data-l10n-id="bibliography-outputMethod-saveAsHTML"/>
<radio id="copy-to-clipboard" data-l10n-id="bibliography-outputMethod-copyToClipboard"/>
<radio id="save-to-zbib" data-l10n-id="bibliography-outputMethod-saveToZbib" />
<radio id="print" data-l10n-id="bibliography-outputMethod-print"/>
</radiogroup>
</groupbox>

View file

@ -981,6 +981,39 @@ var Zotero_File_Interface = new function () {
fStream.write(bibliography, bibliography.length);
fStream.close();
}
} else if (io.method == 'save-to-zbib') {
const zbibStoreURL = 'https://v1snar4wu4.execute-api.us-east-1.amazonaws.com/1';
let itemsJSON = items.map(item => item.toJSON());
let data = {
title: Zotero.ftl.formatValueSync('bibliography-zbib-title'),
citationStyle: io.style.replace('http://www.zotero.org/styles/', ''),
items: itemsJSON
};
try {
let req = await Zotero.HTTP.request(
"POST",
zbibStoreURL,
{
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(data)
}
);
if (req.status != 200) {
throw new Error(`Zotero.Bibliography: Received status ${req.status} from zbib store`);
}
let resp = JSON.parse(req.response);
let zbibURL = `https://zbib.org/${resp.key}`;
Zotero.launchURL(zbibURL);
} catch (e) {
Zotero.alert(
null,
Zotero.getString('general.error'),
Zotero.getString('fileInterface.bibliographyGenerationError')
);
throw (e);
}
}
}

View file

@ -538,9 +538,12 @@ bibliography-outputMethod-saveAsHTML =
.label = Save as HTML
bibliography-outputMethod-copyToClipboard =
.label = Copy to Clipboard
bibliography-outputMethod-saveToZbib =
.label = Save to ZoteroBib
bibliography-outputMethod-print =
.label = Print
bibliography-manageStyles-label = Manage Styles…
bibliography-zbib-title = Saved from Zotero
styleEditor-locatorType =
.aria-label = Locator type