diff --git a/index.php b/index.php index 09ea316..3f52fc9 100644 --- a/index.php +++ b/index.php @@ -166,7 +166,7 @@ foreach (array_reverse($preferred_currencies) as $currency) { echo ""; foreach ($chunk as $currency) { $currencyName = isset(${"l_" . strtolower($currency)}) ? ${"l_" . strtolower($currency)} : $currency; - echo "{$currency}"; + echo "{$currency}"; } echo ""; echo ""; diff --git a/src/js/main.js b/src/js/main.js index 29a33db..7390237 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -24,6 +24,21 @@ document.addEventListener('DOMContentLoaded', function () { const selectBox = document.getElementById('selectBox'); const convertXMRToFiatBtn = document.getElementById('convertXMRToFiat'); const convertFiatToXMRBtn = document.getElementById('convertFiatToXMR'); + const fiatButtons = document.querySelectorAll('.fiat-btn'); + + // Add event listeners for the currency buttons + fiatButtons.forEach(button => { + button.addEventListener('click', (e) => { + e.preventDefault(); + selectBox.value = button.textContent; + if (lastModifiedField === 'xmr') { + xmrConvert(); + } else { + fiatConvert(); + } + history.pushState(null, '', `?in=${button.textContent}`); + }); + }); // Add event listeners for the copy buttons copyXMRBtn.addEventListener('click', copyToClipBoardXMR);