fix: remove inline script and improve noscript message

Refactored inline exchangeRates script to main.js for better practice and maintainability. Enhanced the noscript warning message's readability by replacing paragraph tags with line breaks, ensuring clearer instructions for users without JavaScript.
This commit is contained in:
Kumi 2024-08-10 16:49:33 +02:00
parent 227d56a2bd
commit fdebb16a85
No known key found for this signature in database
GPG key ID: ECBCC9082395383F
2 changed files with 4 additions and 5 deletions

View file

@ -196,8 +196,8 @@ foreach (array_reverse($preferred_currencies) as $currency) {
<noscript> <noscript>
<div class="alert alert-warning" role="alert"> <div class="alert alert-warning" role="alert">
<p>Looks like you have JavaScript disabled. You can still use this tool, but you won't be able to use the &#128203; buttons to automatically copy the results to your clipboard.</p> Looks like you have JavaScript disabled. You can still use this tool, but you won't be able to use the &#128203; buttons to automatically copy the results to your clipboard.<br />
<p>Use the &darr; button to convert XMR to fiat, or the &uarr; button to convert fiat to XMR.</p> Use the &darr; button to convert XMR to fiat, or the &uarr; button to convert fiat to XMR.
</div> </div>
</noscript> </noscript>
@ -229,9 +229,6 @@ foreach (array_reverse($preferred_currencies) as $currency) {
</div> </div>
</div> </div>
<script>
var exchangeRates = <?php echo json_encode($exchangeRates); ?>;
</script>
<script src="js/main.js"></script> <script src="js/main.js"></script>
</body> </body>

View file

@ -14,6 +14,8 @@ console.log(tooltipList);
let lastModifiedField = 'xmr'; let lastModifiedField = 'xmr';
var exchangeRates = {};
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
const copyXMRBtn = document.getElementById('copyXMRBtn'); const copyXMRBtn = document.getElementById('copyXMRBtn');
const copyFiatBtn = document.getElementById('copyFiatBtn'); const copyFiatBtn = document.getElementById('copyFiatBtn');