Merge branch '3.0'
This commit is contained in:
commit
bd367dcd85
5 changed files with 924 additions and 550 deletions
File diff suppressed because it is too large
Load diff
|
@ -385,15 +385,8 @@ Zotero.Server.Connector.SaveSnapshot.prototype = {
|
||||||
*/
|
*/
|
||||||
"init":function(url, data, sendResponseCallback) {
|
"init":function(url, data, sendResponseCallback) {
|
||||||
Zotero.Server.Connector.Data[data["url"]] = "<html>"+data["html"]+"</html>";
|
Zotero.Server.Connector.Data[data["url"]] = "<html>"+data["html"]+"</html>";
|
||||||
var browser = Zotero.Browser.createHiddenBrowser();
|
Zotero.HTTP.processDocuments(["zotero://connector/"+encodeURIComponent(data["url"])],
|
||||||
|
function(doc) {
|
||||||
var pageShowCalled = false;
|
|
||||||
var cookieSandbox = new Zotero.CookieSandbox(browser, data["url"], data["cookie"], url.userAgent);
|
|
||||||
browser.addEventListener("pageshow", function() {
|
|
||||||
if(browser.contentDocument.location.href == "about:blank"
|
|
||||||
|| browser.contentDocument.readyState !== "complete") return;
|
|
||||||
if(pageShowCalled) return;
|
|
||||||
pageShowCalled = true;
|
|
||||||
delete Zotero.Server.Connector.Data[data["url"]];
|
delete Zotero.Server.Connector.Data[data["url"]];
|
||||||
|
|
||||||
// figure out where to save
|
// figure out where to save
|
||||||
|
@ -406,8 +399,6 @@ Zotero.Server.Connector.SaveSnapshot.prototype = {
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var doc = browser.contentDocument;
|
|
||||||
|
|
||||||
// create new webpage item
|
// create new webpage item
|
||||||
var item = new Zotero.Item("webpage");
|
var item = new Zotero.Item("webpage");
|
||||||
item.libraryID = libraryID;
|
item.libraryID = libraryID;
|
||||||
|
@ -431,17 +422,14 @@ Zotero.Server.Connector.SaveSnapshot.prototype = {
|
||||||
Zotero.Attachments.importFromDocument(doc, itemID);
|
Zotero.Attachments.importFromDocument(doc, itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove browser
|
|
||||||
Zotero.Browser.deleteHiddenBrowser(browser);
|
|
||||||
|
|
||||||
sendResponseCallback(201);
|
sendResponseCallback(201);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
sendResponseCallback(500);
|
sendResponseCallback(500);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}, false);
|
},
|
||||||
|
null, null, false,
|
||||||
browser.loadURI("zotero://connector/"+encodeURIComponent(data["url"]));
|
new Zotero.CookieSandbox(null, data["url"], data["cookie"], url.userAgent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -334,12 +334,14 @@ Zotero.Translate.ItemSaver.prototype = {
|
||||||
Zotero.debug("Translate: Not adding attachment: no URL specified", 2);
|
Zotero.debug("Translate: Not adding attachment: no URL specified", 2);
|
||||||
} else {
|
} else {
|
||||||
// Determine whether to save an attachment
|
// Determine whether to save an attachment
|
||||||
|
if(attachment.snapshot !== false) {
|
||||||
if(attachment.document
|
if(attachment.document
|
||||||
|| (attachment.mimeType && attachment.mimeType == "text/html")) {
|
|| (attachment.mimeType && attachment.mimeType == "text/html")) {
|
||||||
if(!Zotero.Prefs.get("automaticSnapshots")) return;
|
if(!Zotero.Prefs.get("automaticSnapshots")) return;
|
||||||
} else {
|
} else {
|
||||||
if(!Zotero.Prefs.get("downloadAssociatedFiles")) return;
|
if(!Zotero.Prefs.get("downloadAssociatedFiles")) return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(attachment.document) {
|
if(attachment.document) {
|
||||||
attachment.document = Zotero.Translate.DOMWrapper.unwrap(attachment.document);
|
attachment.document = Zotero.Translate.DOMWrapper.unwrap(attachment.document);
|
||||||
|
|
|
@ -963,7 +963,7 @@ function ChromeExtensionHandler() {
|
||||||
|
|
||||||
this.name = uri;
|
this.name = uri;
|
||||||
this.URI = ioService.newURI(uri, "UTF-8", null);
|
this.URI = ioService.newURI(uri, "UTF-8", null);
|
||||||
this.owner = secMan.getCodebasePrincipal(this.URI);
|
this.owner = (secMan.getCodebasePrincipal || secMan.getSimpleCodebasePrincipal)(this.URI);
|
||||||
this._isPending = true;
|
this._isPending = true;
|
||||||
|
|
||||||
var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
|
var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
2012-11-05 20:05:00
|
2012-11-06 16:30:00
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue