2024-02-02 02:52:59 +00:00
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
|
|
const familyDropdown = document.getElementById("familyDropdown");
|
|
|
|
const monsterDropdown = document.getElementById("monsterDropdown");
|
|
|
|
|
2024-02-02 15:03:55 +00:00
|
|
|
// Initialize dropdowns
|
2024-02-02 20:39:43 +00:00
|
|
|
updateMonsterDropdownByFamily();
|
2024-02-02 02:52:59 +00:00
|
|
|
|
2024-02-02 15:03:55 +00:00
|
|
|
// Fetch families data from the server and populate families dropdown
|
2024-02-05 19:37:24 +00:00
|
|
|
fetch("/api/families")
|
2024-02-02 02:52:59 +00:00
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => {
|
|
|
|
populateDropdown(familyDropdown, data);
|
|
|
|
})
|
|
|
|
.catch(error => console.error("Error fetching families:", error));
|
|
|
|
|
2024-02-02 15:03:55 +00:00
|
|
|
// Listeners for Dropdown Changes
|
2024-02-02 02:52:59 +00:00
|
|
|
familyDropdown.addEventListener("change", function () {
|
2024-02-02 20:39:43 +00:00
|
|
|
updateMonsterDropdownByFamily();
|
2024-02-02 02:52:59 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
monsterDropdown.addEventListener("change", function () {
|
2024-02-21 13:26:28 +00:00
|
|
|
updateMonsterStats();
|
2024-02-21 14:00:24 +00:00
|
|
|
updateMonsterName();
|
2024-02-21 14:58:42 +00:00
|
|
|
updateMonsterFamily();
|
|
|
|
updateMonsterLocation();
|
2024-02-21 15:43:08 +00:00
|
|
|
updateMonsterSkills();
|
2024-02-23 16:50:07 +00:00
|
|
|
updateBreedingPairs();
|
2024-02-23 21:12:14 +00:00
|
|
|
updateBreedingUsage();
|
2024-02-21 13:26:28 +00:00
|
|
|
});
|
2024-02-02 02:52:59 +00:00
|
|
|
});
|