From f5890dc596f42e33855b8a833c6d2a9a8b8af282 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Tue, 13 Oct 2020 11:49:29 -0400 Subject: [PATCH] use "of" for loop --- src/interaction/siUtilities.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/interaction/siUtilities.js b/src/interaction/siUtilities.js index 1284b47b397..55bd7902426 100644 --- a/src/interaction/siUtilities.js +++ b/src/interaction/siUtilities.js @@ -44,40 +44,40 @@ App.UI.SlaveInteract.placeInLine = function(slave) { */ App.UI.SlaveInteract.generateRows = function(array, slave, category, accessCheck = false, refresh) { const linkArray = []; - for (let i = 0; i < array.length; i++) { + for (const item of array) { let link; // Some items will never be in App.Data.slaveWear, especially "none" if it falls in between harsh and nice data sets. Trying to look it up would cause an error, which is what access check works around. let unlocked = false; if (accessCheck === true) { - const itemName = (category === "chastity") ? array[i].text.toLowerCase() : array[i].updateSlave[category]; // Yucky. Category name does not match for chastity (since it sets multiple kinds of chastity at once). Compare using a lowercase name instead. + const itemName = (category === "chastity") ? item.text.toLowerCase() : item.updateSlave[category]; // Yucky. Category name does not match for chastity (since it sets multiple kinds of chastity at once). Compare using a lowercase name instead. unlocked = isItemAccessible.entry(itemName, category, slave); } if (accessCheck === false || unlocked) { // is it just text? - if (array[i].disabled) { - link = App.UI.DOM.disabledLink(array[i].text, [array[i].disabled]); + if (item.disabled) { + link = App.UI.DOM.disabledLink(item.text, [item.disabled]); } else if (typeof unlocked === 'string') { - link = App.UI.DOM.disabledLink(array[i].text, [unlocked]); + link = App.UI.DOM.disabledLink(item.text, [unlocked]); } else { link = document.createElement('span'); // Set up the link link.appendChild( App.UI.DOM.link( - `${array[i].text} `, - () => { click(array[i]); }, + `${item.text} `, + () => { click(item); }, ) ); - if (array[i].FS) { - let FS = App.UI.DOM.disabledLink(`FS`, [FutureSocieties.displayAdj(array[i].FS)]); + if (item.FS) { + let FS = App.UI.DOM.disabledLink(`FS`, [FutureSocieties.displayAdj(item.FS)]); FS.style.fontStyle = "italic"; link.appendChild(FS); } // add a note node if required - if (array[i].note) { - link.appendChild(App.UI.DOM.makeElement('span', ` ${array[i].note}`, 'note')); + if (item.note) { + link.appendChild(App.UI.DOM.makeElement('span', ` ${item.note}`, 'note')); } } linkArray.push(link); -- GitLab