feat: add clipboard and conversion functionality to main.js

This commit is contained in:
Kumi 2024-08-08 08:44:06 +02:00
parent 3a30c11ca6
commit 437dfbd57e
No known key found for this signature in database
GPG key ID: ECBCC9082395383F

View file

@ -6,3 +6,45 @@ var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new Tooltip(tooltipTriggerEl, { placement: "top" });
});
console.log(tooltipList);
import 'bootstrap/dist/css/bootstrap.min.css';
import '../css/custom.css';
function copyToClipBoardXMR() {
var content = document.getElementById('xmrInput');
content.select();
document.execCommand('copy');
}
function copyToClipBoardFiat() {
var content = document.getElementById('fiatInput');
content.select();
document.execCommand('copy');
}
function fiatConvert(value) {
let fiatAmount = document.getElementById("fiatInput").value;
let xmrValue = document.getElementById("xmrInput");
let selectBox = document.getElementById("selectBox").value;
if (exchangeRates[selectBox]) {
let value = fiatAmount / exchangeRates[selectBox];
xmrValue.value = value.toFixed(selectBox == 'BTC' || selectBox == 'LTC' || selectBox == 'ETH' || selectBox == 'XAG' || selectBox == 'XAU' ? 8 : 2);
}
}
function xmrConvert(value) {
let xmrAmount = document.getElementById("xmrInput").value;
let fiatValue = document.getElementById("fiatInput");
let selectBox = document.getElementById("selectBox").value;
if (exchangeRates[selectBox]) {
let value = xmrAmount * exchangeRates[selectBox];
fiatValue.value = value.toFixed(selectBox == 'BTC' || selectBox == 'LTC' || selectBox == 'ETH' || selectBox == 'XAG' || selectBox == 'XAU' ? 8 : 2);
}
}
window.copyToClipBoardXMR = copyToClipBoardXMR;
window.copyToClipBoardFiat = copyToClipBoardFiat;
window.fiatConvert = fiatConvert;
window.xmrConvert = xmrConvert;