diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index f52184dbe..39f7cd3d8 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -475,7 +475,7 @@ var popup = button.appendChild(document.createElement("menupopup")); - for each(var v in this._fieldAlternatives[fieldName]) { + for (let v of this._fieldAlternatives[fieldName]) { var menuitem = document.createElement("menuitem"); var sv = Zotero.Utilities.ellipsize(v, 60); menuitem.setAttribute('label', sv); diff --git a/chrome/content/zotero/bindings/tagselector.xml b/chrome/content/zotero/bindings/tagselector.xml index 89ebb0dc6..3b991da58 100644 --- a/chrome/content/zotero/bindings/tagselector.xml +++ b/chrome/content/zotero/bindings/tagselector.xml @@ -528,7 +528,7 @@ this._tags = yield Zotero.Tags.getAll(this.libraryID, this._types); for (let tag of this.selection) { - for each(var tag2 in this._tags) { + for (let tag2 of this._tags) { if (tag == tag2) { var found = true; break; diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 2ce364272..57f91bef0 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -474,7 +474,7 @@ var Zotero_File_Interface = new function() { function _doBibliographyOptions(name, items) { // make sure at least one item is not a standalone note or attachment var haveRegularItem = false; - for each(var item in items) { + for (let item of items) { if (item.isRegularItem()) { haveRegularItem = true; break; diff --git a/chrome/content/zotero/rtfScan.js b/chrome/content/zotero/rtfScan.js index 9172492bf..71e61c9a8 100644 --- a/chrome/content/zotero/rtfScan.js +++ b/chrome/content/zotero/rtfScan.js @@ -460,7 +460,7 @@ var Zotero_RTFScan = new function() { */ function _refreshCanAdvance() { var canAdvance = true; - for each(var itemList in citationItemIDs) { + for (let itemList of citationItemIDs) { if(itemList.length != 1) { canAdvance = false; break; diff --git a/chrome/content/zotero/tools/csledit.js b/chrome/content/zotero/tools/csledit.js index c093584c6..8e00ba9c5 100644 --- a/chrome/content/zotero/tools/csledit.js +++ b/chrome/content/zotero/tools/csledit.js @@ -37,7 +37,7 @@ var Zotero_CSL_Editor = new function() { var styles = Zotero.Styles.getAll(); var currentStyle = null; - for each(var style in styles) { + for (let style of styles) { if (style.source) { continue; } diff --git a/chrome/content/zotero/tools/cslpreview.js b/chrome/content/zotero/tools/cslpreview.js index b0e841a97..036eda4a9 100644 --- a/chrome/content/zotero/tools/cslpreview.js +++ b/chrome/content/zotero/tools/cslpreview.js @@ -56,7 +56,7 @@ var Zotero_CSL_Preview = new function() { var styles = Zotero.Styles.getAll(); // XXX needs its own string really for the title! var str = ''; - for each(var style in styles) { + for (let style of styles) { if (style.source) { continue; } diff --git a/chrome/content/zotero/xpcom/annotate.js b/chrome/content/zotero/xpcom/annotate.js index 212627771..ece5fe64e 100644 --- a/chrome/content/zotero/xpcom/annotate.js +++ b/chrome/content/zotero/xpcom/annotate.js @@ -141,7 +141,7 @@ Zotero.Annotate = new function() { } else { var browsers = win.document.getElementsByTagNameNS(XUL_NAMESPACE, "browser"); } - for each(var browser in browsers) { + for (let browser of browsers) { if(browser.currentURI) { if(browser.currentURI.spec == annotationURL) { if(haveBrowser) { @@ -364,7 +364,7 @@ Zotero.Annotate.Path.prototype.fromNode = function(node, offset) { // is still part of the first text node if(sibling.getAttribute) { // get offset of all child nodes - for each(var child in sibling.childNodes) { + for (let child of sibling.childNodes) { if(child && child.nodeType == TEXT_TYPE) { this.offset += child.nodeValue.length; } @@ -754,14 +754,14 @@ Zotero.Annotations.prototype.save = function() { Zotero.Annotations.prototype.load = Zotero.Promise.coroutine(function* () { // load annotations var rows = yield Zotero.DB.queryAsync("SELECT * FROM annotations WHERE itemID = ?", [this.itemID]); - for each(var row in rows) { + for (let row of rows) { var annotation = this.createAnnotation(); annotation.initWithDBRow(row); } // load highlights var rows = yield Zotero.DB.queryAsync("SELECT * FROM highlights WHERE itemID = ?", [this.itemID]); - for each(var row in rows) { + for (let row of rows) { try { var highlight = new Zotero.Highlight(this); highlight.initWithDBRow(row); diff --git a/chrome/content/zotero/xpcom/api.js b/chrome/content/zotero/xpcom/api.js index d50f21086..6fffe78d9 100644 --- a/chrome/content/zotero/xpcom/api.js +++ b/chrome/content/zotero/xpcom/api.js @@ -76,7 +76,7 @@ Zotero.API = { var s2 = new Zotero.Search(); s2.setScope(s); var groups = Zotero.Groups.getAll(); - for each(var group in groups) { + for (let group of groups) { s2.addCondition('libraryID', 'isNot', group.libraryID); } var ids = yield s2.search(); diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index c98fd27f3..3ed81198b 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -143,7 +143,7 @@ Zotero.Cite = { output.push(bib[1][i]); // add COinS - for each(var itemID in bib[0].entry_ids[i]) { + for (let itemID of bib[0].entry_ids[i]) { try { var co = Zotero.OpenURL.createContextObject(Zotero.Items.get(itemID), "1.0"); if(!co) continue; diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index ced0dc927..d149440c9 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -1533,7 +1533,7 @@ Zotero.CollectionTreeView.prototype.canDropCheck = function (row, orient, dataTr var ids = data; var items = Zotero.Items.get(ids); var skip = true; - for each(var item in items) { + for (let item of items) { // Can only drag top-level items if (!item.isTopLevelItem()) { Zotero.debug("Can't drag child item"); @@ -1738,7 +1738,7 @@ Zotero.CollectionTreeView.prototype.canDropCheckAsync = Zotero.Promise.coroutine } var descendents = col.getDescendents(false, 'collection'); - for each(var descendent in descendents) { + for (let descendent of descendents) { descendent = Zotero.Collections.get(descendent.id); // Disallow if linked collection already exists for any subcollections // @@ -1883,7 +1883,7 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r if (options.childNotes) { var noteIDs = item.getNotes(); var notes = Zotero.Items.get(noteIDs); - for each(var note in notes) { + for (let note of notes) { let newNote = note.clone(targetLibraryID, { skipTags: !options.tags }); newNote.parentID = newItemID; yield newNote.save({ @@ -1898,7 +1898,7 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r if (options.childLinks || options.childFileAttachments) { var attachmentIDs = item.getAttachments(); var attachments = Zotero.Items.get(attachmentIDs); - for each(var attachment in attachments) { + for (let attachment of attachments) { var linkMode = attachment.attachmentLinkMode; // Skip linked files @@ -2069,7 +2069,7 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r var sameLibrary = false; } - for each(var item in items) { + for (let item of items) { if (!item.isTopLevelItem()) { continue; } @@ -2126,7 +2126,7 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r var lastWin = wm.getMostRecentWindow("navigator:browser"); lastWin.openDialog('chrome://zotero/content/merge.xul', '', 'chrome,modal,centerscreen', io); - for each(var obj in io.dataOut) { + for (let obj of io.dataOut) { yield obj.ref.save(); } } diff --git a/chrome/content/zotero/xpcom/data/cachedTypes.js b/chrome/content/zotero/xpcom/data/cachedTypes.js index b9691c29c..620a2b0b0 100644 --- a/chrome/content/zotero/xpcom/data/cachedTypes.js +++ b/chrome/content/zotero/xpcom/data/cachedTypes.js @@ -283,7 +283,7 @@ Zotero.CreatorTypes = new function() { var valid = false; var types = this.getTypesForItemType(itemTypeID); - for each(var type in types) { + for (let type of types) { if (type.id == creatorTypeID) { valid = true; break; diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 33ac2074b..56fe5dbea 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -447,7 +447,7 @@ Zotero.Item.prototype.setType = function(itemTypeID, loadIn) { } } - for each(var oldFieldID in obsoleteFields) { + for (let oldFieldID of obsoleteFields) { // Try to get a base type for this field var baseFieldID = Zotero.ItemFields.getBaseIDFromTypeAndField(oldItemTypeID, oldFieldID); @@ -532,14 +532,14 @@ Zotero.Item.prototype.setType = function(itemTypeID, loadIn) { // Initialize this._itemData with type-specific fields this._itemData = {}; var fields = Zotero.ItemFields.getItemTypeFields(itemTypeID); - for each(var fieldID in fields) { + for (let fieldID of fields) { this._itemData[fieldID] = null; } // DEBUG: clear change item data? if (copiedFields) { - for each(var f in copiedFields) { + for (let f of copiedFields) { // For fields that we moved to different fields in the new type // (e.g., book -> bookTitle), mark the old value as explicitly // false in previousData (since otherwise it would be null) @@ -3793,7 +3793,7 @@ Zotero.Item.prototype.diff = function (item, includeMatches, ignoreFields) { throw ("ignoreFields cannot be used if includeMatches is set"); } var realDiffs = numDiffs; - for each(var field in ignoreFields) { + for (let field of ignoreFields) { if (diff[0].primary[field] != undefined) { realDiffs--; if (realDiffs == 0) { diff --git a/chrome/content/zotero/xpcom/data/itemFields.js b/chrome/content/zotero/xpcom/data/itemFields.js index d3a490af8..9dcb0983b 100644 --- a/chrome/content/zotero/xpcom/data/itemFields.js +++ b/chrome/content/zotero/xpcom/data/itemFields.js @@ -75,7 +75,7 @@ Zotero.ItemFields = new function() { var sql = "SELECT DISTINCT baseFieldID FROM baseFieldMappingsCombined"; var baseFields = yield Zotero.DB.columnQueryAsync(sql); - for each(var field in fields) { + for (let field of fields) { _fields[field['fieldID']] = { id: field['fieldID'], name: field.fieldName, @@ -440,7 +440,7 @@ Zotero.ItemFields = new function() { var baseFields = yield Zotero.DB.columnQueryAsync(sql); var fields = []; - for each(var row in rows) { + for (let row of rows) { if (!fields[row.itemTypeID]) { fields[row.itemTypeID] = []; } diff --git a/chrome/content/zotero/xpcom/data/items.js b/chrome/content/zotero/xpcom/data/items.js index 91706dabd..0391fa760 100644 --- a/chrome/content/zotero/xpcom/data/items.js +++ b/chrome/content/zotero/xpcom/data/items.js @@ -743,12 +743,12 @@ Zotero.Items = function() { var toSave = {}; toSave[item.id] = item; - for each(var otherItem in otherItems) { + for (let otherItem of otherItems) { let otherItemURI = Zotero.URI.getItemURI(otherItem); // Move child items to master var ids = otherItem.getAttachments(true).concat(otherItem.getNotes(true)); - for each(var id in ids) { + for (let id of ids) { var attachment = yield this.getAsync(id); // TODO: Skip identical children? diff --git a/chrome/content/zotero/xpcom/data/search.js b/chrome/content/zotero/xpcom/data/search.js index 209ec4895..8da92927a 100644 --- a/chrome/content/zotero/xpcom/data/search.js +++ b/chrome/content/zotero/xpcom/data/search.js @@ -255,7 +255,7 @@ Zotero.Search.prototype.clone = function (libraryID) { var conditions = this.getConditions(); - for each(var condition in conditions) { + for (let condition of Object.values(conditions)) { var name = condition.mode ? condition.condition + '/' + condition.mode : condition.condition @@ -299,7 +299,7 @@ Zotero.Search.prototype.addCondition = function (condition, operator, value, req if (condition.match(/^quicksearch/)) { var parts = Zotero.SearchConditions.parseSearchString(value); - for each(var part in parts) { + for (let part of parts) { this.addCondition('blockStart'); // If search string is 8 characters, see if this is a item key @@ -329,7 +329,7 @@ Zotero.Search.prototype.addCondition = function (condition, operator, value, req } else { var splits = Zotero.Fulltext.semanticSplitter(part.text); - for each(var split in splits) { + for (let split of splits) { this.addCondition('fulltextWord', operator, split, false); } } @@ -498,7 +498,7 @@ Zotero.Search.prototype.getConditions = function(){ Zotero.Search.prototype.hasPostSearchFilter = function() { this._requireData('conditions'); - for each(var i in this._conditions){ + for (let i of Object.values(this._conditions)) { if (i.condition == 'fulltextContent'){ return true; } @@ -530,7 +530,7 @@ Zotero.Search.prototype.search = Zotero.Promise.coroutine(function* (asTempTable var joinMode = 'all'; // Set some variables for conditions to avoid further lookups - for each(var condition in this._conditions) { + for (let condition of Object.values(this._conditions)) { switch (condition.condition) { case 'joinMode': if (condition.operator == 'any') { @@ -632,7 +632,7 @@ Zotero.Search.prototype.search = Zotero.Promise.coroutine(function* (asTempTable // If join mode ANY or there's a quicksearch (which we assume // fulltextContent is part of), return the union of the main search and // (a separate fulltext word search filtered by fulltext content) - for each(var condition in this._conditions){ + for (let condition of Object.values(this._conditions)){ if (condition['condition']=='fulltextContent'){ var fulltextWordIntersectionFilter = function (val, index, array) !!hash[val]; var fulltextWordIntersectionConditionFilter = function(val, index, array) { @@ -669,7 +669,7 @@ Zotero.Search.prototype.search = Zotero.Promise.coroutine(function* (asTempTable // Add any necessary conditions to the fulltext word search -- // those that are required in an ANY search and any outside the // quicksearch in an ALL search - for each(var c in this._conditions) { + for (let c of Object.values(this._conditions)) { if (c.condition == 'blockStart') { var inQS = true; continue; @@ -688,7 +688,7 @@ Zotero.Search.prototype.search = Zotero.Promise.coroutine(function* (asTempTable } var splits = Zotero.Fulltext.semanticSplitter(condition.value); - for each(var split in splits){ + for (let split of splits){ s.addCondition('fulltextWord', condition.operator, split); } var fulltextWordIDs = yield s.search(); @@ -1043,7 +1043,7 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () { if (this._hasPrimaryConditions) { sql += " AND "; - for each(var condition in conditions){ + for (let condition of Object.values(conditions)){ var skipOperators = false; var openParens = 0; var condSQL = ''; @@ -1088,7 +1088,7 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () { if (typeFields) { condSQL += 'fieldID IN (?,'; // Add type-specific fields - for each(var fieldID in typeFields) { + for (let fieldID of typeFields) { condSQL += '?,'; condSQLParams.push(fieldID); } @@ -1113,7 +1113,7 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () { if (dateFields) { condSQL += 'fieldID IN (?,'; // Add type-specific date fields (dateEnacted, dateDecided, issueDate) - for each(var fieldID in dateFields) { + for (let fieldID of dateFields) { condSQL += '?,'; condSQLParams.push(fieldID); } @@ -1148,7 +1148,7 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () { // for the collection/search if (objLibraryID === undefined) { let foundLibraryID = false; - for each (let c in this._conditions) { + for (let c of Object.values(this._conditions)) { if (c.condition == 'libraryID' && c.operator == 'is') { foundLibraryID = true; obj = yield objectTypeClass.getByLibraryAndKeyAsync( @@ -1246,7 +1246,7 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () { + 'fileTypeID=?)'; var patterns = yield Zotero.DB.columnQueryAsync(ftSQL, { int: condition.value }); if (patterns) { - for each(str in patterns) { + for (let str of patterns) { condSQL += 'contentType LIKE ? OR '; condSQLParams.push(str + '%'); } @@ -1402,7 +1402,7 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () { if (useFreeform && dateparts['part']){ go = true; var parts = dateparts['part'].split(' '); - for each (var part in parts){ + for (let part of parts) { condSQL += " AND SUBSTR(" + condition['field'] + ", 12, 100)"; condSQL += " LIKE ?"; condSQLParams.push('%' + part + '%'); diff --git a/chrome/content/zotero/xpcom/duplicates.js b/chrome/content/zotero/xpcom/duplicates.js index d0a066e10..e6e678630 100644 --- a/chrome/content/zotero/xpcom/duplicates.js +++ b/chrome/content/zotero/xpcom/duplicates.js @@ -392,7 +392,7 @@ Zotero.Duplicates.prototype._findDuplicates = Zotero.Promise.coroutine(function* // Match on exact fields /*var fields = ['']; - for each(var field in fields) { + for (let field of fields) { var sql = "SELECT itemID, value FROM items JOIN itemData USING (itemID) " + "JOIN itemDataValues USING (valueID) " + "WHERE libraryID=? AND fieldID=? " diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 547b6082e..ef31ddc11 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -1500,7 +1500,7 @@ Zotero.Integration.Fields.prototype._processFields = function(i) { e.setContext(this, i) } else if(e instanceof Zotero.Integration.MissingItemException) { // Check if we've already decided to remove this field code - for each(var reselectKey in e.reselectKeys) { + for (let reselectKey of e.reselectKeys) { if(this._removeCodeKeys[reselectKey]) { this._removeCodeFields[i] = true; removeCode = true; @@ -2173,7 +2173,7 @@ Zotero.Integration.Session.prototype.reselectItem = function(doc, exception) { var itemID = io.dataOut[0]; // add reselected item IDs to hash, so they can be used - for each(var reselectKey in exception.reselectKeys) { + for (let reselectKey of exception.reselectKeys) { me.reselectedItems[reselectKey] = itemID; } // add old URIs to map, so that they will be included @@ -2379,7 +2379,7 @@ Zotero.Integration.Session.prototype.lookupItems = function(citation, index) { } // look to see if item has already been reselected - for each(var reselectKey in reselectKeys) { + for (let reselectKey of reselectKeys) { if(this.reselectedItems[reselectKey]) { zoteroItem = Zotero.Items.get(this.reselectedItems[reselectKey]); citationItem.id = zoteroItem.id; @@ -2479,7 +2479,7 @@ Zotero.Integration.Session.prototype.unserializeCitation = function(arg, index) if(!citation.properties) citation.properties = {}; - for each(var citationItem in citation.citationItems) { + for (let citationItem of citation.citationItems) { // for upgrade from Zotero 2.0 or earlier if(citationItem.locatorType) { citationItem.label = citationItem.locatorType; @@ -2634,7 +2634,7 @@ Zotero.Integration.Session.prototype.formatCitation = function(index, citation) Zotero.debug("Integration: style.processCitationCluster("+citation.toSource()+", "+citationsPre.toSource()+", "+citationsPost.toSource()); } var newCitations = this.style.processCitationCluster(citation, citationsPre, citationsPost); - for each(var newCitation in newCitations[1]) { + for (let newCitation of newCitations[1]) { this.citationText[citationIndices[newCitation[0]]] = newCitation[1]; this.updateIndices[citationIndices[newCitation[0]]] = true; } @@ -2651,7 +2651,7 @@ Zotero.Integration.Session.prototype._updateCitations = function* () { if(force) { allUpdatesForced = true; // make sure at least one citation gets updated - updateLoop: for each(var indexList in [this.newIndices, this.updateIndices]) { + updateLoop: for (let indexList of [this.newIndices, this.updateIndices]) { for(var i in indexList) { if(!this.citationsByIndex[i].properties.delete) { allUpdatesForced = false; @@ -2736,7 +2736,7 @@ Zotero.Integration.Session.prototype.loadBibliographyData = function(json) { if(documentData.uncited[0]) { // new style array of arrays with URIs let zoteroItem, needUpdate; - for each(var uris in documentData.uncited) { + for (let uris of documentData.uncited) { [zoteroItem, needUpdate] = this.uriMap.getZoteroItemForURIs(uris); var id = zoteroItem.cslItemID ? zoteroItem.cslItemID : zoteroItem.id; if(zoteroItem && !this.citationsByItemID[id]) { @@ -2765,7 +2765,7 @@ Zotero.Integration.Session.prototype.loadBibliographyData = function(json) { if(documentData.custom[0]) { // new style array of arrays with URIs var zoteroItem, needUpdate; - for each(var custom in documentData.custom) { + for (let custom of documentData.custom) { [zoteroItem, needUpdate] = this.uriMap.getZoteroItemForURIs(custom[0]); if(!zoteroItem) continue; if(needUpdate) this.bibliographyDataHasChanged = true; @@ -2794,7 +2794,7 @@ Zotero.Integration.Session.prototype.loadBibliographyData = function(json) { // set entries to be omitted from bibliography if(documentData.omitted) { let zoteroItem, needUpdate; - for each(var uris in documentData.omitted) { + for (let uris of documentData.omitted) { [zoteroItem, update] = this.uriMap.getZoteroItemForURIs(uris); var id = zoteroItem.cslItemID ? zoteroItem.cslItemID : zoteroItem.id; if(zoteroItem && this.citationsByItemID[id]) { diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js index 312fc082a..85843c5d3 100644 --- a/chrome/content/zotero/xpcom/itemTreeView.js +++ b/chrome/content/zotero/xpcom/itemTreeView.js @@ -516,7 +516,7 @@ Zotero.ItemTreeView.prototype.notify = Zotero.Promise.coroutine(function* (actio var col = this._treebox.columns.getNamedColumn( 'zotero-items-column-' + extraData.column ); - for each(var id in ids) { + for (let id of ids) { if (extraData.column == 'title') { delete this._itemImages[id]; } @@ -524,7 +524,7 @@ Zotero.ItemTreeView.prototype.notify = Zotero.Promise.coroutine(function* (actio } } else { - for each(var id in ids) { + for (let id of ids) { delete this._itemImages[id]; this._treebox.invalidateRow(this._rowMap[id]); } @@ -589,7 +589,7 @@ Zotero.ItemTreeView.prototype.notify = Zotero.Promise.coroutine(function* (actio } var splitIDs = []; - for each(var id in ids) { + for (let id of ids) { var split = id.split('-'); // Skip if not an item in this collection if (split[0] != collectionTreeRow.ref.id) { @@ -764,7 +764,7 @@ Zotero.ItemTreeView.prototype.notify = Zotero.Promise.coroutine(function* (actio var allDeleted = true; var isTrash = collectionTreeRow.isTrash(); var items = Zotero.Items.get(ids); - for each(var item in items) { + for (let item of items) { // If not viewing trash and all items were deleted, ignore modify if (allDeleted && !isTrash && !item.deleted) { allDeleted = false; @@ -857,7 +857,7 @@ Zotero.ItemTreeView.prototype.notify = Zotero.Promise.coroutine(function* (actio var items = Zotero.Items.get(ids); if (items) { var found = false; - for each(var item in items) { + for (let item of items) { // Check for note and attachment type, since it's quicker // than checking for parent item if (item.itemTypeID == 1 || item.itemTypeID == 14) { @@ -1778,7 +1778,7 @@ Zotero.ItemTreeView.prototype.selectItems = function(ids) { } var rows = []; - for each(var id in ids) { + for (let id of ids) { if(this._rowMap[id] !== undefined) rows.push(this._rowMap[id]); } rows.sort(function (a, b) { @@ -2045,7 +2045,7 @@ Zotero.ItemTreeView.prototype._saveOpenState = function (close) { Zotero.ItemTreeView.prototype.rememberOpenState = function (itemIDs) { var rowsToOpen = []; - for each(var id in itemIDs) { + for (let id of itemIDs) { var row = this._rowMap[id]; // Item may not still exist if (row == undefined) { @@ -2190,7 +2190,7 @@ Zotero.ItemTreeView.prototype.getVisibleFields = function() { */ Zotero.ItemTreeView.prototype.getSortedItems = function(asIDs) { var items = []; - for each(var item in this._rows) { + for (let item of this._rows) { if (asIDs) { items.push(item.ref.id); } @@ -2863,7 +2863,7 @@ Zotero.ItemTreeView.prototype.canDropCheck = function (row, orient, dataTransfer if (rowItem) { var canDrop = false; - for each(var item in items) { + for (let item of items) { // If any regular items, disallow drop if (item.isRegularItem()) { return false; @@ -2885,7 +2885,7 @@ Zotero.ItemTreeView.prototype.canDropCheck = function (row, orient, dataTransfer // In library, allow children to be dragged out of parent else if (collectionTreeRow.isLibrary(true) || collectionTreeRow.isCollection()) { - for each(var item in items) { + for (let item of items) { // Don't allow drag if any top-level items if (item.isTopLevelItem()) { return false; diff --git a/chrome/content/zotero/xpcom/locateManager.js b/chrome/content/zotero/xpcom/locateManager.js index dc3c09f00..418502cc0 100644 --- a/chrome/content/zotero/xpcom/locateManager.js +++ b/chrome/content/zotero/xpcom/locateManager.js @@ -89,7 +89,7 @@ Zotero.LocateManager = new function() { */ this.getEngineByName = function(engineName) { engineName = engineName.toLowerCase(); - for each(var engine in _locateEngines) if(engine.name.toLowerCase() == engineName) return engine; + for (let engine of _locateEngines) if(engine.name.toLowerCase() == engineName) return engine; return null; } @@ -98,7 +98,7 @@ Zotero.LocateManager = new function() { */ this.getEngineByAlias = function(engineAlias) { engineAlias = engineAlias.toLowerCase(); - for each(var engine in _locateEngines) if(engine.alias.toLowerCase() == engineAlias) return engine; + for (let engine of _locateEngines) if(engine.alias.toLowerCase() == engineAlias) return engine; return null; } diff --git a/chrome/content/zotero/xpcom/progressWindow.js b/chrome/content/zotero/xpcom/progressWindow.js index ed6557c8f..ed2156d57 100644 --- a/chrome/content/zotero/xpcom/progressWindow.js +++ b/chrome/content/zotero/xpcom/progressWindow.js @@ -219,7 +219,7 @@ Zotero.ProgressWindow = function(_window = null) { var newDescription = _progressWindow.document.createElement("description"); var parts = Zotero.Utilities.parseMarkup(text); - for each(var part in parts) { + for (let part of parts) { if (part.type == 'text') { var elem = _progressWindow.document.createTextNode(part.text); } diff --git a/chrome/content/zotero/xpcom/proxy.js b/chrome/content/zotero/xpcom/proxy.js index 28f5b0c5f..379d0943c 100644 --- a/chrome/content/zotero/xpcom/proxy.js +++ b/chrome/content/zotero/xpcom/proxy.js @@ -49,8 +49,8 @@ Zotero.Proxies = new function() { rows.map(row => this.newProxyFromRow(row)) ); - for each(var proxy in Zotero.Proxies.proxies) { - for each(var host in proxy.hosts) { + for (let proxy of Zotero.Proxies.proxies) { + for (let host of proxy.hosts) { Zotero.Proxies.hosts[host] = proxy; } } @@ -104,7 +104,7 @@ Zotero.Proxies = new function() { // see if there is a proxy we already know var m = false; var proxy; - for each(proxy in Zotero.Proxies.proxies) { + for (proxy of Zotero.Proxies.proxies) { if(proxy.proxyID && proxy.regexp && proxy.multiHost) { m = proxy.regexp.exec(url); if(m) break; @@ -304,7 +304,7 @@ Zotero.Proxies = new function() { // if there is a proxy ID (i.e., if this is a persisting, transparent proxy), add to host // list to do reverse mapping if(proxy.proxyID) { - for each(var host in proxy.hosts) { + for (let host of proxy.hosts) { Zotero.Proxies.hosts[host] = proxy; } } @@ -336,7 +336,7 @@ Zotero.Proxies = new function() { * @type String */ this.proxyToProper = function(url, onlyReturnIfProxied) { - for each(var proxy in Zotero.Proxies.proxies) { + for (let proxy of Zotero.Proxies.proxies) { if(proxy.regexp) { var m = proxy.regexp.exec(url); if(m) { @@ -456,9 +456,9 @@ Zotero.Proxies = new function() { /^muse\.jhu\.edu$/ ] - for each(var blackPattern in hostBlacklist) { + for (let blackPattern of hostBlacklist) { if(blackPattern.test(host)) { - for each(var whitePattern in hostWhitelist) { + for (let whitePattern of hostWhitelist) { if(whitePattern.test(host)) { return false; } @@ -702,7 +702,7 @@ Zotero.Proxy.prototype.validate = function() { return ["scheme.invalid"]; } - for each(var host in this.hosts) { + for (let host of this.hosts) { var oldHost = Zotero.Proxies.hosts[host]; if(oldHost && oldHost.proxyID && oldHost != this) { return ["host.proxyExists", host]; @@ -903,7 +903,7 @@ Zotero.Proxies.Detectors.EZProxy = function(channel) { if(fromProxy && toProxy && fromProxy.host == toProxy.host && fromProxy.port != toProxy.port && [80, 443, -1].indexOf(toProxy.port) == -1) { var proxy; - for each(proxy in Zotero.Proxies.proxies) { + for (proxy of Zotero.Proxies.proxies) { if(proxy.regexp) { var m = proxy.regexp.exec(fromProxy.spec); if(m) break; diff --git a/chrome/content/zotero/xpcom/quickCopy.js b/chrome/content/zotero/xpcom/quickCopy.js index 7a1905742..25fc5e5de 100644 --- a/chrome/content/zotero/xpcom/quickCopy.js +++ b/chrome/content/zotero/xpcom/quickCopy.js @@ -464,7 +464,7 @@ Zotero.QuickCopy = new function() { // add styles to list _formattedNames = {}; var styles = Zotero.Styles.getVisible(); - for each(var style in styles) { + for (let style of styles) { _formattedNames['bibliography=' + style.styleID] = style.title; } diff --git a/chrome/content/zotero/xpcom/report.js b/chrome/content/zotero/xpcom/report.js index c58e3953e..ba801de17 100644 --- a/chrome/content/zotero/xpcom/report.js +++ b/chrome/content/zotero/xpcom/report.js @@ -98,7 +98,7 @@ Zotero.Report.HTML = new function () { content += '\t\t\t\t

' + escapeXML(Zotero.getString('report.notes')) + '

\n'; } content += '\t\t\t\t