diff --git a/chrome/content/zotero/xpcom/commons.js b/chrome/content/zotero/xpcom/commons.js index 28f8130c1..bfdcc84b0 100644 --- a/chrome/content/zotero/xpcom/commons.js +++ b/chrome/content/zotero/xpcom/commons.js @@ -119,8 +119,8 @@ Zotero.Commons = new function() { // newPrefBucketNames currently contains intersection // of prefBucketNames and iaBucketNames - var askToAddBuckets = zu.arrayDiff(newPrefBucketNames, iaBucketNames); - var askToRemoveBuckets = zu.arrayDiff(newPrefBucketNames, prefBucketNames); + var askToAddBuckets = zu.arrayDiff(iaBucketNames, newPrefBucketNames); + var askToRemoveBuckets = zu.arrayDiff(prefBucketNames, newPrefBucketNames); // prompt user about adding buckets for(var i = 0, len = askToAddBuckets.length; i < len; i++) { diff --git a/chrome/content/zotero/xpcom/data/collection.js b/chrome/content/zotero/xpcom/data/collection.js index ee7cb73f3..53e5ae437 100644 --- a/chrome/content/zotero/xpcom/data/collection.js +++ b/chrome/content/zotero/xpcom/data/collection.js @@ -820,16 +820,16 @@ Zotero.Collection.prototype.diff = function (collection, includeMatches, ignoreO // For the moment, just compare children and increase numDiffs if any differences var d1 = Zotero.Utilities.prototype.arrayDiff( - otherData.childCollections, thisData.childCollections - ); - var d2 = Zotero.Utilities.prototype.arrayDiff( thisData.childCollections, otherData.childCollections ); + var d2 = Zotero.Utilities.prototype.arrayDiff( + otherData.childCollections, thisData.childCollections + ); var d3 = Zotero.Utilities.prototype.arrayDiff( - otherData.childItems, thisData.childItems + thisData.childItems, otherData.childItems ); var d4 = Zotero.Utilities.prototype.arrayDiff( - thisData.childItems, otherData.childItems + otherData.childItems, thisData.childItems ); numDiffs += d1.length + d2.length; diff --git a/chrome/content/zotero/xpcom/data/tag.js b/chrome/content/zotero/xpcom/data/tag.js index 0fb4d8fef..951124ff0 100644 --- a/chrome/content/zotero/xpcom/data/tag.js +++ b/chrome/content/zotero/xpcom/data/tag.js @@ -369,8 +369,8 @@ Zotero.Tag.prototype.save = function (full) { var sql = "SELECT itemID FROM itemTags WHERE tagID=?"; var dbItemIDs = Zotero.DB.columnQuery(sql, tagID); if (dbItemIDs) { - removed = Zotero.Utilities.prototype.arrayDiff(currentIDs, dbItemIDs); - newids = Zotero.Utilities.prototype.arrayDiff(dbItemIDs, currentIDs); + removed = Zotero.Utilities.prototype.arrayDiff(dbItemIDs, currentIDs); + newids = Zotero.Utilities.prototype.arrayDiff(currentIDs, dbItemIDs); } else { newids = currentIDs; @@ -379,10 +379,10 @@ Zotero.Tag.prototype.save = function (full) { else { if (this._previousData.linkedItems) { removed = Zotero.Utilities.prototype.arrayDiff( - currentIDs, this._previousData.linkedItems + this._previousData.linkedItems, currentIDs ); newids = Zotero.Utilities.prototype.arrayDiff( - this._previousData.linkedItems, currentIDs + currentIDs, this._previousData.linkedItems ); } else { @@ -471,10 +471,10 @@ Zotero.Tag.prototype.diff = function (tag, includeMatches, ignoreOnlyDateModifie // For the moment, just compare linked items and increase numDiffs if any differences var d1 = Zotero.Utilities.prototype.arrayDiff( - thisData.linkedItems, otherData.linkedItems + otherData.linkedItems, thisData.linkedItems ); var d2 = Zotero.Utilities.prototype.arrayDiff( - otherData.linkedItems, thisData.linkedItems + thisData.linkedItems, otherData.linkedItems ); numDiffs += d1.length + d2.length; diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js index 72ab580bf..6eaca2b51 100644 --- a/chrome/content/zotero/xpcom/sync.js +++ b/chrome/content/zotero/xpcom/sync.js @@ -2989,7 +2989,7 @@ Zotero.Sync.Server.Data = new function() { if (!itemIDs) { return false; } - var newItemIDs = Zotero.Utilities.prototype.arrayDiff(childItems, itemIDs); + var newItemIDs = Zotero.Utilities.prototype.arrayDiff(itemIDs, childItems); if (itemIDs.length == newItemIDs.length) { return false; } diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 65dd401af..a52286088 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -366,10 +366,10 @@ Zotero.Utilities.prototype.isEmpty = function (obj) { * Compares an array with another and returns an array with * the values from array2 that don't exist in array1 * - * @param {Array} array1 Array that will be checked - * @param {Array} array2 Array that will be compared + * @param {Array} array1 + * @param {Array} array2 * @param {Boolean} useIndex If true, return an array containing just - * the index of the comparator's elements; + * the index of array2's elements; * otherwise return the values */ Zotero.Utilities.prototype.arrayDiff = function(array1, array2, useIndex) { @@ -381,9 +381,9 @@ Zotero.Utilities.prototype.arrayDiff = function(array1, array2, useIndex) { } var val, pos, vals = []; - for (var i=0; i