Merge branch '3.0' into attachment-progress

This commit is contained in:
Simon Kornblith 2012-06-07 20:01:03 -04:00
commit 283dba7856
4 changed files with 537 additions and 385 deletions

View file

@ -362,7 +362,7 @@ Zotero_TranslatorTester.prototype.fetchPageAndRunTest = function(test, testDoneC
var hiddenBrowser = Zotero.HTTP.processDocuments(test.url,
function(doc) {
if(test.defer) {
Zotero.setTimeout(function() { runTest(doc) }, 10000, true);
Zotero.setTimeout(function() { runTest(doc) }, 30000, true);
} else {
runTest(doc);
}

View file

@ -896,7 +896,7 @@ Zotero.Attachments = new function(){
break;
default:
var value = item.getField(field, false, true);
var value = '' + item.getField(field, false, true);
}
var re = new RegExp("\{?([^%\{\}]*)" + rpl + "(\{[0-9]+\})?" + "([^%\{\}]*)\}?");

File diff suppressed because it is too large Load diff

View file

@ -1637,20 +1637,30 @@ Zotero.Translate.Web.prototype._translateServerComplete = function(statusCode, r
}
// Extract items from ATOM/JSON response
var items = [];
var contents = response.getElementsByTagNameNS("http://www.w3.org/2005/Atom", "content");
var items = [], contents;
if("getElementsByTagNameNS" in response) {
contents = response.getElementsByTagNameNS("http://www.w3.org/2005/Atom", "content");
} else { // IE...
contents = response.getElementsByTagName("content");
}
for(var i=0, n=contents.length; i<n; i++) {
var content = contents[i];
if(content.getAttributeNS("http://zotero.org/ns/api", "type") != "json") continue;
if("getAttributeNS" in content) {
if(content.getAttributeNS("http://zotero.org/ns/api", "type") != "json") continue;
} else if(content.getAttribute("zapi:type") != "json") { // IE...
continue;
}
try {
item = JSON.parse("textContent" in content ?
content.textContent : content.innerText);
var item = JSON.parse("textContent" in content ?
content.textContent : content.text);
} catch(e) {
Zotero.logError(e);
this.complete(false, "Invalid JSON response received from server");
return;
}
if(!("attachments" in item)) item.attachments = [];
this._runHandler("itemDone", null, item);
items.push(item);
}