Skip to content

Commit

Permalink
Improve format in which citations are presented
Browse files Browse the repository at this point in the history
Show citation count as first item on a line, which makes it easier to see
  • Loading branch information
eschnett committed Nov 23, 2020
1 parent b9b8294 commit 6c05c28
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ source management tool. The add-on can auto-fetch citation counts for
journal articles using various APIs, including
[Crossref](https://www.crossref.org), [Inspire
HEP](https://inspirehep.net),
[NASA/ADS](https://ui.adsabs.harvard.edu), and [Semantic
<!-- [NASA/ADS](https://ui.adsabs.harvard.edu), -->
and [Semantic
Scholar](https://www.semanticscholar.org). [Google
Scholar](https://scholar.google.com) is not supported because
automated access is against its terms of service.
Expand All @@ -34,7 +35,7 @@ Code for this extension is based on the [Zotero DOI
- Run Zotero (version 5.x)
- Go to `Tools -> Add-ons`
- `Install Add-on From File`
- Choose the file `zotero-citationcounts-1.0.0.xpi`
- Choose the file `zotero-citationcounts-1.1.0.xpi`
- Restart Zotero

## License
Expand Down
8 changes: 7 additions & 1 deletion bin/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/sh

version='1.0.0'
version='1.1.0'

rm -f zotero-citationcounts-${version}.xpi
zip -r zotero-citationcounts-${version}.xpi chrome/* defaults/* chrome.manifest install.rdf

# 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
11 changes: 7 additions & 4 deletions chrome/content/scripts/zoterocitationcounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ function setCitationCount(item, tag, count) {
extra = "";
}
let extras = extra.split("\n");
const patt = new RegExp("^Citations \\(" + tag + "\\):", "i");
// Keep old patterns around when updating the format
const patt1 = new RegExp("^Citations \\(" + tag + "\\):", "i");
const patt2 = new RegExp("^\\d+ citations \\(" + tag + "\\)", "i");
// Remove old count
extras = extras.filter(ex => !patt.test(ex));
extras = extras.filter(ex => !patt1.test(ex) && !patt2.test(ex));
const today = new Date();
const dd = String(today.getDate()).padStart(2, '0');
const mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
const mm = String(today.getMonth() + 1).padStart(2, '0'); // January is 0!
const yyyy = today.getFullYear();
const date = yyyy + '-' + mm + '-' + dd
extras.push("Citations (" + tag + "): " + count + " [" + date + "]");
// extras.push("Citations (" + tag + "): " + count + " [" + date + "]");
extras.push("" + count + " citations (" + tag + ") [" + date + "]");
extra = extras.join("\n");
item.setField('extra', extra);
}
Expand Down
2 changes: 1 addition & 1 deletion install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
RDF:about="urn:mozilla:install-manifest"
em:id="[email protected]"
em:name="Zotero Citation Counts Manager"
em:version="1.0.0"
em:version="1.1.0"
em:type="2"
em:creator="Erik Schnetter"
em:description="Automatically fetch and update citation counts"
Expand Down
4 changes: 2 additions & 2 deletions update.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<rdf:Seq>
<rdf:li>
<rdf:Description>
<em:version>1.0.0</em:version>
<em:version>1.1.0</em:version>
<em:targetApplication>
<rdf:Description>
<em:id>[email protected]</em:id>
<em:minVersion>5.0</em:minVersion>
<em:maxVersion>5.*</em:maxVersion>
<em:updateLink>https://github.com/eschnett/zotero-citationcounts/releases/download/v1.0.0/zotero-citationcounts-1.0.0.xpi</em:updateLink>
<em:updateLink>https://github.com/eschnett/zotero-citationcounts/releases/download/v1.1.0/zotero-citationcounts-1.1.0.xpi</em:updateLink>
</rdf:Description>
</em:targetApplication>
</rdf:Description>
Expand Down

0 comments on commit 6c05c28

Please sign in to comment.