Skip to content

Commit

Permalink
fix: cancel console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
gardenboi committed Nov 25, 2023
1 parent b70b768 commit 722763a
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,59 @@ window.onload = function () {
AdvSettingsFormEl.classList.add( 'hidden' );
}
};

if ( document.body.classList.contains( 'cf7-antispam-admin' ) ) {
const addListButton = document.querySelector('.add-list');
const addSelect = document.querySelector('.add-select');
const removeListButton = document.querySelector('.remove-list');
const removeSelect = document.querySelector('.remove-select');

for (const remove of removeSelect) {
for (const add of addSelect) {
if (remove.value === add.value) {
addSelect.removeChild(add);
}
}
}

addListButton.addEventListener('click', () => {
for (const option of addSelect.options) {
if (option.selected) {
const name = option.textContent;
const value = option.value;

if (!removeSelect.options[value]) {
const newOption = document.createElement('option');
newOption.setAttribute('selected', true);
newOption.value = value;
newOption.textContent = name;

removeSelect.appendChild(newOption);
}
option.remove();
}
}
});

removeListButton.addEventListener('click', () => {

for (const option of removeSelect.options) {
if (option.selected) {
const name = option.textContent;
const value = option.value;

if (!removeSelect.options[value]) {
const newOption = document.createElement('option');
newOption.value = value;
newOption.textContent = name;

addSelect.appendChild(newOption);
}
option.remove();
}
}
});
}
/* on click show advanced options */
document
.getElementById( 'enable_advanced_settings' )
Expand Down

0 comments on commit 722763a

Please sign in to comment.