Skip to content

Commit

Permalink
更新为0.0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
redleafnew committed Feb 27, 2022
1 parent 8d8e496 commit 4f944c8
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 34 deletions.
58 changes: 47 additions & 11 deletions chrome/content/scripts/delitem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {//右击时删除分类调用的函数
Expand All @@ -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
Expand Down Expand Up @@ -65,7 +67,9 @@ Zotero.DelItem = {
await item.saveTx();
}//5if
} //2 if

}
this.opterationComplete();
}
},

Expand All @@ -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
Expand Down Expand Up @@ -106,7 +111,9 @@ Zotero.DelItem = {
}
}//5if
} //2 if
}

}
this.opterationComplete();
}
},

Expand Down Expand Up @@ -152,15 +159,18 @@ Zotero.DelItem = {
} //2 if
item.deleted = true;
await item.saveTx();

}
this.opterationComplete();

},

DelNote: async function () { // 仅删除笔记调用的函数

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
Expand All @@ -178,7 +188,9 @@ Zotero.DelItem = {
item.deleted = true;
await item.saveTx();
}//5if
}

}
this.opterationComplete();
}
},

Expand Down Expand Up @@ -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"));
},

// 导出附件函数
Expand Down Expand Up @@ -300,6 +315,7 @@ Zotero.DelItem = {
await item.saveTx();
//}
}
this.opterationComplete();
},

// 将所选条目语言字段为空时设为en
Expand All @@ -314,6 +330,9 @@ Zotero.DelItem = {
await item.saveTx();
}
}

this.opterationComplete();

},

// Localization (borrowed from ZotFile sourcecode)
Expand Down Expand Up @@ -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",
Expand Down
21 changes: 14 additions & 7 deletions chrome/locale/en-US/diwa.properties
Original file line number Diff line number Diff line change
@@ -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 = .
full.stop = .
finished = Finished:
operation.completed = Operation completed.
27 changes: 17 additions & 10 deletions chrome/locale/zh-CN/diwa.properties
Original file line number Diff line number Diff line change
@@ -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 = 操作完成。
6 changes: 3 additions & 3 deletions 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.13"
em:version="0.0.14"
em:type="2"
em:creator="Minyi Han"
em:description="Delete Item(s) With Attachment(s)"
Expand Down Expand Up @@ -40,14 +40,14 @@
<em:localized>
<Description>
<em:locale>en-US</em:locale>
<em:name> delitem</em:name>
<em:name> Delitem</em:name>
<em:description>Delete Item(s) with Attachment(s).</em:description>
</Description>
</em:localized>
<em:localized>
<Description>
<em:locale>zh-CN</em:locale>
<em:name> delitem</em:name>
<em:name> Delitem</em:name>
<em:creator>Minyi Han</em:creator>
<em:description>删除条目的同时删除附件</em:description>
<em:homepageURL>https://github.com/redleafnew/delitemwithatt</em:homepageURL>
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.13</em:version>
<em:version>0.0.14</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.13/delitemwithatt.xpi</em:updateLink>
<em:updateLink>https://github.com/redleafnew/delitemwithatt/releases/download/0.0.14/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.13/delitemwithatt.xpi</em:updateLink>
<em:updateLink>https://github.com/redleafnew/delitemwithatt/releases/download/0.0.14/delitemwithatt.xpi</em:updateLink>
</rdf:Description>
</em:targetApplication>

Expand Down

0 comments on commit 4f944c8

Please sign in to comment.