期望实现一个新动作:添加新条目时,若检测到条目重复,则为新条目添加一个重复标签; #310
-
添加新条目时,若检测到条目重复,则为新条目添加一个重复标签,有没有大佬能实现一下; |
Beta Was this translation helpful? Give feedback.
Answered by
LumaFilter
Aug 24, 2024
Replies: 3 comments 3 replies
-
为什么不直接去【重复条目】窗口合并两个条目,而是添加这个标签呢?不太明白这个标签的作用 |
Beta Was this translation helpful? Give feedback.
1 reply
-
参考下面这个链接,代码几乎照抄的,所以注释什么的也没改: 实现如下: // Automatically detect duplicated items and add tags.
// @author northword
// @link https://github.com/windingwind/zotero-actions-tags/discussions/133
// @see https://github.com/northword/zotero-format-metadata/blob/main/src/modules/rules/item-no-duplicate.ts
const TAG_NAME = "REPLACE WITH YOUR TAG"
if (!item) {
return;
}
const itemID = item.id;
const duplicates = new Zotero.Duplicates("1");
const search = (await duplicates.getSearchObject());
const searchResult = await search.search();
if (searchResult.includes(itemID)) {
item.addTag(TAG_NAME, 1);
return;
} else {
return;
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
LumaFilter
-
This is a great idea. I never think about checking for duplicates, but this will make me aware. Thanks! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
参考下面这个链接,代码几乎照抄的,所以注释什么的也没改:
大佬的代码
实现如下:
事件:新建条目
操作: 自定义脚本
Data: