Remove use of syntax where curly brackets are omitted in function defs

This commit is contained in:
Tom Najdek 2016-10-15 20:20:09 +01:00 committed by Dan Stillman
parent 54a2126b7d
commit d4dc86c975
23 changed files with 137 additions and 137 deletions

View file

@ -544,7 +544,7 @@ var Zotero_LocateMenu = new function() {
this.useExternalViewer = true;
this.canHandleItem = function (item) {
return _getBestFile(item).then(function (item) !!item);
return _getBestFile(item).then(item => !!item);
}
this.handleItems = Zotero.Promise.coroutine(function* (items, event) {
@ -573,7 +573,7 @@ var Zotero_LocateMenu = new function() {
*/
ViewOptions._libraryLookup = new function() {
this.icon = "chrome://zotero/skin/locate-library-lookup.png";
this.canHandleItem = function (item) Zotero.Promise.resolve(item.isRegularItem());
this.canHandleItem = function (item) { return Zotero.Promise.resolve(item.isRegularItem()); };
this.handleItems = Zotero.Promise.method(function (items, event) {
var urls = [];
for (let item of items) {

View file

@ -371,9 +371,9 @@ Zotero.ItemTypes = new function() {
}
if (params.length) {
sql += 'OR id IN '
+ '(' + params.map(function () '?').join() + ') '
+ '(' + params.map(() => '?').join() + ') '
+ 'ORDER BY id NOT IN '
+ '(' + params.map(function () '?').join() + ') ';
+ '(' + params.map(() => '?').join() + ') ';
params = params.concat(params);
}
else {

View file

@ -45,32 +45,32 @@ Zotero.Collection.prototype._dataTypes = Zotero.Collection._super.prototype._dat
]);
Zotero.defineProperty(Zotero.Collection.prototype, 'ChildObjects', {
get: function() Zotero.Items
get: function() { return Zotero.Items; }
});
Zotero.defineProperty(Zotero.Collection.prototype, 'id', {
get: function() this._get('id'),
set: function(val) this._set('id', val)
get: function() { return this._get('id'); },
set: function(val) { return this._set('id', val); }
});
Zotero.defineProperty(Zotero.Collection.prototype, 'libraryID', {
get: function() this._get('libraryID'),
set: function(val) this._set('libraryID', val)
get: function() { return this._get('libraryID'); },
set: function(val) { return this._set('libraryID', val); }
});
Zotero.defineProperty(Zotero.Collection.prototype, 'key', {
get: function() this._get('key'),
set: function(val) this._set('key', val)
get: function() { return this._get('key'); },
set: function(val) { return this._set('key', val); }
});
Zotero.defineProperty(Zotero.Collection.prototype, 'name', {
get: function() this._get('name'),
set: function(val) this._set('name', val)
get: function() { return this._get('name'); },
set: function(val) { return this._set('name', val); }
});
Zotero.defineProperty(Zotero.Collection.prototype, 'version', {
get: function() this._get('version'),
set: function(val) this._set('version', val)
get: function() { return this._get('version'); },
set: function(val) { return this._set('version', val); }
});
Zotero.defineProperty(Zotero.Collection.prototype, 'synced', {
get: function() this._get('synced'),
set: function(val) this._set('synced', val)
get: function() { return this._get('synced'); },
set: function(val) { return this._set('synced', val); }
});
Zotero.defineProperty(Zotero.Collection.prototype, 'parent', {
get: function() {
@ -290,14 +290,14 @@ Zotero.Collection.prototype._saveData = Zotero.Promise.coroutine(function* (env)
env.sqlColumns.unshift('collectionID');
env.sqlValues.unshift(collectionID ? { int: collectionID } : null);
let placeholders = env.sqlColumns.map(function () '?').join();
let placeholders = env.sqlColumns.map(() => '?').join();
let sql = "INSERT INTO collections (" + env.sqlColumns.join(', ') + ") "
+ "VALUES (" + placeholders + ")";
yield Zotero.DB.queryAsync(sql, env.sqlValues);
}
else {
let sql = 'UPDATE collections SET '
+ env.sqlColumns.map(function (x) x + '=?').join(', ') + ' WHERE collectionID=?';
+ env.sqlColumns.map(x => x + '=?').join(', ') + ' WHERE collectionID=?';
env.sqlValues.push(collectionID ? { int: collectionID } : null);
yield Zotero.DB.queryAsync(sql, env.sqlValues);
}
@ -604,7 +604,7 @@ Zotero.Collection.prototype._eraseData = Zotero.Promise.coroutine(function* (env
}
}
var placeholders = collections.map(function () '?').join();
var placeholders = collections.map(() => '?').join();
// Remove item associations for all descendent collections
yield Zotero.DB.queryAsync('DELETE FROM collectionItems WHERE collectionID IN '

View file

@ -104,7 +104,7 @@ Zotero.Collections = function() {
}
// Do proper collation sort
children.sort(function (a, b) Zotero.localeCompare(a.name, b.name));
children.sort((a, b) => Zotero.localeCompare(a.name, b.name));
if (!recursive) return children;

View file

@ -66,13 +66,13 @@ Zotero.DataObject.prototype._objectType = 'dataObject';
Zotero.DataObject.prototype._dataTypes = ['primaryData'];
Zotero.defineProperty(Zotero.DataObject.prototype, 'objectType', {
get: function() this._objectType
get: function() { return this._objectType; }
});
Zotero.defineProperty(Zotero.DataObject.prototype, 'id', {
get: function() this._id
get: function() { return this._id; }
});
Zotero.defineProperty(Zotero.DataObject.prototype, 'libraryID', {
get: function() this._libraryID
get: function() { return this._libraryID; }
});
Zotero.defineProperty(Zotero.DataObject.prototype, 'library', {
get: function () {
@ -80,18 +80,18 @@ Zotero.defineProperty(Zotero.DataObject.prototype, 'library', {
}
});
Zotero.defineProperty(Zotero.DataObject.prototype, 'key', {
get: function() this._key
get: function() { return this._key; }
});
Zotero.defineProperty(Zotero.DataObject.prototype, 'libraryKey', {
get: function() this._libraryID + "/" + this._key
get: function() { return this._libraryID + "/" + this._key; }
});
Zotero.defineProperty(Zotero.DataObject.prototype, 'parentKey', {
get: function () this._getParentKey(),
set: function(v) this._setParentKey(v)
get: function () { return this._getParentKey(); },
set: function(v) { return this._setParentKey(v); }
});
Zotero.defineProperty(Zotero.DataObject.prototype, 'parentID', {
get: function() this._getParentID(),
set: function(v) this._setParentID(v)
get: function() { return this._getParentID(); },
set: function(v) { return this._setParentID(v); }
});
Zotero.defineProperty(Zotero.DataObject.prototype, '_canHaveParent', {
@ -99,7 +99,7 @@ Zotero.defineProperty(Zotero.DataObject.prototype, '_canHaveParent', {
});
Zotero.defineProperty(Zotero.DataObject.prototype, 'ObjectsClass', {
get: function() this._ObjectsClass
get: function() { return this._ObjectsClass; }
});

View file

@ -62,18 +62,18 @@ Zotero.DataObjects.prototype._ZDO_idOnly = false;
// Public properties
Zotero.defineProperty(Zotero.DataObjects.prototype, 'idColumn', {
get: function() this._ZDO_id
get: function() { return this._ZDO_id; }
});
Zotero.defineProperty(Zotero.DataObjects.prototype, 'table', {
get: function() this._ZDO_table
get: function() { return this._ZDO_table; }
});
Zotero.defineProperty(Zotero.DataObjects.prototype, 'relationsTable', {
get: function() this._ZDO_object + 'Relations'
get: function() { return this._ZDO_object + 'Relations'; }
});
Zotero.defineProperty(Zotero.DataObjects.prototype, 'primaryFields', {
get: function () Object.keys(this._primaryDataSQLParts)
get: function () { return Object.keys(this._primaryDataSQLParts); }
}, {lazy: true});
Zotero.defineProperty(Zotero.DataObjects.prototype, "_primaryDataSQLWhere", {
@ -81,7 +81,7 @@ Zotero.defineProperty(Zotero.DataObjects.prototype, "_primaryDataSQLWhere", {
});
Zotero.defineProperty(Zotero.DataObjects.prototype, 'primaryDataSQLFrom', {
get: function() " " + this._primaryDataSQLFrom + " " + this._primaryDataSQLWhere
get: function() { return " " + this._primaryDataSQLFrom + " " + this._primaryDataSQLWhere; }
}, {lateInit: true});
Zotero.DataObjects.prototype.init = function() {

View file

@ -51,13 +51,13 @@ Zotero.Feed = function(params = {}) {
// Feeds are not editable by the user. Remove the setter
this.editable = false;
Zotero.defineProperty(this, 'editable', {
get: function() this._get('_libraryEditable')
get: function() { return this._get('_libraryEditable'); }
});
// Feeds are not filesEditable by the user. Remove the setter
this.filesEditable = false;
Zotero.defineProperty(this, 'filesEditable', {
get: function() this._get('_libraryFilesEditable')
get: function() { return this._get('_libraryFilesEditable'); }
});
Zotero.Utilities.assignProps(this, params,
@ -115,10 +115,10 @@ Zotero.defineProperty(Zotero.Feed.prototype, 'libraryTypes', {
value: Object.freeze(Zotero.Feed._super.prototype.libraryTypes.concat(['feed']))
});
Zotero.defineProperty(Zotero.Feed.prototype, 'unreadCount', {
get: function() this._feedUnreadCount
get: function() { return this._feedUnreadCount; }
});
Zotero.defineProperty(Zotero.Feed.prototype, 'updating', {
get: function() !!this._updating,
get: function() { return !!this._updating; }
});
(function() {
@ -128,8 +128,8 @@ for (let i=0; i<accessors.length; i++) {
let name = accessors[i];
let prop = Zotero.Feed._colToProp(name);
Zotero.defineProperty(Zotero.Feed.prototype, name, {
get: function() this._get(prop),
set: function(v) this._set(prop, v)
get: function() { return this._get(prop); },
set: function(v) { return this._set(prop, v); }
})
}
let getters = ['lastCheck', 'lastUpdate', 'lastCheckError'];
@ -137,7 +137,7 @@ for (let i=0; i<getters.length; i++) {
let name = getters[i];
let prop = Zotero.Feed._colToProp(name);
Zotero.defineProperty(Zotero.Feed.prototype, name, {
get: function() this._get(prop),
get: function() { return this._get(prop); }
})
}
})()

View file

@ -46,7 +46,7 @@ Zotero.defineProperty(Zotero.FeedItem.prototype, 'isFeedItem', {
});
Zotero.defineProperty(Zotero.FeedItem.prototype, 'guid', {
get: function() this._feedItemGUID,
get: function() { return this._feedItemGUID; },
set: function(val) {
if (this.id) throw new Error('Cannot set GUID after item ID is already set');
if (typeof val != 'string') throw new Error('GUID must be a non-empty string');

View file

@ -58,7 +58,7 @@ Zotero.Group._colToProp = function(c) {
Zotero.defineProperty(Zotero.Group, '_rowSQLSelect', {
value: Zotero.Library._rowSQLSelect + ", G.groupID, "
+ Zotero.Group._dbColumns.map(function(c) "G." + c + " AS " + Zotero.Group._colToProp(c)).join(", ")
+ Zotero.Group._dbColumns.map(c => "G." + c + " AS " + Zotero.Group._colToProp(c)).join(", ")
});
Zotero.defineProperty(Zotero.Group, '_rowSQL', {
@ -77,13 +77,13 @@ Zotero.defineProperty(Zotero.Group.prototype, 'libraryTypes', {
});
Zotero.defineProperty(Zotero.Group.prototype, 'groupID', {
get: function() this._groupID,
set: function(v) this._groupID = v
get: function() { return this._groupID; },
set: function(v) { return this._groupID = v; }
});
Zotero.defineProperty(Zotero.Group.prototype, 'id', {
get: function() this.groupID,
set: function(v) this.groupID = v
get: function() { return this.groupID; },
set: function(v) { return this.groupID = v; }
});
// Create accessors
@ -93,8 +93,8 @@ for (let i=0; i<accessors.length; i++) {
let name = accessors[i];
let prop = Zotero.Group._colToProp(name);
Zotero.defineProperty(Zotero.Group.prototype, name, {
get: function() this._get(prop),
set: function(v) this._set(prop, v)
get: function() { return this._get(prop); },
set: function(v) { return this._set(prop, v); }
})
}
})();
@ -201,7 +201,7 @@ Zotero.Group.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
Zotero.Notifier.queue('add', 'group', this.groupID);
}
else if (changedCols.length) {
let sql = "UPDATE groups SET " + changedCols.map(function (v) v + '=?').join(', ')
let sql = "UPDATE groups SET " + changedCols.map(v => v + '=?').join(', ')
+ " WHERE groupID=?";
params.push(this.groupID);
yield Zotero.DB.queryAsync(sql, params);

View file

@ -89,7 +89,7 @@ Zotero.extendClass(Zotero.DataObject, Zotero.Item);
Zotero.Item.prototype._objectType = 'item';
Zotero.defineProperty(Zotero.Item.prototype, 'ContainerObjectsClass', {
get: function() Zotero.Collections
get: function() { return Zotero.Collections; }
});
Zotero.Item.prototype._dataTypes = Zotero.Item._super.prototype._dataTypes.concat([
@ -104,8 +104,8 @@ Zotero.Item.prototype._dataTypes = Zotero.Item._super.prototype._dataTypes.conca
]);
Zotero.defineProperty(Zotero.Item.prototype, 'id', {
get: function() this._id,
set: function(val) this.setField('id', val)
get: function() { return this._id; },
set: function(val) { return this.setField('id', val); }
});
Zotero.defineProperty(Zotero.Item.prototype, 'itemID', {
get: function() {
@ -114,52 +114,52 @@ Zotero.defineProperty(Zotero.Item.prototype, 'itemID', {
}
});
Zotero.defineProperty(Zotero.Item.prototype, 'libraryID', {
get: function() this._libraryID,
set: function(val) this.setField('libraryID', val)
get: function() { return this._libraryID; },
set: function(val) { return this.setField('libraryID', val); }
});
Zotero.defineProperty(Zotero.Item.prototype, 'key', {
get: function() this._key,
set: function(val) this.setField('key', val)
get: function() { return this._key; },
set: function(val) { return this.setField('key', val); }
});
Zotero.defineProperty(Zotero.Item.prototype, 'itemTypeID', {
get: function() this._itemTypeID
get: function() { return this._itemTypeID; }
});
Zotero.defineProperty(Zotero.Item.prototype, 'dateAdded', {
get: function() this._dateAdded,
set: function(val) this.setField('dateAdded', val)
get: function() { return this._dateAdded; },
set: function(val) { return this.setField('dateAdded', val); }
});
Zotero.defineProperty(Zotero.Item.prototype, 'dateModified', {
get: function() this._dateModified,
set: function(val) this.setField('dateModified', val)
get: function() { return this._dateModified; },
set: function(val) { return this.setField('dateModified', val); }
});
Zotero.defineProperty(Zotero.Item.prototype, 'version', {
get: function() this._version,
set: function(val) this.setField('version', val)
get: function() { return this._version; },
set: function(val) { return this.setField('version', val); }
});
Zotero.defineProperty(Zotero.Item.prototype, 'synced', {
get: function() this._synced,
set: function(val) this.setField('synced', val)
get: function() { return this._synced; },
set: function(val) { return this.setField('synced', val); }
});
// .parentKey and .parentID defined in dataObject.js, but create aliases
Zotero.defineProperty(Zotero.Item.prototype, 'parentItemID', {
get: function() this.parentID,
set: function(val) this.parentID = val
get: function() { return this.parentID; },
set: function(val) { return this.parentID = val; }
});
Zotero.defineProperty(Zotero.Item.prototype, 'parentItemKey', {
get: function() this.parentKey,
set: function(val) this.parentKey = val
get: function() { return this.parentKey; },
set: function(val) { return this.parentKey = val; }
});
Zotero.defineProperty(Zotero.Item.prototype, 'firstCreator', {
get: function() this._firstCreator
get: function() { return this._firstCreator; }
});
Zotero.defineProperty(Zotero.Item.prototype, 'sortCreator', {
get: function() this._sortCreator
get: function() { return this._sortCreator; }
});
Zotero.defineProperty(Zotero.Item.prototype, 'relatedItems', {
get: function() this._getRelatedItems()
get: function() { return this._getRelatedItems(); }
});
Zotero.defineProperty(Zotero.Item.prototype, 'treeViewID', {
@ -1023,7 +1023,7 @@ Zotero.Item.prototype.getCreators = function () {
*/
Zotero.Item.prototype.getCreatorsJSON = function () {
this._requireData('creators');
return this._creators.map(function (data) Zotero.Creators.internalToJSON(data));
return this._creators.map(data => Zotero.Creators.internalToJSON(data));
}
@ -1274,7 +1274,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
env.sqlValues.unshift(parseInt(itemID));
let sql = "INSERT INTO items (" + env.sqlColumns.join(", ") + ") "
+ "VALUES (" + env.sqlValues.map(function () "?").join() + ")";
+ "VALUES (" + env.sqlValues.map(() => "?").join() + ")";
yield Zotero.DB.queryAsync(sql, env.sqlValues);
if (!env.options.skipNotifier) {
@ -1328,7 +1328,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
// Delete blank fields
if (del.length) {
sql = 'DELETE from itemData WHERE itemID=? AND '
+ 'fieldID IN (' + del.map(function () '?').join() + ')';
+ 'fieldID IN (' + del.map(() => '?').join() + ')';
yield Zotero.DB.queryAsync(sql, [itemID].concat(del));
}
}
@ -2040,7 +2040,7 @@ Zotero.Item.prototype.getNotes = function(includeTrashed) {
var rows = this._notes.rows.concat();
// Remove trashed items if necessary
if (!includeTrashed) {
rows = rows.filter(function (row) !row.trashed);
rows = rows.filter(row => !row.trashed);
}
// Sort by title if necessary
if (!sortChronologically) {
@ -3205,12 +3205,12 @@ Zotero.Item.prototype.getAttachments = function(includeTrashed) {
var rows = this._attachments.rows.concat();
// Remove trashed items if necessary
if (!includeTrashed) {
rows = rows.filter(function (row) !row.trashed);
rows = rows.filter(row => !row.trashed);
}
// Sort by title if necessary
if (!Zotero.Prefs.get('sortAttachmentsChronologically')) {
var collation = Zotero.getLocaleCollation();
rows.sort(function (a, b) collation.compareString(1, a.title, b.title));
rows.sort((a, b) => collation.compareString(1, a.title, b.title));
}
var ids = rows.map(row => row.itemID);
this._attachments[cacheKey] = ids;
@ -3317,7 +3317,7 @@ Zotero.Item.prototype.getTags = function () {
*/
Zotero.Item.prototype.hasTag = function (tagName) {
this._requireData('tags');
return this._tags.some(function (tagData) tagData.tag == tagName);
return this._tags.some(tagData => tagData.tag == tagName);
}
@ -3454,7 +3454,7 @@ Zotero.Item.prototype.replaceTag = function (oldTag, newTag) {
*/
Zotero.Item.prototype.removeTag = function(tagName) {
this._requireData('tags');
var newTags = this._tags.filter(function (tagData) tagData.tag !== tagName);
var newTags = this._tags.filter(tagData => tagData.tag !== tagName);
if (newTags.length == this._tags.length) {
Zotero.debug('Cannot remove missing tag ' + tagName + ' from item ' + this.libraryKey);
return;
@ -3658,7 +3658,7 @@ Zotero.Item.prototype.getImageSrcWithTags = Zotero.Promise.coroutine(function* (
colorData.sort(function (a, b) {
return a.position - b.position;
});
var colors = colorData.map(function (val) val.color);
var colors = colorData.map(val => val.color);
return Zotero.Tags.generateItemsListImage(colors, uri);
});

View file

@ -79,7 +79,7 @@ Zotero.Library._colToProp = function(c) {
// Select all columns in a unique manner, so we can JOIN tables with same column names (e.g. version)
Zotero.defineProperty(Zotero.Library, '_rowSQLSelect', {
value: "L.libraryID, " + Zotero.Library._dbColumns.map(function(c) "L." + c + " AS " + Zotero.Library._colToProp(c)).join(", ")
value: "L.libraryID, " + Zotero.Library._dbColumns.map(c => "L." + c + " AS " + Zotero.Library._colToProp(c)).join(", ")
+ ", (SELECT COUNT(*)>0 FROM collections C WHERE C.libraryID=L.libraryID) AS hasCollections"
+ ", (SELECT COUNT(*)>0 FROM savedSearches S WHERE S.libraryID=L.libraryID) AS hasSearches"
});
@ -111,18 +111,18 @@ Zotero.defineProperty(Zotero.Library.prototype, 'fixedLibraries', {
});
Zotero.defineProperty(Zotero.Library.prototype, 'libraryID', {
get: function() this._libraryID,
set: function(id) { throw new Error("Cannot change library ID") }
get: function() { return this._libraryID; },
set: function(id) { throw new Error("Cannot change library ID"); }
});
Zotero.defineProperty(Zotero.Library.prototype, 'id', {
get: function() this.libraryID,
set: function(val) this.libraryID = val
get: function() { return this.libraryID; },
set: function(val) { return this.libraryID = val; }
});
Zotero.defineProperty(Zotero.Library.prototype, 'libraryType', {
get: function() this._get('_libraryType'),
set: function(v) this._set('_libraryType', v)
get: function() { return this._get('_libraryType'); },
set: function(v) { return this._set('_libraryType', v); }
});
/**
@ -148,8 +148,8 @@ Zotero.defineProperty(Zotero.Library.prototype, 'libraryTypeID', {
});
Zotero.defineProperty(Zotero.Library.prototype, 'libraryVersion', {
get: function() this._get('_libraryVersion'),
set: function(v) this._set('_libraryVersion', v)
get: function() { return this._get('_libraryVersion'); },
set: function(v) { return this._set('_libraryVersion', v); }
});
@ -159,7 +159,7 @@ Zotero.defineProperty(Zotero.Library.prototype, 'syncable', {
Zotero.defineProperty(Zotero.Library.prototype, 'lastSync', {
get: function() this._get('_libraryLastSync')
get: function() { return this._get('_libraryLastSync'); }
});
@ -199,8 +199,8 @@ Zotero.defineProperty(Zotero.Library.prototype, 'hasTrash', {
for (let i=0; i<accessors.length; i++) {
let prop = Zotero.Library._colToProp(accessors[i]);
Zotero.defineProperty(Zotero.Library.prototype, accessors[i], {
get: function() this._get(prop),
set: function(v) this._set(prop, v)
get: function() { return this._get(prop); },
set: function(v) { return this._set(prop, v); }
})
}
})()
@ -514,7 +514,7 @@ Zotero.Library.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
this._libraryID = id;
} else if (changedCols.length) {
params.push(this.libraryID);
let sql = "UPDATE libraries SET " + changedCols.map(function(v) v + "=?").join(", ")
let sql = "UPDATE libraries SET " + changedCols.map(v => v + "=?").join(", ")
+ " WHERE libraryID=?";
yield Zotero.DB.queryAsync(sql, params);

View file

@ -28,9 +28,9 @@ Zotero.Notes = new function() {
this.noteToTitle = noteToTitle;
this.__defineGetter__("MAX_TITLE_LENGTH", function() { return 120; });
this.__defineGetter__("defaultNote", function () '<div class="zotero-note znv1"></div>');
this.__defineGetter__("notePrefix", function () '<div class="zotero-note znv1">');
this.__defineGetter__("noteSuffix", function () '</div>');
this.__defineGetter__("defaultNote", function () { return '<div class="zotero-note znv1"></div>'; });
this.__defineGetter__("notePrefix", function () { return '<div class="zotero-note znv1">'; });
this.__defineGetter__("noteSuffix", function () { return '</div>'; });
/**
* Return first line (or first MAX_LENGTH characters) of note content

View file

@ -62,31 +62,31 @@ Zotero.Search.prototype.setName = function(val) {
}
Zotero.defineProperty(Zotero.Search.prototype, 'id', {
get: function() this._get('id'),
set: function(val) this._set('id', val)
get: function() { return this._get('id'); },
set: function(val) { return this._set('id', val); }
});
Zotero.defineProperty(Zotero.Search.prototype, 'libraryID', {
get: function() this._get('libraryID'),
set: function(val) this._set('libraryID', val)
get: function() { return this._get('libraryID'); },
set: function(val) { return this._set('libraryID', val); }
});
Zotero.defineProperty(Zotero.Search.prototype, 'key', {
get: function() this._get('key'),
set: function(val) this._set('key', val)
get: function() { return this._get('key'); },
set: function(val) { return this._set('key', val); }
});
Zotero.defineProperty(Zotero.Search.prototype, 'name', {
get: function() this._get('name'),
set: function(val) this._set('name', val)
get: function() { return this._get('name'); },
set: function(val) { return this._set('name', val); }
});
Zotero.defineProperty(Zotero.Search.prototype, 'version', {
get: function() this._get('version'),
set: function(val) this._set('version', val)
get: function() { return this._get('version'); },
set: function(val) { return this._set('version', val); }
});
Zotero.defineProperty(Zotero.Search.prototype, 'synced', {
get: function() this._get('synced'),
set: function(val) this._set('synced', val)
get: function() { return this._get('synced'); },
set: function(val) { return this._set('synced', val); }
});
Zotero.defineProperty(Zotero.Search.prototype, 'conditions', {
get: function() this.getConditions()
get: function() { return this.getConditions(); }
});
Zotero.defineProperty(Zotero.Search.prototype, '_canHaveParent', {
value: false
@ -175,14 +175,14 @@ Zotero.Search.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
env.sqlColumns.unshift('savedSearchID');
env.sqlValues.unshift(searchID ? { int: searchID } : null);
let placeholders = env.sqlColumns.map(function () '?').join();
let placeholders = env.sqlColumns.map(() => '?').join();
let sql = "INSERT INTO savedSearches (" + env.sqlColumns.join(', ') + ") "
+ "VALUES (" + placeholders + ")";
yield Zotero.DB.queryAsync(sql, env.sqlValues);
}
else {
let sql = 'UPDATE savedSearches SET '
+ env.sqlColumns.map(function (x) x + '=?').join(', ') + ' WHERE savedSearchID=?';
+ env.sqlColumns.map(x => x + '=?').join(', ') + ' WHERE savedSearchID=?';
env.sqlValues.push(searchID ? { int: searchID } : null);
yield Zotero.DB.queryAsync(sql, env.sqlValues);
}
@ -634,7 +634,7 @@ Zotero.Search.prototype.search = Zotero.Promise.coroutine(function* (asTempTable
// (a separate fulltext word search filtered by fulltext content)
for (let condition of Object.values(this._conditions)){
if (condition['condition']=='fulltextContent'){
var fulltextWordIntersectionFilter = function (val, index, array) !!hash[val];
var fulltextWordIntersectionFilter = (val, index, array) => !!hash[val];
var fulltextWordIntersectionConditionFilter = function(val, index, array) {
return hash[val] ?
(condition.operator == 'contains') :

View file

@ -248,7 +248,7 @@ Zotero.Tags = new function() {
oldItemIDs,
Zotero.DB.MAX_BOUND_PARAMETERS - 2,
Zotero.Promise.coroutine(function* (chunk) {
let placeholders = chunk.map(function () '?').join(',');
let placeholders = chunk.map(() => '?').join(',');
// This is ugly, but it's much faster than doing replaceTag() for each item
let sql = 'UPDATE OR REPLACE itemTags SET tagID=?, type=0 '
@ -349,7 +349,7 @@ Zotero.Tags = new function() {
Zotero.Utilities.arrayUnique(oldItemIDs),
Zotero.DB.MAX_BOUND_PARAMETERS - 1,
Zotero.Promise.coroutine(function* (chunk) {
let placeholders = chunk.map(function () '?').join(',');
let placeholders = chunk.map(() => '?').join(',');
sql = 'UPDATE items SET synced=0, clientDateModified=? '
+ 'WHERE itemID IN (' + placeholders + ')'
@ -539,7 +539,7 @@ Zotero.Tags = new function() {
return;
}
tagColors = tagColors.filter(function (val) val.name != name);
tagColors = tagColors.filter(val => val.name != name);
}
else {
// Get current position if present
@ -620,7 +620,7 @@ Zotero.Tags = new function() {
var affectedItems = [];
// Get all items linked to previous or current tag colors
var tagNames = tagColors.concat(previousTagColors).map(function (val) val.name);
var tagNames = tagColors.concat(previousTagColors).map(val => val.name);
tagNames = Zotero.Utilities.arrayUnique(tagNames);
if (tagNames.length) {
for (let i=0; i<tagNames.length; i++) {

View file

@ -375,7 +375,7 @@ Zotero.DBConnection.prototype.getNextName = Zotero.Promise.coroutine(function* (
+ " WHERE libraryID=? AND " + field + " LIKE ? ORDER BY " + field;
var params = [libraryID, name + "%"];
var suffixes = yield this.columnQueryAsync(sql, params);
suffixes.filter(function (x) x.match(/^( [0-9]+)?$/));
suffixes.filter(x => x.match(/^( [0-9]+)?$/));
// If none found or first one has a suffix, use default name
if (!suffixes.length || suffixes[0]) {
@ -841,15 +841,15 @@ Zotero.DBConnection.prototype.executeSQLFile = Zotero.Promise.coroutine(function
// Ugly hack to parse triggers with embedded semicolons
.replace(/;---/g, "TEMPSEMI")
.split("\n")
.filter(function (x) nonCommentRE.test(x))
.map(function (x) x.match(trailingCommentRE)[1])
.filter(x => nonCommentRE.test(x))
.map(x => x.match(trailingCommentRE)[1])
.join("");
if (sql.substr(-1) == ";") {
sql = sql.substr(0, sql.length - 1);
}
var statements = sql.split(";")
.map(function (x) x.replace(/TEMPSEMI/g, ";"));
.map(x => x.replace(/TEMPSEMI/g, ";"));
this.requireTransaction();

View file

@ -36,8 +36,8 @@ Zotero.Duplicates = function (libraryID) {
}
Zotero.Duplicates.prototype.__defineGetter__('name', function () Zotero.getString('pane.collections.duplicate'));
Zotero.Duplicates.prototype.__defineGetter__('libraryID', function () this._libraryID);
Zotero.Duplicates.prototype.__defineGetter__('name', function () { return Zotero.getString('pane.collections.duplicate'); });
Zotero.Duplicates.prototype.__defineGetter__('libraryID', function () { return this._libraryID; });
/**
* Get duplicates, populate a temporary table, and return a search based
@ -251,7 +251,7 @@ Zotero.Duplicates.prototype._findDuplicates = Zotero.Promise.coroutine(function*
+ "JOIN itemData USING (itemID) "
+ "JOIN itemDataValues USING (valueID) "
+ "WHERE libraryID=? AND fieldID IN ("
+ dateFields.map(function () '?').join() + ") "
+ dateFields.map(() => '?').join() + ") "
+ "AND SUBSTR(value, 1, 4) != '0000' "
+ "AND itemID NOT IN (SELECT itemID FROM deletedItems) "
+ "ORDER BY value";

View file

@ -637,7 +637,7 @@ Zotero.HTTP = new function() {
* through the error log and doing a fragile string comparison.
*/
_pacInstalled = function () {
return Zotero.getErrors(true).some(function (val) val.indexOf("PAC file installed") == 0)
return Zotero.getErrors(true).some(val => val.indexOf("PAC file installed") == 0)
}

View file

@ -480,7 +480,7 @@ Zotero.ItemTreeView.prototype.notify = Zotero.Promise.coroutine(function* (actio
// Clear item type icon and tag colors when a tag is added to or removed from an item
if (type == 'item-tag') {
// TODO: Only update if colored tag changed?
ids.map(function (val) val.split("-")[0]).forEach(function (val) {
ids.map(val => val.split("-")[0]).forEach(function (val) {
delete this._itemImages[val];
}.bind(this));
return;
@ -1432,7 +1432,7 @@ Zotero.ItemTreeView.prototype.sort = function (itemID) {
// Cache primary values while sorting, since base-field-mapped getField()
// calls are relatively expensive
var cache = {};
sortFields.forEach(function (x) cache[x] = {})
sortFields.forEach(x => cache[x] = {})
// Get the display field for a row (which might be a placeholder title)
function getField(field, row) {

View file

@ -75,7 +75,7 @@ Zotero.LocateManager = new function() {
/**
* Returns an array of all search engines
*/
this.getEngines = function() _locateEngines.slice(0);
this.getEngines = function() { return _locateEngines.slice(0); }
/**
* Returns an array of all search engines visible that should be visible in the dropdown

View file

@ -27,8 +27,8 @@
Zotero.Sync.Storage = new function () {
// TEMP
this.__defineGetter__("defaultError", function () Zotero.getString('sync.storage.error.default', Zotero.appName));
this.__defineGetter__("defaultErrorRestart", function () Zotero.getString('sync.storage.error.defaultRestart', Zotero.appName));
this.__defineGetter__("defaultError", function () { return Zotero.getString('sync.storage.error.default', Zotero.appName); });
this.__defineGetter__("defaultErrorRestart", function () { return Zotero.getString('sync.storage.error.defaultRestart', Zotero.appName); });
var _itemDownloadPercentages = {};

View file

@ -72,7 +72,7 @@ Components.utils.import("resource://gre/modules/PluralForm.jsm");
* @property {Boolean} locked Whether all Zotero panes are locked
* with an overlay
*/
this.__defineGetter__('locked', function () _locked);
this.__defineGetter__('locked', function () { return _locked; });
this.__defineSetter__('locked', function (lock) {
var wasLocked = _locked;
_locked = lock;
@ -788,7 +788,7 @@ Components.utils.import("resource://gre/modules/PluralForm.jsm");
var e = {
name: 'NS_ERROR_FILE_ACCESS_DENIED',
message: msg,
toString: function () this.message
toString: function () { return this.message; }
};
throw (e);
}

View file

@ -33,7 +33,7 @@ var ZoteroPane = new function()
this.itemsView = false;
this.progressWindow = false;
this._listeners = {};
this.__defineGetter__('loaded', function () _loaded);
this.__defineGetter__('loaded', function () { return _loaded; });
var _lastSelectedItems = [];
//Privileged methods

View file

@ -327,7 +327,7 @@ function makeZoteroContext(isConnector) {
// add connector-related properties
zContext.Zotero.isConnector = isConnector;
zContext.Zotero.instanceID = instanceID;
zContext.Zotero.__defineGetter__("isFirstLoadThisSession", function() isFirstLoadThisSession);
zContext.Zotero.__defineGetter__("isFirstLoadThisSession", function() { return isFirstLoadThisSession; });
};
/**