Fixes and Tweaks

- Fix the 25%/50%/100% buttons on XMR and WOW.
master^2
gerlofvanek 6 months ago committed by tecnovert
parent a977cfe857
commit 94303cff93
  1. 14
      basicswap/templates/wallet.html

@ -629,7 +629,7 @@
</script> </script>
{# / LTC #} {# / LTC #}
{% else %} {% else %}
<button type="button" class="py-1 px-2 bg-blue-500 text-white text-sm rounded-md focus:outline-none" onclick="setAmount(0.25, '{{ w.balance }}', {{ w.cid }})">25%</button> <button type="button" class="ml-2 py-1 px-2 bg-blue-500 text-white text-sm rounded-md focus:outline-none" onclick="setAmount(0.5, '{{ w.balance }}')">50%</button> <button type="button" class="ml-2 py-1 px-2 bg-blue-500 text-white text-sm rounded-md focus:outline-none" onclick="setAmount(1, '{{ w.balance }}', '{{ w.cid }}')">100%</button> <button type="button" class="py-1 px-2 bg-blue-500 text-white text-sm rounded-md focus:outline-none" onclick="setAmount(0.25, '{{ w.balance }}')">25%</button> <button type="button" class="ml-2 py-1 px-2 bg-blue-500 text-white text-sm rounded-md focus:outline-none" onclick="setAmount(0.5, '{{ w.balance }}')">50%</button> <button type="button" class="ml-2 py-1 px-2 bg-blue-500 text-white text-sm rounded-md focus:outline-none" onclick="setAmount(1, '{{ w.balance }}', '{{ w.cid }}')">100%</button>
<script> <script>
function setAmount(percent, balance, cid) { function setAmount(percent, balance, cid) {
var amountInput = document.getElementById('amount'); var amountInput = document.getElementById('amount');
@ -638,7 +638,10 @@
floatBalance = parseFloat(balance); floatBalance = parseFloat(balance);
calculatedAmount = floatBalance * percent; calculatedAmount = floatBalance * percent;
if ((cid == 6 || cid == 9) && percent === 1) {
var specialCids = [6, 9];
if (specialCids.includes(cid) && percent === 1) {
amountInput.setAttribute('data-hidden', 'true'); amountInput.setAttribute('data-hidden', 'true');
amountInput.placeholder = 'Sweep All'; amountInput.placeholder = 'Sweep All';
amountInput.value = ''; amountInput.value = '';
@ -653,19 +656,16 @@
amountInput.placeholder = ''; amountInput.placeholder = '';
amountInput.disabled = false; amountInput.disabled = false;
} }
if ((cid == 6 || cid == 9) && percent === 1) {
var sweepAllCheckbox = document.getElementById('sweepall'); var sweepAllCheckbox = document.getElementById('sweepall');
if (sweepAllCheckbox) { if (sweepAllCheckbox) {
if (specialCids.includes(cid) && percent === 1) {
sweepAllCheckbox.checked = true; sweepAllCheckbox.checked = true;
}
} else { } else {
var sweepAllCheckbox = document.getElementById('sweepall');
if (sweepAllCheckbox) {
sweepAllCheckbox.checked = false; sweepAllCheckbox.checked = false;
} }
} }
} }
</script> </script>
{% endif %} {% endif %}
</div> </div>

Loading…
Cancel
Save