From 4f944c834f3237dcc623d2944acd7db25bcea9c8 Mon Sep 17 00:00:00 2001 From: redleafnew Date: Sun, 27 Feb 2022 19:53:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=BA0.0.14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chrome/content/scripts/delitem.js | 58 +++++++++++++++++++++++------ chrome/locale/en-US/diwa.properties | 21 +++++++---- chrome/locale/zh-CN/diwa.properties | 27 +++++++++----- install.rdf | 6 +-- update.rdf | 6 +-- 5 files changed, 84 insertions(+), 34 deletions(-) diff --git a/chrome/content/scripts/delitem.js b/chrome/content/scripts/delitem.js index 9c82c93..23ea0aa 100644 --- a/chrome/content/scripts/delitem.js +++ b/chrome/content/scripts/delitem.js @@ -4,11 +4,12 @@ Zotero.DelItem = { var zoteroPane = Zotero.getActiveZoteroPane(); var items = zoteroPane.getSelectedItems(); - var truthBeTold = window.confirm(Zotero.DelItem.diwaGetString("delete.item.and.attachment")) + var iaInfo = items.length > 1 ? 'delete.item.and.attachment.mul' : 'delete.item.and.attachment.sig'; + var truthBeTold = window.confirm(Zotero.DelItem.diwaGetString(iaInfo)) if (truthBeTold) { - Zotero.DelItem.DelItems(items); - - } + Zotero.DelItem.DelItems(items); + + } }, DelColl: async function () {//右击时删除分类调用的函数 @@ -27,7 +28,8 @@ Zotero.DelItem = { var zoteroPane = Zotero.getActiveZoteroPane(); var items = zoteroPane.getSelectedItems(); - var truthBeTold = window.confirm(Zotero.DelItem.diwaGetString("delete.attachment.only")) + var daoInfo = items.length > 1 ? 'delete.attachment.only.mul' : 'delete.attachment.only.sig'; + var truthBeTold = window.confirm(Zotero.DelItem.diwaGetString(daoInfo)) if (truthBeTold) { for (let item of items) { if (item && !item.isNote()) { //2 if @@ -65,7 +67,9 @@ Zotero.DelItem = { await item.saveTx(); }//5if } //2 if + } + this.opterationComplete(); } }, @@ -74,7 +78,8 @@ Zotero.DelItem = { var zoteroPane = Zotero.getActiveZoteroPane(); var items = zoteroPane.getSelectedItems(); - var truthBeTold = window.confirm(Zotero.DelItem.diwaGetString("delete.snapshot")) + var dsInfo = items.length > 1 ? 'delete.snapshot.mul' : 'delete.snapshot.sig' + var truthBeTold = window.confirm(Zotero.DelItem.diwaGetString(dsInfo)) if (truthBeTold) { for (let item of items) { if (item && !item.isNote()) { //2 if @@ -106,7 +111,9 @@ Zotero.DelItem = { } }//5if } //2 if - } + + } + this.opterationComplete(); } }, @@ -152,7 +159,9 @@ Zotero.DelItem = { } //2 if item.deleted = true; await item.saveTx(); + } + this.opterationComplete(); }, @@ -160,7 +169,8 @@ Zotero.DelItem = { var zoteroPane = Zotero.getActiveZoteroPane(); var items = zoteroPane.getSelectedItems(); - var truthBeTold = window.confirm(Zotero.DelItem.diwaGetString("delete.note")) + var dnInfo = items.length > 1 ? 'delete.note.mul' : 'delete.note.sig'; + var truthBeTold = window.confirm(Zotero.DelItem.diwaGetString(dnInfo)) if (truthBeTold) { for (let item of items) { if (item && !item.isNote()) { //2 if @@ -178,7 +188,9 @@ Zotero.DelItem = { item.deleted = true; await item.saveTx(); }//5if - } + + } + this.opterationComplete(); } }, @@ -245,7 +257,10 @@ Zotero.DelItem = { } //2 if } - alert (nItems + whiteSpace + Zotero.DelItem.diwaGetString("file.exported") + whiteSpace + expDir + Zotero.DelItem.diwaGetString("full.stop")); + var fileInfo = nItems >1 ? 'file.exported.mul' : 'file.exported.sig'; + var alertInfo = nItems + whiteSpace + Zotero.DelItem.diwaGetString(fileInfo) + whiteSpace + expDir + Zotero.DelItem.diwaGetString("full.stop"); + this.showPopUP(alertInfo, 'finished') + // alert (nItems + whiteSpace + Zotero.DelItem.diwaGetString(fileInfo) + whiteSpace + expDir + Zotero.DelItem.diwaGetString("full.stop")); }, // 导出附件函数 @@ -300,6 +315,7 @@ Zotero.DelItem = { await item.saveTx(); //} } + this.opterationComplete(); }, // 将所选条目语言字段为空时设为en @@ -314,6 +330,9 @@ Zotero.DelItem = { await item.saveTx(); } } + + this.opterationComplete(); + }, // Localization (borrowed from ZotFile sourcecode) @@ -482,7 +501,24 @@ Zotero.DelItem = { }, -}; + + opterationComplete : function () { + var prompInfo = this.diwaGetString('operation.completed'); + var prompStatus = 'finished'; + this.showPopUP(prompInfo, prompStatus); + }, + + // 右下角弹出函数 displayMenuitem: function () + showPopUP : function (alertInfo, status) { + var progressWindow = new Zotero.ProgressWindow({closeOnClick:true}); + progressWindow.changeHeadline(Zotero.DelItem.diwaGetString(status)); + progressWindow.addDescription(alertInfo); + progressWindow.show(); + progressWindow.startCloseTimer(4000); + }, +} + + window.addEventListener( "load", diff --git a/chrome/locale/en-US/diwa.properties b/chrome/locale/en-US/diwa.properties index 1f333d8..e2383a7 100644 --- a/chrome/locale/en-US/diwa.properties +++ b/chrome/locale/en-US/diwa.properties @@ -1,12 +1,19 @@ #delitem.js -delete.item.and.attachment = Are you sure you want to move the selected item(s) including the attachment(s) to the Trash? The linked attachment(s) could not be restored. -delete.collection.and.attachment = Are you sure you want to delete the selected collection including the attachments? The linked attachment(s) could not be restored. -delete.attachment.only = Are you sure you want to delete the attachment(s) of the item(s)? The linked attachment(s) could not be restored. -delete.snapshot = Are you sure you want to delete the snapshot(s) of the item(s)? -delete.note = Are you sure you want to delete the note(s) of the item(s)? +delete.item.and.attachment.sig = Are you sure you want to move the selected item including the attachment to the Trash? The linked attachment could not be restored. +delete.item.and.attachment.mul = Are you sure you want to move the selected items including the attachments to the Trash? The linked attachments could not be restored. +delete.collection.and.attachment = Are you sure you want to delete the selected collection including the attachments? The linked attachments could not be restored. +delete.attachment.only.sig = Are you sure you want to delete the attachment of the item? The linked attachment could not be restored. +delete.attachment.only.mul = Are you sure you want to delete the attachments of the items? The linked attachments could not be restored. +delete.snapshot.sig = Are you sure you want to delete the snapshot of the item? +delete.snapshot.mul = Are you sure you want to delete the snapshots of the items? +delete.note.sig = Are you sure you want to delete the note of the item? +delete.note.mul = Are you sure you want to delete the notes of the items? file.is.open = The file can not be deleted. Please close the file if you have opened it and try again. file.export.error = The file exporting error. Please close the file if you have opened it and try again. -file.exported = attachment (s) was (were) exported to +file.exported.sig = attachment was exported to +file.exported.mul = attachments were exported to file.exp.path = Please choose the directory to store the files -full.stop = . \ No newline at end of file +full.stop = . +finished = Finished: +operation.completed = Operation completed. \ No newline at end of file diff --git a/chrome/locale/zh-CN/diwa.properties b/chrome/locale/zh-CN/diwa.properties index d53ba9c..4d70337 100644 --- a/chrome/locale/zh-CN/diwa.properties +++ b/chrome/locale/zh-CN/diwa.properties @@ -1,12 +1,19 @@ #delitem.js -delete.item.and.attachment = 您确定将所选条目包括附件移动到回收站? 链接的附件不可恢复。 -delete.collection.and.attachment = 您确定将所选分类包括附件移动到回收站? 链接的附件不可恢复。 -delete.attachment.only = 您确定将所选条目的附件移动到回收站? 链接的附件不可恢复。 -delete.snapshot = 您确定将所选条目的快照移动到回收站? -delete.note = 您确定将所选条目的笔记删除? -file.is.open = 无法删除文件。如果文件已经打开,请关闭后重试。 -file.export.error = 附件导出出错。如果文件已经打开,请关闭后重试。 -file.exported = 个附件导出到 -file.exp.path = 请选择导出附件存放的目录 -full.stop = 。 +delete.item.and.attachment.sig = 您确定将所选条目包括附件移动到回收站? 链接的附件不可恢复。 +delete.item.and.attachment.mul = 您确定将所选条目包括附件移动到回收站? 链接的附件不可恢复。 +delete.collection.and.attachment = 您确定将所选分类包括附件移动到回收站? 链接的附件不可恢复。 +delete.attachment.only.sig = 您确定将所选条目的附件移动到回收站? 链接的附件不可恢复。 +delete.attachment.only.mul = 您确定将所选条目的附件移动到回收站? 链接的附件不可恢复。 +delete.snapshot.sig = 您确定将所选条目的快照移动到回收站? +delete.snapshot.mul = 您确定将所选条目的快照移动到回收站? +delete.note.sig = 您确定将所选条目的笔记删除? +delete.note.mul = 您确定将所选条目的笔记删除? +file.is.open = 无法删除文件。如果文件已经打开, 请关闭后重试。 +file.export.error = 附件导出出错。如果文件已经打开, 请关闭后重试。 +file.exported.sig = 个附件导出到 +file.exported.mul = 个附件导出到 +file.exp.path = 请选择导出附件存放的目录 +full.stop = 。 +finished = 完成: +operation.completed = 操作完成。 \ No newline at end of file diff --git a/install.rdf b/install.rdf index 04ab8b4..b65abc8 100644 --- a/install.rdf +++ b/install.rdf @@ -7,7 +7,7 @@ RDF:about="urn:mozilla:install-manifest" em:id="delitemwithatt@redleaf.me" em:name="Del Item With Att" - em:version="0.0.13" + em:version="0.0.14" em:type="2" em:creator="Minyi Han" em:description="Delete Item(s) With Attachment(s)" @@ -40,14 +40,14 @@ en-US - delitem + Delitem Delete Item(s) with Attachment(s). zh-CN - delitem + Delitem Minyi Han 删除条目的同时删除附件 https://github.com/redleafnew/delitemwithatt diff --git a/update.rdf b/update.rdf index f8724c8..a7367fd 100644 --- a/update.rdf +++ b/update.rdf @@ -6,13 +6,13 @@ - 0.0.13 + 0.0.14 zotero@chnm.gmu.edu 5.0.0 6.* - https://github.com/redleafnew/delitemwithatt/releases/download/0.0.13/delitemwithatt.xpi + https://github.com/redleafnew/delitemwithatt/releases/download/0.0.14/delitemwithatt.xpi @@ -21,7 +21,7 @@ juris-m@juris-m.github.io 4.999 6.* - https://github.com/redleafnew/delitemwithatt/releases/download/0.0.13/delitemwithatt.xpi + https://github.com/redleafnew/delitemwithatt/releases/download/0.0.14/delitemwithatt.xpi