- fixes processDocuments() under Firefox 3.5
- makes translator progress window work a little better with translators that call Zotero.done() incorrectly, and complains when item.complete() is called after Zotero.done()
This commit is contained in:
parent
cec3b1d31e
commit
1cf83d1760
3 changed files with 26 additions and 2 deletions
|
@ -55,6 +55,7 @@ var Zotero_Browser = new function() {
|
||||||
this.tabbrowser = null;
|
this.tabbrowser = null;
|
||||||
this.appcontent = null;
|
this.appcontent = null;
|
||||||
this.statusImage = null;
|
this.statusImage = null;
|
||||||
|
this.isScraping = false;
|
||||||
|
|
||||||
var _scrapePopupShowing = false;
|
var _scrapePopupShowing = false;
|
||||||
var _browserData = new Object();
|
var _browserData = new Object();
|
||||||
|
@ -450,14 +451,18 @@ var Zotero_Browser = new function() {
|
||||||
*/
|
*/
|
||||||
function finishScraping(obj, returnValue) {
|
function finishScraping(obj, returnValue) {
|
||||||
if(!returnValue) {
|
if(!returnValue) {
|
||||||
|
Zotero_Browser.progress.show();
|
||||||
Zotero_Browser.progress.changeHeadline(Zotero.getString("ingester.scrapeError"));
|
Zotero_Browser.progress.changeHeadline(Zotero.getString("ingester.scrapeError"));
|
||||||
// Include link to Known Translator Issues page
|
// Include link to Known Translator Issues page
|
||||||
var url = "http://www.zotero.org/documentation/known_translator_issues";
|
var url = "http://www.zotero.org/documentation/known_translator_issues";
|
||||||
var linkText = '<a href="' + url + '" tooltiptext="' + url + '">'
|
var linkText = '<a href="' + url + '" tooltiptext="' + url + '">'
|
||||||
+ Zotero.getString('ingester.scrapeErrorDescription.linkText') + '</a>';
|
+ Zotero.getString('ingester.scrapeErrorDescription.linkText') + '</a>';
|
||||||
Zotero_Browser.progress.addDescription(Zotero.getString("ingester.scrapeErrorDescription", linkText));
|
Zotero_Browser.progress.addDescription(Zotero.getString("ingester.scrapeErrorDescription", linkText));
|
||||||
|
Zotero_Browser.progress.startCloseTimer(8000);
|
||||||
|
} else {
|
||||||
|
Zotero_Browser.progress.startCloseTimer();
|
||||||
}
|
}
|
||||||
Zotero_Browser.progress.startCloseTimer();
|
Zotero_Browser.isScraping = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -467,6 +472,7 @@ var Zotero_Browser = new function() {
|
||||||
function itemDone(obj, item, collection) {
|
function itemDone(obj, item, collection) {
|
||||||
var title = item.getField("title");
|
var title = item.getField("title");
|
||||||
var icon = item.getImageSrc();
|
var icon = item.getImageSrc();
|
||||||
|
Zotero_Browser.progress.show();
|
||||||
Zotero_Browser.progress.changeHeadline(Zotero.getString("ingester.scraping"));
|
Zotero_Browser.progress.changeHeadline(Zotero.getString("ingester.scraping"));
|
||||||
Zotero_Browser.progress.addLines([title], [icon]);
|
Zotero_Browser.progress.addLines([title], [icon]);
|
||||||
|
|
||||||
|
@ -474,6 +480,15 @@ var Zotero_Browser = new function() {
|
||||||
if(collection) {
|
if(collection) {
|
||||||
collection.addItem(item.getID());
|
collection.addItem(item.getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Zotero_Browser.isScraping) {
|
||||||
|
// initialize close timer between item saves in case translator doesn't call done
|
||||||
|
Zotero_Browser.progress.startCloseTimer(10000); // is this long enough?
|
||||||
|
} else {
|
||||||
|
// if we aren't supposed to be scraping now, the translator is broken; assume we're
|
||||||
|
// done
|
||||||
|
Zotero_Browser.progress.startCloseTimer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -657,6 +672,7 @@ Zotero_Browser.Tab.prototype._attemptLocalFileImport = function(doc) {
|
||||||
Zotero_Browser.Tab.prototype.translate = function(saveLocation) {
|
Zotero_Browser.Tab.prototype.translate = function(saveLocation) {
|
||||||
if(this.page.translators && this.page.translators.length) {
|
if(this.page.translators && this.page.translators.length) {
|
||||||
Zotero_Browser.progress.show();
|
Zotero_Browser.progress.show();
|
||||||
|
Zotero_Browser.isScraping = true;
|
||||||
|
|
||||||
if(saveLocation) {
|
if(saveLocation) {
|
||||||
saveLocation = Zotero.Collections.get(saveLocation);
|
saveLocation = Zotero.Collections.get(saveLocation);
|
||||||
|
|
|
@ -894,7 +894,9 @@ Zotero.Translate.prototype._enableAsynchronousDetect = function() {
|
||||||
Zotero.Translate.prototype._enableAsynchronousTranslate = function() {
|
Zotero.Translate.prototype._enableAsynchronousTranslate = function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
this.waitForCompletion = true;
|
this.waitForCompletion = true;
|
||||||
this._sandbox.Zotero.done = function(val) { me._translationComplete(val) };
|
this._sandbox.Zotero.done = function(val, error) {
|
||||||
|
me._translationComplete(val == undefined ? true : val, (error ? error : ""))
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1115,6 +1117,11 @@ Zotero.Translate.prototype._itemTagsAndSeeAlso = function(item, newItem) {
|
||||||
*/
|
*/
|
||||||
Zotero.Translate._urlRe = /(([A-Za-z]+):\/\/[^\s]*)/i;
|
Zotero.Translate._urlRe = /(([A-Za-z]+):\/\/[^\s]*)/i;
|
||||||
Zotero.Translate.prototype._itemDone = function(item, attachedTo) {
|
Zotero.Translate.prototype._itemDone = function(item, attachedTo) {
|
||||||
|
// warn if itemDone called after translation completed
|
||||||
|
if(this._complete) {
|
||||||
|
Zotero.debug("Translate: WARNING: Zotero.Item.complete() called after Zotero.done(); please fix your code", 2);
|
||||||
|
}
|
||||||
|
|
||||||
if(this.type == "web") {
|
if(this.type == "web") {
|
||||||
// store repository if this item was captured from a website, and
|
// store repository if this item was captured from a website, and
|
||||||
// repository is truly undefined (not false or "")
|
// repository is truly undefined (not false or "")
|
||||||
|
|
|
@ -1295,6 +1295,7 @@ Zotero.Utilities.HTTP = new function() {
|
||||||
* @inner
|
* @inner
|
||||||
*/
|
*/
|
||||||
var onLoad = function() {
|
var onLoad = function() {
|
||||||
|
if(hiddenBrowser.contentDocument.location.href == "about:blank") return;
|
||||||
Zotero.debug(hiddenBrowser.contentDocument.location.href+" has been loaded");
|
Zotero.debug(hiddenBrowser.contentDocument.location.href+" has been loaded");
|
||||||
if(hiddenBrowser.contentDocument.location.href != prevUrl) { // Just in case it fires too many times
|
if(hiddenBrowser.contentDocument.location.href != prevUrl) { // Just in case it fires too many times
|
||||||
prevUrl = hiddenBrowser.contentDocument.location.href;
|
prevUrl = hiddenBrowser.contentDocument.location.href;
|
||||||
|
|
Loading…
Reference in a new issue