From 8d8109dbac5b5f524d4efc2b134ffa1ff58149b0 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 7 Aug 2018 15:40:19 -0400 Subject: [PATCH] Rename/move some of the PDF retrieval functions --- chrome/content/zotero/xpcom/attachments.js | 7 +++++++ chrome/content/zotero/xpcom/utilities_internal.js | 7 ------- chrome/content/zotero/zoteroPane.js | 4 ++-- chrome/content/zotero/zoteroPane.xul | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 41b1376bb6..e61bf57060 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -878,6 +878,13 @@ Zotero.Attachments = new function(){ }; + this.canFindPDFForItem = function (item) { + return item.isRegularItem() + && (!!item.getField('DOI') || !!item.getField('url')) + && item.numPDFAttachments() == 0; + }; + + /** * Look for an available PDF for an item and add it as an attachment * diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index d8c096e600..9c68a494fe 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -930,13 +930,6 @@ Zotero.Utilities.Internal = { }, - canFindPDFForItem: function (item) { - return item.isRegularItem() - && (!!item.getField('DOI') || !!item.getField('url')) - && item.numPDFAttachments() == 0; - }, - - /** * Look for open-access PDFs for a given DOI using Zotero's Unpaywall mirror * diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 80cdf13e90..ca4f76756a 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -3836,7 +3836,7 @@ var ZoteroPane = new function() }); - this.addPDFForSelectedItems = async function () { + this.findPDFForSelectedItems = async function () { if (!this.canEdit()) { this.displayCannotEditLibraryMessage(); return; @@ -3859,7 +3859,7 @@ var ZoteroPane = new function() for (let i = 0; i < items.length; i++) { let item = items[i]; - if (Zotero.Utilities.Internal.canFindPDFForItem(item)) { + if (Zotero.Attachments.canFindPDFForItem(item)) { let attachment = await Zotero.Attachments.addAvailablePDF(item); if (attachment) { successful++; diff --git a/chrome/content/zotero/zoteroPane.xul b/chrome/content/zotero/zoteroPane.xul index 6d38f9fef3..9b08daa9ea 100644 --- a/chrome/content/zotero/zoteroPane.xul +++ b/chrome/content/zotero/zoteroPane.xul @@ -313,7 +313,7 @@ - +