From cf5d3a08bff923eb839ec4d2888fd785a60aa348 Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Tue, 21 May 2013 21:55:49 -0500 Subject: [PATCH] Add callback to importFromURL for drag-dropped PDFs instead of setTimeout --- chrome/content/zotero/zoteroPane.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 558a01900..b36041183 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -3283,16 +3283,12 @@ var ZoteroPane = new function() var collectionID = false; } - var attachmentItem = Zotero.Attachments.importFromURL(url, false, false, false, collectionID, mimeType, libraryID); - - // importFromURL() doesn't trigger the notifier until - // after download is complete - // - // TODO: add a callback to importFromURL() - setTimeout(function () { - self.selectItem(attachmentItem.id); - }, 1001); - + var attachmentItem = Zotero.Attachments.importFromURL(url, false, + false, false, collectionID, mimeType, libraryID, + function(attachmentItem) { + self.selectItem(attachmentItem.id); + }); + return; } }