diff --git a/chrome/content/zotero/browser.js b/chrome/content/zotero/browser.js index c42b14af74..e14243162e 100644 --- a/chrome/content/zotero/browser.js +++ b/chrome/content/zotero/browser.js @@ -394,9 +394,8 @@ var Zotero_Browser = new function() { var linkText = '' + Zotero.getString('ingester.scrapeErrorDescription.linkText') + ''; Zotero_Browser.progress.addDescription(Zotero.getString("ingester.scrapeErrorDescription", linkText)); + Zotero_Browser.progress.startCloseTimer(); } - - Zotero_Browser.progress.fade(); } @@ -413,6 +412,8 @@ var Zotero_Browser = new function() { if(collection) { collection.addItem(item.getID()); } + + Zotero_Browser.progress.startCloseTimer(); } ////////////////////////////////////////////////////////////////////////////// @@ -622,8 +623,8 @@ Zotero_Browser.Tab.prototype._selectItems = function(obj, itemList) { var newDialog = window.openDialog("chrome://zotero/content/ingester/selectitems.xul", "_blank","chrome,modal,centerscreen,resizable=yes", io); - if(!io.dataOut) { // user selected no items, so kill the progress indicatior - Zotero_Browser.progress.kill(); + if(!io.dataOut) { // user selected no items, so close the progress indicatior + Zotero_Browser.progress.close(); } return io.dataOut; diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index d7b6c74419..8a76eabcaa 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -1504,6 +1504,13 @@ var ZoteroPane = new function() function addItemFromPage() { + var progressWin = new Zotero.ProgressWindow(); + progressWin.changeHeadline(Zotero.getString('ingester.scraping')); + var icon = 'chrome://zotero/skin/treeitem-webpage.png'; + progressWin.addLines(window.content.document.title, icon) + progressWin.show(); + progressWin.startCloseTimer(); + var data = { title: window.content.document.title, url: window.content.document.location.href, @@ -1515,27 +1522,55 @@ var ZoteroPane = new function() // Automatically save snapshot if pref set if (item.getID() && Zotero.Prefs.get('automaticSnapshots')) { - this.addAttachmentFromPage(false, item.getID(), true); + var f = function() { + // We set |noParent|, since child items don't belong to collections + ZoteroPane.addAttachmentFromPage(false, item.getID(), true); + } + // Give progress window time to appear + setTimeout(f, 300); } return item.getID(); } - function addAttachmentFromPage(link, id, noParent) + /* + * Create an attachment from the current page + * + * |link| -- create web link instead of snapshot + * |itemID| -- itemID of parent item + * |noParent| -- don't add to current collection + */ + function addAttachmentFromPage(link, itemID, noParent) { - if (this.itemsView && this.itemsView._itemGroup.isCollection() && !noParent) { - var parentCollectionID = this.itemsView._itemGroup.ref.getID(); + if (!noParent) { + var progressWin = new Zotero.ProgressWindow(); + progressWin.changeHeadline(Zotero.getString('save.' + (link ? 'link' : 'attachment'))); + var type = link ? 'web-link' : 'snapshot'; + var icon = 'chrome://zotero/skin/treeitem-attachment-' + type + '.png'; + progressWin.addLines(window.content.document.title, icon) + progressWin.show(); + progressWin.startCloseTimer(); + + Zotero.debug('here'); + if (this.itemsView && this.itemsView._itemGroup.isCollection()) { + Zotero.debug('here2'); + var parentCollectionID = this.itemsView._itemGroup.ref.getID(); + Zotero.debug(parentCollectionID); + } } - if(link) - { - Zotero.Attachments.linkFromDocument(window.content.document, id, parentCollectionID); - } - else - { - Zotero.Attachments.importFromDocument(window.content.document, id, false, parentCollectionID); + var f = function() { + Zotero.debug(parentCollectionID); + if (link) { + Zotero.Attachments.linkFromDocument(window.content.document, itemID, false, parentCollectionID); + } + else { + Zotero.Attachments.importFromDocument(window.content.document, itemID, false, false, parentCollectionID); + } } + // Give progress window time to appear + setTimeout(f, 100); } diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul index 5f4a88fa96..bae40857a9 100644 --- a/chrome/content/zotero/overlay.xul +++ b/chrome/content/zotero/overlay.xul @@ -55,10 +55,10 @@ oncommand="var itemID = ZoteroPane.addItemFromPage(); ZoteroPane.newNote(false, itemID, window.content.getSelection().toString())"/> + oncommand="Zotero.Attachments.importFromURL(window.gContextMenu.linkURL, false, false, false, ZoteroPane.getSelectedCollection(true))"/> + oncommand="Zotero.Attachments.importFromURL(window.gContextMenu.onImage ? window.gContextMenu.imageURL : window.gContextMenu.bgImageURL, false, false, false, ZoteroPane.getSelectedCollection(true))"/> diff --git a/chrome/content/zotero/preferences.xul b/chrome/content/zotero/preferences.xul index 554cb4b318..0b205abcdb 100644 --- a/chrome/content/zotero/preferences.xul +++ b/chrome/content/zotero/preferences.xul @@ -108,6 +108,8 @@ To add a new preference: + +