Sync both clan lists.
This commit is contained in:
25
static/index.js
Normal file
25
static/index.js
Normal 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];
|
||||
}
|
||||
Reference in New Issue
Block a user