From b1333d0e9d83d41a3a0d93b3baecdc7f2a83aef7 Mon Sep 17 00:00:00 2001 From: Tom Najdek Date: Fri, 23 Feb 2024 12:11:40 +0100 Subject: [PATCH] More attachment type icons in the item tree (#3645) --- chrome/content/zotero/itemTree.jsx | 14 ++++++++-- chrome/content/zotero/xpcom/data/item.js | 28 ++++++++++++++++++- chrome/locale/en-US/zotero/zotero.properties | 2 ++ .../item-type/12/dark/attachment-file.svg | 4 +++ .../item-type/12/dark/attachment-image.svg | 5 ++++ .../item-type/12/dark/attachment-video.svg | 5 ++++ .../item-type/12/light/attachment-file.svg | 6 ++++ .../item-type/12/light/attachment-image.svg | 7 +++++ .../item-type/12/light/attachment-video.svg | 7 +++++ .../item-type/12/white/attachment-file.svg | 4 +++ .../item-type/12/white/attachment-image.svg | 5 ++++ .../item-type/12/white/attachment-video.svg | 5 ++++ .../16/dark/attachment-image-link.svg | 7 +++++ .../16/dark/attachment-image-link@2x.svg | 7 +++++ .../item-type/16/dark/attachment-image.svg | 6 ++++ .../item-type/16/dark/attachment-image@2x.svg | 6 ++++ .../item-type/16/dark/attachment-link.svg | 4 +-- .../item-type/16/dark/attachment-link@2x.svg | 4 +-- .../item-type/16/dark/attachment-pdf-link.svg | 4 +-- .../16/dark/attachment-pdf-link@2x.svg | 4 +-- .../16/dark/attachment-video-link.svg | 7 +++++ .../16/dark/attachment-video-link@2x.svg | 7 +++++ .../item-type/16/dark/attachment-video.svg | 6 ++++ .../item-type/16/dark/attachment-video@2x.svg | 6 ++++ .../item-type/16/dark/attachment-web-link.svg | 4 +-- .../16/dark/attachment-web-link@2x.svg | 4 +-- .../item-type/16/dark/video-recording.svg | 8 +++--- .../16/light/attachment-image-link.svg | 9 ++++++ .../16/light/attachment-image-link@2x.svg | 9 ++++++ .../item-type/16/light/attachment-image.svg | 8 ++++++ .../16/light/attachment-image@2x.svg | 8 ++++++ .../item-type/16/light/attachment-link.svg | 4 +-- .../item-type/16/light/attachment-link@2x.svg | 4 +-- .../16/light/attachment-pdf-link.svg | 4 +-- .../16/light/attachment-pdf-link@2x.svg | 4 +-- .../16/light/attachment-video-link.svg | 9 ++++++ .../16/light/attachment-video-link@2x.svg | 9 ++++++ .../item-type/16/light/attachment-video.svg | 8 ++++++ .../16/light/attachment-video@2x.svg | 8 ++++++ .../16/light/attachment-web-link.svg | 4 +-- .../16/light/attachment-web-link@2x.svg | 4 +-- .../item-type/16/light/video-recording.svg | 6 ++-- .../16/white/attachment-image-link.svg | 7 +++++ .../16/white/attachment-image-link@2x.svg | 7 +++++ .../item-type/16/white/attachment-image.svg | 6 ++++ .../16/white/attachment-image@2x.svg | 6 ++++ .../16/white/attachment-video-link.svg | 7 +++++ .../16/white/attachment-video-link@2x.svg | 7 +++++ .../item-type/16/white/attachment-video.svg | 6 ++++ .../16/white/attachment-video@2x.svg | 6 ++++ .../item-type/16/white/video-recording.svg | 2 +- scss/components/_item-tree.scss | 22 ++++++++++----- test/tests/itemTest.js | 4 +-- 53 files changed, 309 insertions(+), 45 deletions(-) create mode 100644 chrome/skin/default/zotero/item-type/12/dark/attachment-file.svg create mode 100644 chrome/skin/default/zotero/item-type/12/dark/attachment-image.svg create mode 100644 chrome/skin/default/zotero/item-type/12/dark/attachment-video.svg create mode 100644 chrome/skin/default/zotero/item-type/12/light/attachment-file.svg create mode 100644 chrome/skin/default/zotero/item-type/12/light/attachment-image.svg create mode 100644 chrome/skin/default/zotero/item-type/12/light/attachment-video.svg create mode 100644 chrome/skin/default/zotero/item-type/12/white/attachment-file.svg create mode 100644 chrome/skin/default/zotero/item-type/12/white/attachment-image.svg create mode 100644 chrome/skin/default/zotero/item-type/12/white/attachment-video.svg create mode 100644 chrome/skin/default/zotero/item-type/16/dark/attachment-image-link.svg create mode 100644 chrome/skin/default/zotero/item-type/16/dark/attachment-image-link@2x.svg create mode 100644 chrome/skin/default/zotero/item-type/16/dark/attachment-image.svg create mode 100644 chrome/skin/default/zotero/item-type/16/dark/attachment-image@2x.svg create mode 100644 chrome/skin/default/zotero/item-type/16/dark/attachment-video-link.svg create mode 100644 chrome/skin/default/zotero/item-type/16/dark/attachment-video-link@2x.svg create mode 100644 chrome/skin/default/zotero/item-type/16/dark/attachment-video.svg create mode 100644 chrome/skin/default/zotero/item-type/16/dark/attachment-video@2x.svg create mode 100644 chrome/skin/default/zotero/item-type/16/light/attachment-image-link.svg create mode 100644 chrome/skin/default/zotero/item-type/16/light/attachment-image-link@2x.svg create mode 100644 chrome/skin/default/zotero/item-type/16/light/attachment-image.svg create mode 100644 chrome/skin/default/zotero/item-type/16/light/attachment-image@2x.svg create mode 100644 chrome/skin/default/zotero/item-type/16/light/attachment-video-link.svg create mode 100644 chrome/skin/default/zotero/item-type/16/light/attachment-video-link@2x.svg create mode 100644 chrome/skin/default/zotero/item-type/16/light/attachment-video.svg create mode 100644 chrome/skin/default/zotero/item-type/16/light/attachment-video@2x.svg create mode 100644 chrome/skin/default/zotero/item-type/16/white/attachment-image-link.svg create mode 100644 chrome/skin/default/zotero/item-type/16/white/attachment-image-link@2x.svg create mode 100644 chrome/skin/default/zotero/item-type/16/white/attachment-image.svg create mode 100644 chrome/skin/default/zotero/item-type/16/white/attachment-image@2x.svg create mode 100644 chrome/skin/default/zotero/item-type/16/white/attachment-video-link.svg create mode 100644 chrome/skin/default/zotero/item-type/16/white/attachment-video-link@2x.svg create mode 100644 chrome/skin/default/zotero/item-type/16/white/attachment-video.svg create mode 100644 chrome/skin/default/zotero/item-type/16/white/attachment-video@2x.svg diff --git a/chrome/content/zotero/itemTree.jsx b/chrome/content/zotero/itemTree.jsx index 6f3cae3854..8dbb55fe4e 100644 --- a/chrome/content/zotero/itemTree.jsx +++ b/chrome/content/zotero/itemTree.jsx @@ -1367,9 +1367,9 @@ var ItemTree = class ItemTree extends LibraryTree { if (sortField == 'hasAttachment') { // PDFs at the top - const order = ['pdf', 'snapshot', 'epub', 'other', 'none']; - fieldA = order.indexOf(fieldA.type || 'none') + (fieldA.exists ? 0 : 4); - fieldB = order.indexOf(fieldB.type || 'none') + (fieldB.exists ? 0 : 4); + const order = ['pdf', 'snapshot', 'epub', 'image', 'video', 'other', 'none']; + fieldA = order.indexOf(fieldA.type || 'none') + (fieldA.exists ? 0 : (order.length - 1)); + fieldB = order.indexOf(fieldB.type || 'none') + (fieldB.exists ? 0 : (order.length - 1)); return fieldA - fieldB; } @@ -2654,6 +2654,14 @@ var ItemTree = class ItemTree extends LibraryTree { icon = getCSSItemTypeIcon('attachmentEPUB', 'attachment-type'); ariaLabel = Zotero.getString('pane.item.attachments.hasEPUB'); } + else if (type == 'image') { + icon = getCSSItemTypeIcon('attachmentImage', 'attachment-type'); + ariaLabel = Zotero.getString('pane.item.attachments.hasImage'); + } + else if (type == 'video') { + icon = getCSSItemTypeIcon('attachmentVideo', 'attachment-type'); + ariaLabel = Zotero.getString('pane.item.attachments.hasVideo'); + } else { icon = getCSSItemTypeIcon('attachmentFile', 'attachment-type'); ariaLabel = Zotero.getString('pane.item.attachments.has'); diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 854835a756..fef04456da 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -2434,6 +2434,20 @@ Zotero.Item.prototype.isEPUBAttachment = function () { return this.isFileAttachment() && this.attachmentContentType == 'application/epub+zip'; }; +/** + * @return {Boolean} - Returns true if item is a stored or linked image attachment + */ +Zotero.Item.prototype.isImageAttachment = function () { + return this.isFileAttachment() && this.attachmentContentType.startsWith('image/'); +}; + +/** + * @return {Boolean} - Returns true if item is a stored or linked video attachment + */ +Zotero.Item.prototype.isVideoAttachment = function () { + return this.isFileAttachment() && this.attachmentContentType.startsWith('video/'); +}; + /** * Returns number of child attachments of item @@ -3745,7 +3759,7 @@ Zotero.Item.prototype.getBestAttachments = Zotero.Promise.coroutine(function* () /** * Return state of best attachment (or this item if it's a standalone attachment) * - * @return {Promise} - Promise for object with string 'type' ('none'|'pdf'|'snapshot'|'other') + * @return {Promise} - Promise for object with string 'type' ('none'|'pdf'|'snapshot'|'epub'|'image'|'video'|'other') * and boolean 'exists' */ Zotero.Item.prototype.getBestAttachmentState = async function () { @@ -3770,6 +3784,12 @@ Zotero.Item.prototype.getBestAttachmentState = async function () { else if (item.isEPUBAttachment()) { type = 'epub'; } + else if (item.isImageAttachment()) { + type = 'image'; + } + else if (item.isVideoAttachment()) { + type = 'video'; + } else { type = 'other'; } @@ -4388,6 +4408,12 @@ Zotero.Item.prototype.getItemTypeIconName = function () { itemType += 'EPUB'; } } + else if (this.isImageAttachment()) { + itemType += linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE ? 'ImageLink' : 'Image'; + } + else if (this.isVideoAttachment()) { + itemType += linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE ? 'VideoLink' : 'Video'; + } else if (linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) { itemType += "File"; } diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index be460d993b..01ee5cd24a 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -439,6 +439,8 @@ pane.item.attachments.has = Has attachment pane.item.attachments.hasPDF = Has PDF attachment pane.item.attachments.hasSnapshot = Has snapshot pane.item.attachments.hasEPUB = Has EPUB attachment +pane.item.attachments.hasImage = Has image attachment +pane.item.attachments.hasVideo = Has video attachment pane.item.attachments.hasLink = Has link pane.item.attachments.select = Select a File pane.item.attachments.PDF.installTools.title = PDF Tools Not Installed diff --git a/chrome/skin/default/zotero/item-type/12/dark/attachment-file.svg b/chrome/skin/default/zotero/item-type/12/dark/attachment-file.svg new file mode 100644 index 0000000000..2dcc9f8f5f --- /dev/null +++ b/chrome/skin/default/zotero/item-type/12/dark/attachment-file.svg @@ -0,0 +1,4 @@ + + + + diff --git a/chrome/skin/default/zotero/item-type/12/dark/attachment-image.svg b/chrome/skin/default/zotero/item-type/12/dark/attachment-image.svg new file mode 100644 index 0000000000..144712ee1c --- /dev/null +++ b/chrome/skin/default/zotero/item-type/12/dark/attachment-image.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/chrome/skin/default/zotero/item-type/12/dark/attachment-video.svg b/chrome/skin/default/zotero/item-type/12/dark/attachment-video.svg new file mode 100644 index 0000000000..618ea82635 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/12/dark/attachment-video.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/chrome/skin/default/zotero/item-type/12/light/attachment-file.svg b/chrome/skin/default/zotero/item-type/12/light/attachment-file.svg new file mode 100644 index 0000000000..62370ac35b --- /dev/null +++ b/chrome/skin/default/zotero/item-type/12/light/attachment-file.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/chrome/skin/default/zotero/item-type/12/light/attachment-image.svg b/chrome/skin/default/zotero/item-type/12/light/attachment-image.svg new file mode 100644 index 0000000000..324d73847d --- /dev/null +++ b/chrome/skin/default/zotero/item-type/12/light/attachment-image.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/12/light/attachment-video.svg b/chrome/skin/default/zotero/item-type/12/light/attachment-video.svg new file mode 100644 index 0000000000..486e99cd1f --- /dev/null +++ b/chrome/skin/default/zotero/item-type/12/light/attachment-video.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/12/white/attachment-file.svg b/chrome/skin/default/zotero/item-type/12/white/attachment-file.svg new file mode 100644 index 0000000000..2bbcf5b54a --- /dev/null +++ b/chrome/skin/default/zotero/item-type/12/white/attachment-file.svg @@ -0,0 +1,4 @@ + + + + diff --git a/chrome/skin/default/zotero/item-type/12/white/attachment-image.svg b/chrome/skin/default/zotero/item-type/12/white/attachment-image.svg new file mode 100644 index 0000000000..e669a2dfae --- /dev/null +++ b/chrome/skin/default/zotero/item-type/12/white/attachment-image.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/chrome/skin/default/zotero/item-type/12/white/attachment-video.svg b/chrome/skin/default/zotero/item-type/12/white/attachment-video.svg new file mode 100644 index 0000000000..5c4237ff8e --- /dev/null +++ b/chrome/skin/default/zotero/item-type/12/white/attachment-video.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-image-link.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-image-link.svg new file mode 100644 index 0000000000..1be9b34cc1 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-image-link.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-image-link@2x.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-image-link@2x.svg new file mode 100644 index 0000000000..1b0f3b280d --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-image-link@2x.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-image.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-image.svg new file mode 100644 index 0000000000..0331feac6d --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-image.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-image@2x.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-image@2x.svg new file mode 100644 index 0000000000..118d23ba2b --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-image@2x.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-link.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-link.svg index e46a07bf30..cfb4b51cfd 100644 --- a/chrome/skin/default/zotero/item-type/16/dark/attachment-link.svg +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-link.svg @@ -1,5 +1,5 @@ - + - + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-link@2x.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-link@2x.svg index 6606b80cd6..6e764211d5 100644 --- a/chrome/skin/default/zotero/item-type/16/dark/attachment-link@2x.svg +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-link@2x.svg @@ -1,5 +1,5 @@ - + - + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-pdf-link.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-pdf-link.svg index 717dffd7c7..2a6c775bb7 100644 --- a/chrome/skin/default/zotero/item-type/16/dark/attachment-pdf-link.svg +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-pdf-link.svg @@ -1,6 +1,6 @@ - + - + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-pdf-link@2x.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-pdf-link@2x.svg index d904feef78..3f437c3581 100644 --- a/chrome/skin/default/zotero/item-type/16/dark/attachment-pdf-link@2x.svg +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-pdf-link@2x.svg @@ -1,6 +1,6 @@ - + - + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-video-link.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-video-link.svg new file mode 100644 index 0000000000..ebf54167b9 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-video-link.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-video-link@2x.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-video-link@2x.svg new file mode 100644 index 0000000000..45418ae142 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-video-link@2x.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-video.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-video.svg new file mode 100644 index 0000000000..c37b4b7f89 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-video.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-video@2x.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-video@2x.svg new file mode 100644 index 0000000000..e2f392c759 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-video@2x.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-web-link.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-web-link.svg index c0fdc561cc..c637ee1963 100644 --- a/chrome/skin/default/zotero/item-type/16/dark/attachment-web-link.svg +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-web-link.svg @@ -1,4 +1,4 @@ - + @@ -6,5 +6,5 @@ - + diff --git a/chrome/skin/default/zotero/item-type/16/dark/attachment-web-link@2x.svg b/chrome/skin/default/zotero/item-type/16/dark/attachment-web-link@2x.svg index c0fdc561cc..c637ee1963 100644 --- a/chrome/skin/default/zotero/item-type/16/dark/attachment-web-link@2x.svg +++ b/chrome/skin/default/zotero/item-type/16/dark/attachment-web-link@2x.svg @@ -1,4 +1,4 @@ - + @@ -6,5 +6,5 @@ - + diff --git a/chrome/skin/default/zotero/item-type/16/dark/video-recording.svg b/chrome/skin/default/zotero/item-type/16/dark/video-recording.svg index d1233fd14e..867b0270cc 100644 --- a/chrome/skin/default/zotero/item-type/16/dark/video-recording.svg +++ b/chrome/skin/default/zotero/item-type/16/dark/video-recording.svg @@ -1,7 +1,7 @@ - - - - + + + + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-image-link.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-image-link.svg new file mode 100644 index 0000000000..5469644c77 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-image-link.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-image-link@2x.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-image-link@2x.svg new file mode 100644 index 0000000000..5e1ec01121 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-image-link@2x.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-image.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-image.svg new file mode 100644 index 0000000000..ee369df8f0 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-image.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-image@2x.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-image@2x.svg new file mode 100644 index 0000000000..9d35a8064a --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-image@2x.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-link.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-link.svg index 3e8f1a35d7..b4795fee37 100644 --- a/chrome/skin/default/zotero/item-type/16/light/attachment-link.svg +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-link.svg @@ -1,7 +1,7 @@ - + - + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-link@2x.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-link@2x.svg index 780ad16111..5e977c8ebe 100644 --- a/chrome/skin/default/zotero/item-type/16/light/attachment-link@2x.svg +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-link@2x.svg @@ -1,7 +1,7 @@ - + - + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-pdf-link.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-pdf-link.svg index 0ff8a7958f..eb36c19b87 100644 --- a/chrome/skin/default/zotero/item-type/16/light/attachment-pdf-link.svg +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-pdf-link.svg @@ -1,9 +1,9 @@ - + - + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-pdf-link@2x.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-pdf-link@2x.svg index 1fb8cc6d11..046d695ae3 100644 --- a/chrome/skin/default/zotero/item-type/16/light/attachment-pdf-link@2x.svg +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-pdf-link@2x.svg @@ -1,9 +1,9 @@ - + - + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-video-link.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-video-link.svg new file mode 100644 index 0000000000..7eb76de3cc --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-video-link.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-video-link@2x.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-video-link@2x.svg new file mode 100644 index 0000000000..8c6affec1c --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-video-link@2x.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-video.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-video.svg new file mode 100644 index 0000000000..78e2a9ef45 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-video.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-video@2x.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-video@2x.svg new file mode 100644 index 0000000000..6fbbd96985 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-video@2x.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-web-link.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-web-link.svg index 2aadce38ea..bb950a089c 100644 --- a/chrome/skin/default/zotero/item-type/16/light/attachment-web-link.svg +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-web-link.svg @@ -1,4 +1,4 @@ - + @@ -8,5 +8,5 @@ - + diff --git a/chrome/skin/default/zotero/item-type/16/light/attachment-web-link@2x.svg b/chrome/skin/default/zotero/item-type/16/light/attachment-web-link@2x.svg index 2aadce38ea..bb950a089c 100644 --- a/chrome/skin/default/zotero/item-type/16/light/attachment-web-link@2x.svg +++ b/chrome/skin/default/zotero/item-type/16/light/attachment-web-link@2x.svg @@ -1,4 +1,4 @@ - + @@ -8,5 +8,5 @@ - + diff --git a/chrome/skin/default/zotero/item-type/16/light/video-recording.svg b/chrome/skin/default/zotero/item-type/16/light/video-recording.svg index 9cc2a63b22..53bf65f64c 100644 --- a/chrome/skin/default/zotero/item-type/16/light/video-recording.svg +++ b/chrome/skin/default/zotero/item-type/16/light/video-recording.svg @@ -1,7 +1,7 @@ - - - + + + diff --git a/chrome/skin/default/zotero/item-type/16/white/attachment-image-link.svg b/chrome/skin/default/zotero/item-type/16/white/attachment-image-link.svg new file mode 100644 index 0000000000..860cf3d65c --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/white/attachment-image-link.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/white/attachment-image-link@2x.svg b/chrome/skin/default/zotero/item-type/16/white/attachment-image-link@2x.svg new file mode 100644 index 0000000000..0b433dddcc --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/white/attachment-image-link@2x.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/white/attachment-image.svg b/chrome/skin/default/zotero/item-type/16/white/attachment-image.svg new file mode 100644 index 0000000000..e46ce7d7c3 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/white/attachment-image.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/white/attachment-image@2x.svg b/chrome/skin/default/zotero/item-type/16/white/attachment-image@2x.svg new file mode 100644 index 0000000000..e501cd3ff0 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/white/attachment-image@2x.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/white/attachment-video-link.svg b/chrome/skin/default/zotero/item-type/16/white/attachment-video-link.svg new file mode 100644 index 0000000000..93a62d7afb --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/white/attachment-video-link.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/white/attachment-video-link@2x.svg b/chrome/skin/default/zotero/item-type/16/white/attachment-video-link@2x.svg new file mode 100644 index 0000000000..9df37ae34f --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/white/attachment-video-link@2x.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/white/attachment-video.svg b/chrome/skin/default/zotero/item-type/16/white/attachment-video.svg new file mode 100644 index 0000000000..64c98ee33c --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/white/attachment-video.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/white/attachment-video@2x.svg b/chrome/skin/default/zotero/item-type/16/white/attachment-video@2x.svg new file mode 100644 index 0000000000..a376177e92 --- /dev/null +++ b/chrome/skin/default/zotero/item-type/16/white/attachment-video@2x.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/chrome/skin/default/zotero/item-type/16/white/video-recording.svg b/chrome/skin/default/zotero/item-type/16/white/video-recording.svg index 52d5110ece..4212efad24 100644 --- a/chrome/skin/default/zotero/item-type/16/white/video-recording.svg +++ b/chrome/skin/default/zotero/item-type/16/white/video-recording.svg @@ -1,5 +1,5 @@ - + diff --git a/scss/components/_item-tree.scss b/scss/components/_item-tree.scss index 25ba51b0a7..cf0d36d310 100644 --- a/scss/components/_item-tree.scss +++ b/scss/components/_item-tree.scss @@ -203,6 +203,10 @@ $-itemTypesIcons: ( attachment-pdf, attachment-snapshot, attachment-web-link, + attachment-image, + attachment-image-link, + attachment-video, + attachment-video-link, audio-recording, bill, blog-post, @@ -255,6 +259,9 @@ $-attachmentIcons: ( attachment-pdf, attachment-snapshot, attachment-web-link, + attachment-file, + attachment-image, + attachment-video ); .icon-item-type { @@ -289,13 +296,6 @@ $-attachmentIcons: ( .icon-item-type[data-item-type=#{$itemType}] { @include svgicon($itemTypeIcon, $color, "16", "item-type", true); } - - @if index($-attachmentIcons, $itemTypeIcon) != false { - .icon-attachment-type[data-item-type=#{$itemType}] { - @include svgicon($itemTypeIcon, $color, "12", "item-type", false); - background-origin: content-box; - } - } } } @@ -306,5 +306,13 @@ $-attachmentIcons: ( .virtualized-table .row { @include focus-states using($color) { @include -icon-item-type-rules($color); + + @each $itemAttachmentIcon in $-attachmentIcons { + $itemType: camelCase(str-replace(str-replace($itemAttachmentIcon, "pdf", "PDF"), "epub", "EPUB")); + .icon-attachment-type[data-item-type=#{$itemType}] { + @include svgicon($itemAttachmentIcon, $color, "12", "item-type", false); + background-origin: content-box; + } + } } } diff --git a/test/tests/itemTest.js b/test/tests/itemTest.js index 5eedebeab9..3776d24c66 100644 --- a/test/tests/itemTest.js +++ b/test/tests/itemTest.js @@ -1219,7 +1219,7 @@ describe("Zotero.Item", function () { yield parentItem.getBestAttachmentState(); assert.deepEqual( parentItem.getBestAttachmentStateCached(), - { type: 'other', exists: true } + { type: 'image', exists: true } ); }) @@ -1236,7 +1236,7 @@ describe("Zotero.Item", function () { yield parentItem.getBestAttachmentState(); assert.deepEqual( parentItem.getBestAttachmentStateCached(), - { type: 'other', exists: false } + { type: 'image', exists: false } ); })