Better progress window handling for feed item scraping
This commit is contained in:
parent
32ea7cfbb5
commit
0d2794531a
2 changed files with 8 additions and 11 deletions
|
@ -100,8 +100,6 @@ var Zotero_Browser = new function() {
|
|||
function init() {
|
||||
// No gBrowser - running in standalone
|
||||
if (!window.hasOwnProperty("gBrowser")) {
|
||||
// We can still have a progress window in this though
|
||||
reload();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -217,20 +217,19 @@ Zotero.FeedItem.prototype.translate = Zotero.Promise.coroutine(function* (librar
|
|||
let deferred = Zotero.Promise.defer();
|
||||
let error = function(e) { Zotero.debug(e, 1); deferred.reject(e); };
|
||||
let translate = new Zotero.Translate.Web();
|
||||
let progressWindow = new Zotero.ProgressWindow();
|
||||
|
||||
if (libraryID) {
|
||||
// Show progress notifications when scraping to a library. Shown under the most recent
|
||||
// window (Zotero Pane). Browser window not available in standalone.
|
||||
var win = Services.wm.getMostRecentWindow(null);
|
||||
// Show progress notifications when scraping to a library.
|
||||
translate.clearHandlers("done");
|
||||
translate.clearHandlers("itemDone");
|
||||
translate.setHandler("done", win.Zotero_Browser.progress.Translation.doneHandler);
|
||||
translate.setHandler("itemDone", win.Zotero_Browser.progress.Translation.itemDoneHandler());
|
||||
translate.setHandler("done", progressWindow.Translation.doneHandler);
|
||||
translate.setHandler("itemDone", progressWindow.Translation.itemDoneHandler());
|
||||
if (collectionID) {
|
||||
var collection = yield Zotero.Collections.getAsync(collectionID);
|
||||
}
|
||||
win.Zotero_Browser.progress.show();
|
||||
win.Zotero_Browser.progress.Translation.scrapingTo(libraryID, collection);
|
||||
progressWindow.show();
|
||||
progressWindow.Translation.scrapingTo(libraryID, collection);
|
||||
}
|
||||
|
||||
// Load document
|
||||
|
@ -269,8 +268,8 @@ Zotero.FeedItem.prototype.translate = Zotero.Promise.coroutine(function* (librar
|
|||
});
|
||||
}
|
||||
|
||||
win.Zotero_Browser.progress.Translation.itemDoneHandler()(null, null, item);
|
||||
win.Zotero_Browser.progress.Translation.doneHandler(null, true);
|
||||
progressWindow.Translation.itemDoneHandler()(null, null, item);
|
||||
progressWindow.Translation.doneHandler(null, true);
|
||||
return;
|
||||
}
|
||||
translate.setTranslator(translators[0]);
|
||||
|
|
Loading…
Reference in a new issue