breed usage no longer has any duplicates
This commit is contained in:
parent
ac2f700ae1
commit
d6565acc7f
@ -10,20 +10,27 @@ function updateBreedingUsage() {
|
|||||||
renderOffspringList(data.used_in);
|
renderOffspringList(data.used_in);
|
||||||
})
|
})
|
||||||
.catch(error => console.error('Error fetching data:', error));
|
.catch(error => console.error('Error fetching data:', error));
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderOffspringList(usageData) {
|
function renderOffspringList(usageData) {
|
||||||
var offspringContainer = document.getElementById("offspringContainer");
|
var offspringContainer = document.getElementById("offspringContainer");
|
||||||
|
|
||||||
// Clear previous HTML content
|
// Clear previous HTML content
|
||||||
offspringContainer.innerHTML = "<h2 class='text-xl font-bold'>Used to Breed: </h2><ul class='list-disc'>";
|
offspringContainer.innerHTML = "<h2 class='text-xl font-bold'>Used to Breed: </h2><ul class='list-disc'>";
|
||||||
|
|
||||||
// Create and append HTML for each offspring
|
// Create a Set to store unique offspring monsters
|
||||||
|
var uniqueOffspringSet = new Set();
|
||||||
|
|
||||||
|
// Add unique offspring to the Set
|
||||||
usageData.forEach(item => {
|
usageData.forEach(item => {
|
||||||
|
uniqueOffspringSet.add(item.offspring);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create and append HTML for each unique offspring
|
||||||
|
uniqueOffspringSet.forEach(offspring => {
|
||||||
var offspringHTML = `<li class='font-bold marker:text-slate-400 text-purple-300'>
|
var offspringHTML = `<li class='font-bold marker:text-slate-400 text-purple-300'>
|
||||||
${item.offspring}
|
${offspring}
|
||||||
</li>
|
</li>`;
|
||||||
`;
|
|
||||||
offspringContainer.innerHTML += offspringHTML;
|
offspringContainer.innerHTML += offspringHTML;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user