diff --git a/basicswap/static/js/pages/settings-page.js b/basicswap/static/js/pages/settings-page.js index 5a86462..b0994e7 100644 --- a/basicswap/static/js/pages/settings-page.js +++ b/basicswap/static/js/pages/settings-page.js @@ -72,6 +72,39 @@ connectionTypeSelects.forEach(select => { const originalValue = select.dataset.originalValue || select.value; this.originalConnectionTypes[select.name] = originalValue; + + select.addEventListener('change', (e) => { + const coinName = select.name.replace('connection_type_', ''); + const electrumSection = document.getElementById(`electrum-section-${coinName}`); + const fundTransferSection = document.getElementById(`fund-transfer-section-${coinName}`); + const originalValue = this.originalConnectionTypes[select.name]; + + if (e.target.value === 'electrum') { + if (electrumSection) { + electrumSection.classList.remove('hidden'); + + const clearnetTextarea = document.getElementById(`electrum_clearnet_${coinName}`); + const onionTextarea = document.getElementById(`electrum_onion_${coinName}`); + + if (clearnetTextarea && !clearnetTextarea.value.trim()) { + clearnetTextarea.value = electrumSection.dataset.defaultClearnet || ''; + } + if (onionTextarea && !onionTextarea.value.trim()) { + onionTextarea.value = electrumSection.dataset.defaultOnion || ''; + } + } + if (fundTransferSection) { + fundTransferSection.classList.add('hidden'); + } + } else { + if (electrumSection) { + electrumSection.classList.add('hidden'); + } + if (fundTransferSection && originalValue === 'electrum') { + fundTransferSection.classList.remove('hidden'); + } + } + }); }); this.setupWalletModeModal(); @@ -561,7 +594,8 @@ } if (!data.clearnet_servers?.length && !data.onion_servers?.length) { - html = '
One per line. Format: host:port (50002=SSL, 50001=non-SSL)
One per line. Used when TOR is enabled.