progress on clicking breeding partners

This commit is contained in:
Chris kerr 2024-01-31 22:05:12 -05:00
parent e84164f529
commit 850eec73bb
3 changed files with 57 additions and 75 deletions

View File

@ -1,5 +1,3 @@
// breeding.js
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
const monsterNames = document.querySelectorAll(".monster-name"); const monsterNames = document.querySelectorAll(".monster-name");
const familyDropdown = document.getElementById("familyDropdown"); const familyDropdown = document.getElementById("familyDropdown");
@ -17,17 +15,22 @@ document.addEventListener("DOMContentLoaded", function () {
}); });
function updateDropdownAndIframes(selectedMonster, familyDropdown, monsterDropdown) { function updateDropdownAndIframes(selectedMonster, familyDropdown, monsterDropdown) {
// Check if both familyDropdown and monsterDropdown exist
if (familyDropdown && monsterDropdown) {
// Update the monsterDropdown value // Update the monsterDropdown value
monsterDropdown.value = selectedMonster; monsterDropdown.value = selectedMonster;
// Update families dropdown (if needed) // Update families dropdown
updateMonstersDropdown(familyDropdown); updateMonstersDropdown(familyDropdown);
// Trigger updateIframes function // Trigger updateIframes function
updateIframes(familyDropdown, monsterDropdown); updateIframes(familyDropdown, monsterDropdown);
} }
}
function updateMonstersDropdown(familyDropdown) { function updateMonstersDropdown(familyDropdown) {
// Check if familyDropdown exists
if (familyDropdown) {
const selectedFamily = familyDropdown.value; const selectedFamily = familyDropdown.value;
// Fetch monsters data from the server based on the selected family // Fetch monsters data from the server based on the selected family
@ -36,8 +39,11 @@ function updateMonstersDropdown(familyDropdown) {
.then(data => populateDropdown(monsterDropdown, data)) .then(data => populateDropdown(monsterDropdown, data))
.catch(error => console.error("Error fetching monsters:", error)); .catch(error => console.error("Error fetching monsters:", error));
} }
}
function updateIframes(familyDropdown, monsterDropdown) { function updateIframes(familyDropdown, monsterDropdown) {
// Check if both familyDropdown and monsterDropdown exist
if (familyDropdown && monsterDropdown) {
const selectedFamily = familyDropdown.value; const selectedFamily = familyDropdown.value;
const selectedMonster = monsterDropdown.value; const selectedMonster = monsterDropdown.value;
@ -61,8 +67,11 @@ function updateIframes(familyDropdown, monsterDropdown) {
breedingIframe.src = breedingIframeSrc; breedingIframe.src = breedingIframeSrc;
} }
}
function populateDropdown(dropdown, data) { function populateDropdown(dropdown, data) {
// Check if dropdown exists
if (dropdown) {
// Clear existing options // Clear existing options
dropdown.innerHTML = '<option value="">All</option>'; dropdown.innerHTML = '<option value="">All</option>';
@ -74,3 +83,4 @@ function populateDropdown(dropdown, data) {
dropdown.appendChild(option); dropdown.appendChild(option);
}); });
} }
}

View File

@ -540,40 +540,6 @@ video {
--tw-backdrop-sepia: ; --tw-backdrop-sepia: ;
} }
.container {
width: 100%;
}
@media (min-width: 640px) {
.container {
max-width: 640px;
}
}
@media (min-width: 768px) {
.container {
max-width: 768px;
}
}
@media (min-width: 1024px) {
.container {
max-width: 1024px;
}
}
@media (min-width: 1280px) {
.container {
max-width: 1280px;
}
}
@media (min-width: 1536px) {
.container {
max-width: 1536px;
}
}
.static { .static {
position: static; position: static;
} }
@ -650,6 +616,11 @@ video {
background-color: rgb(30 41 59 / var(--tw-bg-opacity)); background-color: rgb(30 41 59 / var(--tw-bg-opacity));
} }
.bg-purple-500 {
--tw-bg-opacity: 1;
background-color: rgb(168 85 247 / var(--tw-bg-opacity));
}
.p-2 { .p-2 {
padding: 0.5rem; padding: 0.5rem;
} }

View File

@ -35,7 +35,8 @@
src="" src=""
class="p-2 ml-4 border-2 border-teal-500 rounded-md" class="p-2 ml-4 border-2 border-teal-500 rounded-md"
height="200" height="200"
width="272"> width="272"
>
</iframe> </iframe>
</div> </div>
</div> </div>