commit cf5d3a08bff923eb839ec4d2888fd785a60aa348
parent 311e6f2fa74c89931674944c3ba39f510af05414
Author: Aurimas Vinckevicius <aurimas.dev@gmail.com>
Date: Tue, 21 May 2013 21:55:49 -0500
Add callback to importFromURL for drag-dropped PDFs instead of setTimeout
Diffstat:
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git 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;
}
}