Skip to content

Commit

Permalink
fix: unnecessary progress windows
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyu committed Mar 10, 2022
1 parent 66d20cf commit 4da9522
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is an add-on for [Zotero](https://www.zotero.org/) that enables automatic a
# Quick Start Guide

## Install
- Download the latest release (.xpi file) from the [Releases Page](https://github.com/windingwind/zotero-tag/releases)
- Download the latest release (.xpi file) from the [Releases Page](https://github.com/windingwind/zotero-tag/releases)
*Note* If you're using Firefox as your browser, right click the xpi and select "Save As.."
- In Zotero click "Tools" in the top menu bar and then click "Addons"
- Go to the Extensions page and then click the gear icon in the top right.
Expand All @@ -15,9 +15,11 @@ This is an add-on for [Zotero](https://www.zotero.org/) that enables automatic a
## Usage
Once you have the plugin installed simply, right click any item in your collections.
There will now be a new context menu option titled "Update Tag". Once you
click this, tags will be added to selected items or collections.
click this, `auto-add` tags(default `/unread`) will be added to selected items or collections.

For any new papers you add after this plugin is installed, the plugin will automatically add tags.
For any new papers you add after this plugin is installed, `auto-add` tags will be auto-added.

Since v0.1.2, `auto-remove` tags after read is supported. For previous users, auto-add tags will be removed after read by default. If you don't want this behavior, please modify rules in the Preference menu.

Settings can be found in the Preference menu.

Expand Down
12 changes: 9 additions & 3 deletions chrome/content/scripts/zoterotag.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,14 @@ Zotero.ZoteroTag = {
// Object.keys(items).forEach(function(key){
// Zotero.debug(items[key])
// });

Zotero.ZoteroTag._updateCount = 0;
items.forEach(function (val, idx) {
Zotero.debug(val);
Zotero.ZoteroTag.updateItem(val, operation, tags);
});
if (Zotero.ZoteroTag._updateCount == 0) {
return;
}
if (operation == "change" && items.length == 1 && tags.length == 1) {
operation = items[0].hasTag(tags[0]) ? "remove" : "add";
}
Expand All @@ -323,16 +326,19 @@ Zotero.ZoteroTag = {
Zotero.debug("ZoteroTag: Updating item: " + JSON.stringify(item));
Zotero.debug(operation, tags);
for (let i = 0; i < tags.length; ++i) {
if (operation === "add") {
if (operation === "add" && !item.hasTag(tags[i])) {
item.addTag(tags[i], 1);
} else if (operation === "remove") {
Zotero.ZoteroTag._updateCount += 1;
} else if (operation === "remove" && item.hasTag(tags[i])) {
item.removeTag(tags[i]);
Zotero.ZoteroTag._updateCount += 1;
} else if (operation === "change") {
if (item.hasTag(tags[i])) {
item.removeTag(tags[i]);
} else {
item.addTag(tags[i], 1);
}
Zotero.ZoteroTag._updateCount += 1;
}
item.saveTx();
}
Expand Down
2 changes: 1 addition & 1 deletion chrome/locale/en-US/overlay.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
<!ENTITY zotero.zoterotag.help.feedback.label "github">

<!ENTITY zotero.zoterotag.help.version.label "ZoteroTag VERSION 0.1.1">
<!ENTITY zotero.zoterotag.help.releasetime.label "2022-03-10 18:20:15">
<!ENTITY zotero.zoterotag.help.releasetime.label "2022-03-10 18:38:34">
2 changes: 1 addition & 1 deletion chrome/locale/zh-CN/overlay.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
<!ENTITY zotero.zoterotag.help.feedback.label "github">

<!ENTITY zotero.zoterotag.help.version.label "ZoteroTag 版本 0.1.1">
<!ENTITY zotero.zoterotag.help.releasetime.label "2022-03-10 18:20:15">
<!ENTITY zotero.zoterotag.help.releasetime.label "2022-03-10 18:38:34">
2 changes: 1 addition & 1 deletion update.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
</rdf:Seq>
</em:updates>
</rdf:Description>
</rdf:RDF>
</rdf:RDF>

0 comments on commit 4da9522

Please sign in to comment.