Sync both clan lists.
This commit is contained in:
@@ -36,10 +36,11 @@
|
||||
if (addClanModal) {
|
||||
addClanModal.addEventListener('shown.bs.modal', event => {
|
||||
const submitButton = addClanModal.querySelector('button[name="submit"]');
|
||||
submitButton.addEventListener('click', function () {
|
||||
const button = event.relatedTarget;
|
||||
const clanListId = button.getAttribute('data-bs-list');
|
||||
const clanList = document.querySelector(clanListId);
|
||||
submitButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
submitButton.onclick = function () {}
|
||||
|
||||
const [clanList, otherClanList] = getClanLists(event);
|
||||
|
||||
const clanName = addClanModal.querySelector('#clanName');
|
||||
const clanTag = addClanModal.querySelector('#clanTag');
|
||||
@@ -61,9 +62,15 @@
|
||||
const opt = document.createElement('option');
|
||||
opt.innerText = "[" + clanTag.value + "]" + " " + clanName.value;
|
||||
opt.value = response.json()['ID'];
|
||||
clanList.appendChild(opt);
|
||||
|
||||
clanList.appendChild(opt.cloneNode(true));
|
||||
clanList.selectedIndex = clanList.children.length - 1;
|
||||
clanList.dispatchEvent(new Event('change'));
|
||||
|
||||
const lastIndex = otherClanList.selectedIndex;
|
||||
otherClanList.appendChild(opt);
|
||||
otherClanList.selectedIndex = lastIndex;
|
||||
|
||||
addClanModalBS.hide();
|
||||
clanName.value = "";
|
||||
clanTag.value = "";
|
||||
|
||||
Reference in New Issue
Block a user