25 lines
841 B
JavaScript
25 lines
841 B
JavaScript
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];
|
|
} |