Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Zotero 7 Citation Counts Manager Enhaned
# Zotero 8 Citation Counts Manager

- [GitHub](https://github.com/FrLars21/ZoteroCitationCountsManager): Source
code repository
Expand All @@ -12,7 +12,7 @@ Please report any bugs, questions, or feature requests in the Github repository.
- Autoretrieve citation counts when a new item is added to your Zotero library.
- Retrieve citation counts manually by right-clicking on one or more items in your Zotero library.
- Works with the following APIs: [Crossref](https://www.crossref.org), [INSPIRE-HEP](https://inspirehep.net) and [Semantic Scholar](https://www.semanticscholar.org).
- _NEW:_ The plugin is compatible with **Zotero 7** (Zotero 6 is **NOT** supported!).
- _NEW:_ The plugin is compatible with **Zotero 8**.
- _NEW:_ The plugin registers a custom column ("Citation Counts") in your Zotero library so that items can be **ordered by citation count**.
- _NEW:_ Improved _citation count retrieval operation_ status reporting, including item-specific error messages for those items where a citation count couldn't be retrieved.
- _NEW:_ Concurrent citation count retrieval operations is now possible. Especially important for the autoretrieve feature.
Expand All @@ -21,17 +21,17 @@ Please report any bugs, questions, or feature requests in the Github repository.

## Acknowledgements

This plugin is a refactored and enhanced version of Erik Schnetter's [Zotero Citations Counts Manager](https://github.com/eschnett/zotero-citationcounts) for Zotero 7. Code for that extension was based on [Zotero DOI Manager](https://github.com/bwiernik/zotero-shortdoi), which is based in part on [Zotero Google Scholar Citations](https://github.com/beloglazov/zotero-scholar-citations) by Anton Beloglazov.
This plugin is a refactored and enhanced version of Erik Schnetter's [Zotero Citations Counts Manager](https://github.com/eschnett/zotero-citationcounts). Code for that extension was based on [Zotero DOI Manager](https://github.com/bwiernik/zotero-shortdoi), which is based in part on [Zotero Google Scholar Citations](https://github.com/beloglazov/zotero-scholar-citations) by Anton Beloglazov.
Boilerplate for this plugin was based on Zotero's sample plugin for v7 [Make-It-Red](https://github.com/zotero/make-it-red).

## Installing

- Download the add-on (the .xpi file) from the latest release: https://github.com/FrLars21/ZoteroCitationCountsManager/releases
- To download the .xpi file, right click it and select 'Save link as'
- Run Zotero (version 7.x)
- Run Zotero (version 8.x)
- Go to `Tools -> Add-ons`
- `Install Add-on From File`
- Choose the file `zoterocitationcountsmanager-2.0.0.xpi`
- Choose the file `zoterocitationcountsmanager-2.1.xpi`
- Restart Zotero

## License
Expand Down
6 changes: 3 additions & 3 deletions bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

cd ..

version='2.0'
version='2.2'

rm -f zoterocitationcountsmanager-${version}.xpi
zip -r zoterocitationcountsmanager-${version}.xpi locale/* manifest.json bootstrap.js preferences.js preferences.xhtml prefs.js zoterocitationcounts.js
zip -r zoterocitationcountsmanager-${version}.xpi locale/* icons/* manifest.json bootstrap.js preferences.xhtml prefs.js zoterocitationcounts.js

# To release a new version:
# - increase version number in all files (not just here)
# - run this script to create a new .xpi file
# - commit and push to Github
# - make a release on Github, and manually upload the new .xpi file
# - make a release on Github, and manually upload the new .xpi file
37 changes: 32 additions & 5 deletions bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
let ZoteroCitationCounts, itemObserver;

var chromeHandle;

async function startup({ id, version, rootURI }) {
Services.scriptloader.loadSubScript(rootURI + "zoterocitationcounts.js");

var aomStartup = Cc["@mozilla.org/addons/addon-manager-startup;1"]
.getService(Ci.amIAddonManagerStartup);
var manifestURI = Services.io.newURI(rootURI + "manifest.json");

chromeHandle = aomStartup.registerChrome(manifestURI, [
["content", "citationcounts", "./"],
]);

Services.scriptloader.loadSubScript(rootURI + "zoterocitationcounts.js");
ZoteroCitationCounts.init({ id, version, rootURI });
ZoteroCitationCounts.addToAllWindows();

Zotero.PreferencePanes.register({
pluginID: id,
label: await ZoteroCitationCounts.l10n.formatValue(
"citationcounts-preference-pane-label"
),
image: ZoteroCitationCounts.icon("edit-list-order", false),
src: "preferences.xhtml",
scripts: ["preferences.js"],
image: rootURI + 'icons/icon.png',
src: "preferences.xhtml"
});

await Zotero.ItemTreeManager.registerColumns({
Expand All @@ -22,7 +30,12 @@ async function startup({ id, version, rootURI }) {
"citationcounts-column-title"
),
pluginID: id,
flex: 0,
width: "100px",
minWidth: 45,
staticWidth: true,
dataProvider: (item) => ZoteroCitationCounts.getCitationCount(item),
zoteroPersist: ['width', 'hidden', 'sortDirection'], // persist the column properties
});

itemObserver = Zotero.Notifier.registerObserver(
Expand Down Expand Up @@ -55,4 +68,18 @@ function shutdown() {
ZoteroCitationCounts.removeFromAllWindows();
Zotero.Notifier.unregisterObserver(itemObserver);
ZoteroCitationCounts = undefined;

if (chromeHandle) {
chromeHandle.destruct();
chromeHandle = null;
}
}

function uninstall() {

}

function install() {

}

Binary file added icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions icons/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon@x2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion locale/en-US/citation-counts.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ citationcounts-preferences-pane-autoretrieve-api =
.label = { $api }
citationcounts-preferences-pane-autoretrieve-api-none =
.label = No
citationcounts-preferences-pane-missing-doi-title = Missing DOI Search Strategy (Crossref):
citationcounts-preferences-pane-missing-doi-strategy =
.label = Try title-based search (results may be inaccurate)

## Misc
citationcounts-internal-error = Internal error
citationcounts-internal-error = Internal error

40 changes: 40 additions & 0 deletions locale/zh-CN/citation-counts.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## For the custom column that the plugin registers
citationcounts-column-title = 被引用量

## For the "Item" contextmenu, where citation counts can be manually retrieved for the selected items.
citationcounts-itemmenu-retrieve-title =
.label = 获取被引用量
citationcounts-itemmenu-retrieve-api =
.label = 从 { $api } 获取被引用量

## For the ProgressWindow, showing citation counts retrieval operation status
citationcounts-progresswindow-headline = 从 { $api } 获取被引用量
citationcounts-progresswindow-finished-headline = 从 { $api } 完成被引用量获取
citationcounts-progresswindow-error-no-doi = 文章信息中不存在Doi条目
citationcounts-progresswindow-error-no-arxiv = 文章信息中不存在arXiv id
citationcounts-progresswindow-error-no-doi-or-arxiv = 文章信息中不存在Doi条目和arXiv id
citationcounts-progresswindow-error-bad-api-response = 访问 { $api } API出现问题
citationcounts-progresswindow-error-no-citation-count = { $api } 中不存在该文章的被引用量数据

## For the "Tools" menu, where the "autoretrieve" preference can be set.
citationcounts-menutools-autoretrieve-title =
.label = 从新的文章条目中获取被引用量?
citationcounts-menutools-autoretrieve-api =
.label = { $api }
citationcounts-menutools-autoretrieve-api-none =
.label = 不获取

## For the plugins "Preferences" pane.
citationcounts-preference-pane-label = Citation count
citationcounts-preferences-pane-autoretrieve-title = 请选择获取被引用量的数据库来源
citationcounts-preferences-pane-autoretrieve-api =
.label = { $api }
citationcounts-preferences-pane-autoretrieve-api-none =
.label = 不获取
citationcounts-preferences-pane-missing-doi-title = 缺失 DOI 时的搜索策略 (Crossref)
citationcounts-preferences-pane-missing-doi-strategy =
.label = 按标题搜索(结果可能不准确)

## Misc
citationcounts-internal-error = 内部错误

10 changes: 7 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
"manifest_version": 2,
"name": "Zotero Citation Counts Manager",
"version": "2.0",
"description": "Enhanced Citation Counts Manager for Zotero 7",
"version": "2.2",
"description": "Citation Counts Manager for Zotero 8",
"homepage_url": "https://github.com/FrLars21/ZoteroCitationCountsManager",
"applications": {
"zotero": {
"id": "frlars21@github.com",
"update_url": "https://www.zotero.org/download/plugins/make-it-red/updates.json",
"strict_min_version": "6.999",
"strict_max_version": "7.0.*"
"strict_max_version": "8.*"
}
},
"icons": {
"48": "icons/icon.png",
"96": "icons/icon@x2.png"
}
}
73 changes: 0 additions & 73 deletions preferences.js

This file was deleted.

39 changes: 28 additions & 11 deletions preferences.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,35 @@
<html:link rel="localization" href="citation-counts.ftl" />
</linkset>

<vbox onload="ZoteroCitationCounts_Prefs.init()">
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">

<groupbox>
<label
><html:h2
data-l10n-id="citationcounts-preferences-pane-autoretrieve-title"
></html:h2
></label>
<radiogroup
id="citationcounts-preference-pane-autoretrieve-radiogroup"
preference="extensions.citationcounts.autoretrieve"
>
<!-- Radiobuttons are dynamically created by the script -->
<label>
<html:h2 data-l10n-id="citationcounts-preferences-pane-autoretrieve-title"></html:h2>
</label>

<radiogroup id="citationcounts-preference-pane-autoretrieve-radiogroup"
preference="extensions.citationcounts.autoretrieve">
<radio value="none"
data-l10n-id="citationcounts-preferences-pane-autoretrieve-api-none" />

<radio value="crossref" label="Crossref" />

<radio value="inspire" label="INSPIRE-HEP" />

<radio value="semanticscholar" label="Semantic Scholar" />
</radiogroup>
</groupbox>

<groupbox>
<label>
<html:h2 data-l10n-id="citationcounts-preferences-pane-missing-doi-title"></html:h2>
</label>

<checkbox preference="extensions.citationcounts.useTitleFallback"
data-l10n-id="citationcounts-preferences-pane-missing-doi-strategy" />
</groupbox>

</vbox>

1 change: 1 addition & 0 deletions prefs.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pref("extensions.citationcounts.autoretrieve", "none");
pref("extensions.citationcounts.useTitleFallback", false);
Loading