Fix save to server in IE
This commit is contained in:
parent
8a7a53a606
commit
51c9da322f
1 changed files with 15 additions and 5 deletions
|
@ -1637,20 +1637,30 @@ Zotero.Translate.Web.prototype._translateServerComplete = function(statusCode, r
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract items from ATOM/JSON response
|
// Extract items from ATOM/JSON response
|
||||||
var items = [];
|
var items = [], contents;
|
||||||
var contents = response.getElementsByTagNameNS("http://www.w3.org/2005/Atom", "content");
|
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++) {
|
for(var i=0, n=contents.length; i<n; i++) {
|
||||||
var content = contents[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 {
|
try {
|
||||||
item = JSON.parse("textContent" in content ?
|
var item = JSON.parse("textContent" in content ?
|
||||||
content.textContent : content.innerText);
|
content.textContent : content.text);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
Zotero.logError(e);
|
Zotero.logError(e);
|
||||||
this.complete(false, "Invalid JSON response received from server");
|
this.complete(false, "Invalid JSON response received from server");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!("attachments" in item)) item.attachments = [];
|
||||||
this._runHandler("itemDone", null, item);
|
this._runHandler("itemDone", null, item);
|
||||||
items.push(item);
|
items.push(item);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue