Add Zotero.Item::numFileAttachments()
This commit is contained in:
parent
bb146328b8
commit
e1f1003318
1 changed files with 14 additions and 0 deletions
|
@ -2461,6 +2461,20 @@ Zotero.Item.prototype.numAttachments = function (includeTrashed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of file attachments of an item
|
||||||
|
*
|
||||||
|
* @return <Integer>
|
||||||
|
*/
|
||||||
|
Zotero.Item.prototype.numFileAttachments = function () {
|
||||||
|
this._requireData('childItems');
|
||||||
|
return this.getAttachments()
|
||||||
|
.map(itemID => Zotero.Items.get(itemID))
|
||||||
|
.filter(item => item.isFileAttachment())
|
||||||
|
.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
Zotero.Item.prototype.numNonHTMLFileAttachments = function () {
|
Zotero.Item.prototype.numNonHTMLFileAttachments = function () {
|
||||||
this._requireData('childItems');
|
this._requireData('childItems');
|
||||||
return this.getAttachments()
|
return this.getAttachments()
|
||||||
|
|
Loading…
Reference in a new issue