Skip to content

Commit

Permalink
升级为0.0.19,将设置语言为en-US改为根据条目题目语言自动设置语言字段
Browse files Browse the repository at this point in the history
  • Loading branch information
redleafnew committed Nov 2, 2022
1 parent f7a375b commit e42a961
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[https://github.com/redleafnew/delitemwithatt/releases](https://github.com/redleafnew/delitemwithatt/releases)下载xpi,然后在Zotero或JurisM中通过Tools-Addons-Install Add-on From File安装。安装完成后在条目上右击会出现:`删除附件`,如果条目有附件,会出现四个子菜单,`删除附件和条目``仅删除所有附件``仅删除快照``仅删除笔记`,点击后条目包括附件、附件、快照或笔记会被删除(包括文件)。在分类上右击时会出现:`删除分类条目包括附件`,确认后会在删除分类的同时将分类中的条目包含附件删除,快照也认为是附件。**注意:删除时链接文件不进回收站,直接删除,请删除前备份**

2. 将所选条目语言字段设置为`en-US`
2. 根据条目标题语言将所选条目语言字段设置为`en-US``zh-CN`

3. 将附件导出。

Expand All @@ -19,7 +19,7 @@

Download xpi from [https://github.com/redleafnew/delitemwithatt/releases](https://github.com/redleafnew/delitemwithatt/releases), and click Tools-Addons-Install Add-on From File in Zotero or JurisM to install the extension. After the installation, right click the item(s) `Delete Attachment(s)` shows, if there is/are attachment(s) for the item(s), there will be four submenus, `Delete Attachment(s) and Item(s)`, `Delete All Attachment(s) only`, `Delete Snapshot(s) only`, `Delete Note(s) only`, when confirm, the item(s),attachment(s), the snapshot(s) or the note(s) will be deleted; right click the collection `Delete Collections with Attachments` shows, when confirm, the collection and the item(s) with attachment(s) in the selected collection will be deleted. Snapshot is also regarded as attachment. **Note: the linked files could not be restored, they will be removed directly, please backup before removing**.

2. Set the language field of selected items as `en-US`.
2. Set the language field of selected items as `en-US` or `zh-CN` according to the language of item title.

3. Export attachment(s).

Expand Down
6 changes: 4 additions & 2 deletions chrome/content/scripts/delitem.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,13 @@ Zotero.DelItem = {
chanLanForSel: async function () {
var zoteroPane = Zotero.getActiveZoteroPane();
var items = zoteroPane.getSelectedItems();

var pattern = new RegExp("[\u4E00-\u9FA5]+");
for (item of items) {
var title = item.getField("title");
var la = item.getField("language");
//if (la=="") { //如果为空则替换
item.setField("language", "en-US");
var lan = pattern.test(title)? 'zh-CN' : 'en-US';
item.setField("language", lan);
await item.saveTx();
//}
}
Expand Down
6 changes: 3 additions & 3 deletions chrome/locale/en-US/overlay.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<!ENTITY zotero.exp.att.tip "Export Attachment(s)">
<!-- 设置语言 -->
<!ENTITY zotero.chanlan-forempty.label "If the Language of Selected Item(s) Is Empty">
<!ENTITY zotero.chanlan-forsel.label "Set Language Field as en-US">
<!ENTITY zotero.chanlan.namehandler.label "Set Language as en-US">
<!ENTITY zotero.chanlan.Set.lan.to.en "Set Language Field of Selected Item(s) as en-US">
<!ENTITY zotero.chanlan-forsel.label "Set Language Field Automatically">
<!ENTITY zotero.chanlan.namehandler.label "Set Language Automatically">
<!ENTITY zotero.chanlan.Set.lan.to.en "Set Language Field of Selected Item(s) Accordint to Item Title Automatically">
<!-- 更新缩写 -->
<!ENTITY zotero.update.item.abb.label "Update Abbreviation">
<!ENTITY zotero.update.item.abb.tip "Update Journal Abbreviation">
8 changes: 4 additions & 4 deletions chrome/locale/zh-CN/overlay.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<!ENTITY zotero.itemmenu.exp.att.label "导出附件">
<!ENTITY zotero.exp.att.tip "导出附件">
<!-- 设置语言 -->
<!ENTITY zotero.chanlan-forempty.label "所选条目语言为空时设为en-US">
<!ENTITY zotero.chanlan-forsel.label "将语言字段设为en-US">
<!ENTITY zotero.chanlan.namehandler.label "将语言设为en-US">
<!ENTITY zotero.chanlan.Set.lan.to.en "将所选条目语言字段设为en-US">
<!ENTITY zotero.chanlan-forempty.label "所选条目语言为空时自动语言字段">
<!ENTITY zotero.chanlan-forsel.label "自动设置语言字段">
<!ENTITY zotero.chanlan.namehandler.label "自动设置语言字段">
<!ENTITY zotero.chanlan.Set.lan.to.en "根据条目题目自动设置所选条目语言字段">

<!-- 更新缩写 -->
<!ENTITY zotero.update.item.abb.label "Update Abbreviation">
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="Del Item With Att"
em:version="0.0.18"
em:version="0.0.19"
em:type="2"
em:creator="Minyi Han"
em:description="Delete Item(s) With Attachment(s)"
Expand Down
6 changes: 3 additions & 3 deletions update.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<rdf:Seq>
<rdf:li>
<rdf:Description>
<em:version>0.0.18</em:version>
<em:version>0.0.19</em:version>
<em:targetApplication>
<rdf:Description>
<em:id>[email protected]</em:id>
<em:minVersion>5.0.0</em:minVersion>
<em:maxVersion>6.*</em:maxVersion>
<em:updateLink>https://github.com/redleafnew/delitemwithatt/releases/download/0.0.18/delitemwithatt.xpi</em:updateLink>
<em:updateLink>https://github.com/redleafnew/delitemwithatt/releases/download/0.0.19/delitemwithatt.xpi</em:updateLink>
</rdf:Description>
</em:targetApplication>

Expand All @@ -21,7 +21,7 @@
<em:id>[email protected]</em:id>
<em:minVersion>4.999</em:minVersion>
<em:maxVersion>6.*</em:maxVersion>
<em:updateLink>https://github.com/redleafnew/delitemwithatt/releases/download/0.0.18/delitemwithatt.xpi</em:updateLink>
<em:updateLink>https://github.com/redleafnew/delitemwithatt/releases/download/0.0.19/delitemwithatt.xpi</em:updateLink>
</rdf:Description>
</em:targetApplication>

Expand Down

0 comments on commit e42a961

Please sign in to comment.