Sync both clan lists.

This commit is contained in:
MaxJa4
2024-01-15 11:01:51 +01:00
parent fe92068ad3
commit 49a6b8de38
11 changed files with 193 additions and 42 deletions

25
static/index.js Normal file
View File

@@ -0,0 +1,25 @@
function setupClanButtons(dropdownId, delBtnId, editBtnId) {
const dropdown = document.getElementById(dropdownId);
const deleteButton = document.getElementById(delBtnId);
const editButton = document.getElementById(editBtnId);
dropdown.addEventListener('change', function () {
deleteButton.disabled = !this.value;
editButton.disabled = !this.value;
});
}
function getClanLists(event) {
const button = event.relatedTarget;
const clanListId = button.getAttribute('data-bs-list');
const clanList = document.querySelector(clanListId);
let otherClanListId;
if (clanListId === '#home-clan')
otherClanListId = '#opponent-clan'
else
otherClanListId = '#home-clan'
const otherClanList = document.querySelector(otherClanListId);
return [clanList, otherClanList];
}