Skip to content

Commit

Permalink
fix: remove conflict shortcut key 'ctrl+(0~9)'
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyu committed Feb 23, 2022
1 parent 0fc1b1f commit 2eed23f
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/builds
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ Rules with *Auto-Add* checked will be added automatically once new items are add
- Right-click menu
![rules](imgs/readme-settings-rightclickmenu.png)

- Shortcut keys
Ctrl+(1-9) for adding tag Group (1-9)
Alt+(1-9) for removing tag Group (1-9)
Ctrl+0 for adding *Auto-Add* tags
Alt+0 for removing *Auto-Add* tags
- Shortcut keys
Alt+(1-9) for adding/removing tag Group (1-9)
Alt+0 for adding/removing *Auto-Add* tags
![rules](imgs/readme-settings-shortcuts.png)

- Colorize tags for better experience
Expand Down
Binary file removed builds/zotero-tag-0.1.0.xpi
Binary file not shown.
17 changes: 9 additions & 8 deletions chrome/content/scripts/zoterotag.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,9 @@ Zotero.ZoteroTag = {
let shortcuts = [];
// init shortcuts
for(let i=0; i<=9; i++){
shortcuts.push({
id: String(i),
operation: 'add',
group: i,
modifiers: 'control',
key: String(i),
});
shortcuts.push({
id: String(i+10),
operation: 'remove',
operation: 'change',
group: i,
modifiers: 'alt',
key: String(i),
Expand Down Expand Up @@ -257,6 +250,14 @@ Zotero.ZoteroTag = {
else if (operation === 'remove'){
item.removeTag(tags[i]);
}
else if (operation === 'change'){
if (item.hasTag(tags[i])){
item.removeTag(tags[i]);
}
else {
item.addTag(tags[i], 1);
}
}
item.saveTx();
}
},
Expand Down
10 changes: 5 additions & 5 deletions chrome/locale/en-US/overlay.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
<!ENTITY zotero.zoterotag.rules.info.4.label "Split different tags by ','(comma) and manage them in one rule;">
<!ENTITY zotero.zoterotag.rules.info.5.label "Example: rule 2 contains 'tag1, tag2, tag3', and all three tags can be managed in rule 2.">
<!ENTITY zotero.zoterotag.help.shortcuts.caption.label "Shortcut Keys">
<!ENTITY zotero.zoterotag.help.shortcuts.add.label "The shortcut keys for adding a tag group to selected items: ctrl+1 (group 1), ctrl+2 (group 2), and so on.">
<!ENTITY zotero.zoterotag.help.shortcuts.remove.label "The shortcut keys for removing a tag group from selected items: alt+1 (group 1), alt+2 (group 2), and so on.">
<!ENTITY zotero.zoterotag.help.shortcuts.auto.label "ctrl+0 (add group auto), alt+0 (remove group auto).">
<!ENTITY zotero.zoterotag.help.shortcuts.add.label "Due to the Zotero 6.0+ update, the ctrl+(0~9) are no longer supported.">
<!ENTITY zotero.zoterotag.help.shortcuts.remove.label "The shortcut keys for adding/removing a tag group from selected items: alt+1 (group 1), alt+2 (group 2), and so on.">
<!ENTITY zotero.zoterotag.help.shortcuts.auto.label "alt+0 (add/remove group auto).">
<!ENTITY zotero.zoterotag.help.setcolor.caption.label "Colorize">
<!ENTITY zotero.zoterotag.help.setcolor.label "How to colorize my tags?">
<!ENTITY zotero.zoterotag.help.feedback.caption.label "Feedback">
<!ENTITY zotero.zoterotag.help.feedback.label "github">

<!ENTITY zotero.zoterotag.help.version.label "ZoteroTag VERSION 0.1.0">
<!ENTITY zotero.zoterotag.help.releasetime.label "2021-03-26 18:18:39">
<!ENTITY zotero.zoterotag.help.version.label "ZoteroTag VERSION 0.1.1">
<!ENTITY zotero.zoterotag.help.releasetime.label "2022-02-23 11:24:19">
10 changes: 5 additions & 5 deletions chrome/locale/zh-CN/overlay.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
<!ENTITY zotero.zoterotag.rules.info.4.label "用半角逗号(,)分隔不同标签,并在一条规则中同时管理它们;">
<!ENTITY zotero.zoterotag.rules.info.5.label "例如:规则2包含'tag1, tag2, tag3',则三个标签都将由规则2管理。">
<!ENTITY zotero.zoterotag.help.shortcuts.caption.label "快捷键">
<!ENTITY zotero.zoterotag.help.shortcuts.add.label "为选中项添加标签组快捷键: ctrl+1(组 1), ctrl+2(组 2), 以此类推。">
<!ENTITY zotero.zoterotag.help.shortcuts.remove.label "从选中项删除标签组快捷键: alt+1(组 1), alt+2(组 2),以此类推。">
<!ENTITY zotero.zoterotag.help.shortcuts.auto.label "ctrl+0 (添加“自动添加”标签组), alt+0 (移除“自动添加”标签组)。">
<!ENTITY zotero.zoterotag.help.shortcuts.add.label "由于Zotero 6.0+更新, ctrl+(0~9) 快捷键将不再受到支持。">
<!ENTITY zotero.zoterotag.help.shortcuts.remove.label "从选中项添加/删除标签组快捷键: alt+1(组 1), alt+2(组 2),以此类推。">
<!ENTITY zotero.zoterotag.help.shortcuts.auto.label "alt+0 (添加/移除“自动添加”标签组)。">
<!ENTITY zotero.zoterotag.help.setcolor.caption.label "为标签添加颜色">
<!ENTITY zotero.zoterotag.help.setcolor.label "如何为标签添加颜色?">
<!ENTITY zotero.zoterotag.help.feedback.caption.label "意见反馈">
<!ENTITY zotero.zoterotag.help.feedback.label "github">

<!ENTITY zotero.zoterotag.help.version.label "ZoteroTag 版本 0.1.0">
<!ENTITY zotero.zoterotag.help.releasetime.label "2021-03-26 18:18:39">
<!ENTITY zotero.zoterotag.help.version.label "ZoteroTag 版本 0.1.1">
<!ENTITY zotero.zoterotag.help.releasetime.label "2022-02-23 11:24:19">
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="zoterotag@euclpts.com"
em:name="Zotero Tag"
em:version="0.1.0"
em:version="0.1.1"
em:type="2"
em:creator="windingwind"
em:description="Zotero plugin for automatically add tag for an added item."
Expand Down
3 changes: 1 addition & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ all: builddir clean
ifdef VERSION
awk '/em:version=/ { $$0=" em:version=\"${VERSION}\""} { print }' install.rdf > install.rdf.temp && mv install.rdf.temp install.rdf
awk '/<em:version>/ { $$0=" <em:version>${VERSION}</em:version>"} { print }' update.rdf > update.rdf.temp && mv update.rdf.temp update.rdf
awk '/<em:updateLink>/ { $$0=" <em:updateLink>https://github.com/windingwind/zotero-tag/releases/download/v${VERSION}/zotero-tag-${VERSION}.xpi</em:updateLink>"} { print }' update.rdf > update.rdf.temp && mv update.rdf.temp update.rdf
awk '/<!ENTITY zotero.zoterotag.help.version.label/ { $$0="<!ENTITY zotero.zoterotag.help.version.label \"ZoteroTag 版本 ${VERSION}\">"} { print }' chrome/locale/zh-CN/overlay.dtd > chrome/locale/zh-CN/overlay.dtd.temp && mv chrome/locale/zh-CN/overlay.dtd.temp chrome/locale/zh-CN/overlay.dtd
awk '/<!ENTITY zotero.zoterotag.help.version.label/ { $$0="<!ENTITY zotero.zoterotag.help.version.label \"ZoteroTag VERSION ${VERSION}\">"} { print }' chrome/locale/en-US/overlay.dtd > chrome/locale/en-US/overlay.dtd.temp && mv chrome/locale/en-US/overlay.dtd.temp chrome/locale/en-US/overlay.dtd
awk '/<!ENTITY zotero.zoterotag.help.releasetime.label/ { $$0="<!ENTITY zotero.zoterotag.help.releasetime.label \"${COMPILE_TIME}\">"} { print }' chrome/locale/zh-CN/overlay.dtd > chrome/locale/zh-CN/overlay.dtd.temp && mv chrome/locale/zh-CN/overlay.dtd.temp chrome/locale/zh-CN/overlay.dtd
awk '/<!ENTITY zotero.zoterotag.help.releasetime.label/ { $$0="<!ENTITY zotero.zoterotag.help.releasetime.label \"${COMPILE_TIME}\">"} { print }' chrome/locale/en-US/overlay.dtd > chrome/locale/en-US/overlay.dtd.temp && mv chrome/locale/en-US/overlay.dtd.temp chrome/locale/en-US/overlay.dtd
zip -r builds/zotero-tag-${VERSION}.xpi chrome/* chrome.manifest install.rdf
zip -r builds/zotero-tag.xpi chrome/* chrome.manifest install.rdf
else
$(error VERSION variable not defined. Please define it.)
endif
Expand Down
6 changes: 3 additions & 3 deletions update.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
<rdf:Seq>
<rdf:li>
<rdf:Description>
<em:version>0.1.0</em:version>
<em:version>0.1.1</em:version>
<em:targetApplication>
<rdf:Description>
<em:id>zotero@chnm.gmu.edu</em:id>
<em:minVersion>5.0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
<em:updateLink>https://github.com/windingwind/zotero-tag/releases/download/v0.1.0/zotero-tag-0.1.0.xpi</em:updateLink>
<em:updateLink>https://github.com/windingwind/zotero-tag/releases/latest/download/zotero-tag.xpi</em:updateLink>
</rdf:Description>
</em:targetApplication>
<em:targetApplication>
<rdf:Description>
<em:id>juris-m@juris-m.github.io</em:id>
<em:minVersion>5.0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
<em:updateLink>https://github.com/windingwind/zotero-tag/releases/download/v0.1.0/zotero-tag-0.1.0.xpi</em:updateLink>
<em:updateLink>https://github.com/windingwind/zotero-tag/releases/latest/download/zotero-tag.xpi</em:updateLink>
</rdf:Description>
</em:targetApplication>
</rdf:Description>
Expand Down

0 comments on commit 2eed23f

Please sign in to comment.