diff --git a/pages/wins/wins.html b/pages/wins/wins.html index 4587c9c754..506dce498b 100644 --- a/pages/wins/wins.html +++ b/pages/wins/wins.html @@ -89,7 +89,7 @@ //cardData[index][question_str] = answer_str let cardData = [] const keys = rawData[0] - rawData.slice(1).forEach((data) => { + rawData.slice(1).forEach( data => { let cardObj = {} for (let i = 0; i < keys.length; i++) { cardObj[keys[i]] = data[i]; @@ -100,11 +100,10 @@ window.localStorage.setItem('data', JSON.stringify(cardData)); makeCards(cardData); ifPageEmpty(); - } - //Create The Filters From The Displayed Cards On Page Load + //Create The "Role" and "Team" Filters From The Displayed Cards On Page Load document.addEventListener("DOMContentLoaded", createFilter); function createFilter(){ @@ -118,12 +117,11 @@ Array.isArray(team) ? teamArr.push(...team) : teamArr.push(team); }) + //Assign Role for each Wins-Card responses.querySelectorAll('.wins-card-role:not([style*="display:none"]):not([style*="display: none"]').forEach(item =>{ let value = item.textContent.replace("Role(s):","").trim(); let role = value.split(",").map(x=>x.trim()); Array.isArray(role) ? roleArr.push(...role) : roleArr.push(role); - - }) @@ -169,7 +167,7 @@ let queryObj = { }; //Calculate and Create Updated Query String - incomingFilterData.forEach(function(e){ + incomingFilterData.forEach( e => { //Find boxes that are checked if(e.checked){ let data = e.value.split("_"); @@ -203,10 +201,6 @@ //Update URL parameters window.history.replaceState(null, '', urlParameter.replaceAll(" ","+")); - - - - } //Update UI on URL history change and on DomContent loaded @@ -296,20 +290,20 @@ const iconContainer = cloneCardTemplate.querySelector(cardSelector); - cardList.forEach( (item) => { + cardList.forEach( item => { if (badgeIcons.hasOwnProperty(item)) { iconContainer.insertAdjacentHTML('beforeend', `
- ${badgeIcons[item]} -
${item}
-
` + ${badgeIcons[item]} +
${item}
+ ` ) } else if (item !== '') { iconContainer.insertAdjacentHTML('beforeend', `
- ${badgeIcons[otherIcon]} -
${item}
-
` + ${badgeIcons[otherIcon]} +
${item}
+ ` ) } })