www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 0668faa584e05d58d309465796df439e515a24ae
parent e8d8f4a0a3a472604c8ae18789d7d06c0d3668b4
Author: Adomas VenĨkauskas <adomas.ven@gmail.com>
Date:   Mon, 21 Nov 2016 11:45:21 +0200

Update connector ItemSaver constructor and misc refactoring

(should have been updated along with 3fc38d750)

Diffstat:
Mchrome/content/zotero/xpcom/connector/translate_item.js | 29+++++++++++++++++------------
Mchrome/content/zotero/xpcom/translation/translate_item.js | 1+
2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/chrome/content/zotero/xpcom/connector/translate_item.js b/chrome/content/zotero/xpcom/connector/translate_item.js @@ -23,15 +23,24 @@ ***** END LICENSE BLOCK ***** */ -Zotero.Translate.ItemSaver = function(libraryID, attachmentMode, forceTagType, document, - cookieSandbox) { +/** + * Save translator items. + * + * In the connector these options are actually irrelevent. We're just passing the items to standalone or + * saving to server. + * + * @constructor + * @param {Object} options + * <li>libraryID - ID of library in which items should be saved</li> + * <li>collections - New collections to create (used during Import translation</li> + * <li>attachmentMode - One of Zotero.Translate.ItemSaver.ATTACHMENT_* specifying how attachments should be saved</li> + * <li>forceTagType - Force tags to specified tag type</li> + * <li>cookieSandbox - Cookie sandbox for attachment requests</li> + * <li>baseURI - URI to which attachment paths should be relative</li> + * + */ +Zotero.Translate.ItemSaver = function(options) { this.newItems = []; - this._timeoutID = null; - - if(document) { - this._uri = document.location.toString(); - this._cookie = document.cookie; - } // Add listener for callbacks, but only for Safari or the bookmarklet. In Chrome, we // (have to) save attachments from the inject page. @@ -76,10 +85,6 @@ Zotero.Translate.ItemSaver.prototype = { var me = this; // first try to save items via connector var payload = {"items":items}; - if(this._uri && this._cookie) { - payload.uri = this._uri; - payload.cookie = this._cookie; - } Zotero.Connector.setCookiesThenSaveItems(payload, function(data, status) { if(data !== false) { Zotero.debug("Translate: Save via Standalone succeeded"); diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -29,6 +29,7 @@ * @constructor * @param {Object} options * <li>libraryID - ID of library in which items should be saved</li> + * <li>collections - New collections to create (used during Import translation</li> * <li>attachmentMode - One of Zotero.Translate.ItemSaver.ATTACHMENT_* specifying how attachments should be saved</li> * <li>forceTagType - Force tags to specified tag type</li> * <li>cookieSandbox - Cookie sandbox for attachment requests</li>