Skip to content

Commit b1eebc2

Browse files
committed
revised the update
1 parent 3fca0c3 commit b1eebc2

1 file changed

Lines changed: 0 additions & 50 deletions

File tree

script.js

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -32,55 +32,6 @@ console.log(document.querySelectorAll(".master-img"));
3232
window.onload = function() {
3333
console.log("Page fully loaded! Fetching Servant data...");
3434
fetchServantData();};
35-
//now the code for the servant data:
36-
async function fetchServantData() {
37-
const url = 'https://api.atlasacademy.io/export/NA/basic_servant.json';
38-
39-
try {
40-
console.log("Fetching Servant List...");
41-
const response = await fetch(url);
42-
const servantsList = await response.json();
43-
44-
if (!Array.isArray(servantsList)) {
45-
console.error("Invalid response: Expected an array but got", servantsList);
46-
return;
47-
}
48-
49-
console.log("Servants List Fetched:", servantsList);
50-
51-
// Prepare an array to store only necessary data
52-
const servantDataArray = servantsList.map(servant => ({
53-
id: servant.id,
54-
name: servant.name,
55-
image: servant.face, // This contains their default portrait
56-
hasIndependentAction: false // Placeholder, since this isn't in basic_servant.json
57-
}));
58-
59-
console.log("Final Servant Data Array:", servantDataArray);
60-
populateServantDropdown(servantDataArray);
61-
} catch (error) {
62-
console.error("Error fetching Servant data:", error);
63-
}
64-
}
65-
// Example function to populate a dropdown with Servant names
66-
function populateServantDropdown(servantDataArray) {
67-
// Select ALL servant dropdowns using the class
68-
document.querySelectorAll(".servant-select").forEach((dropdown) => {
69-
// Clear existing options except the default "Choose a Servant"
70-
dropdown.innerHTML = '<option value="">Choose a Servant</option>';
71-
72-
// Add each Servant to the dropdown
73-
servantDataArray.forEach(servant => {
74-
const option = document.createElement("option");
75-
option.value = servant.id; // Use Servant ID
76-
option.textContent = servant.name;
77-
option.dataset.name = servant.name;
78-
dropdown.appendChild(option); // <-- fixed here
79-
});
80-
});
81-
}
82-
// Call the function to fetch and process Servant data
83-
fetchServantData();
8435
// now the code for the servant data:
8536
async function fetchServantData() {
8637
const url = 'https://api.atlasacademy.io/export/NA/basic_servant.json';
@@ -201,7 +152,6 @@ document.addEventListener("DOMContentLoaded", function () {
201152
});
202153

203154

204-
205155
//simulation button function:
206156
function saveParticipantsAndStartSimulation() {
207157
let masterContainers = document.querySelectorAll(".master");

0 commit comments

Comments
 (0)