-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSupportXMR.user.js
More file actions
32 lines (29 loc) · 995 Bytes
/
SupportXMR.user.js
File metadata and controls
32 lines (29 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// ==UserScript==
// @name SupportXMR Tweaks
// @namespace Violentmonkey Scripts
// @match https://supportxmr.com/
// @grant none
// @version 1.0
// @author -
// @description 6/5/2023, 9:41:59 PM
// ==/UserScript==
fetch("https://api.coingecko.com/api/v3/simple/price?ids=monero&vs_currencies=usd") // XMR Price API
.then(response => {
if (!response.ok) {
throw new Error(`Request failed with status ${response.status}`)
}
return response.json()
})
.then(data => {
xmrPrice = data.monero.usd;
console.log("1 XMR = $" + xmrPrice);
window.onload = function() {
xmrPriceToUSD("#DashPending");
xmrPriceToUSD("#DashPaid");
// xmrPriceToUSD("#MinerCalc"); // FIXME: " XMR" breaks float parsing
}
})
.catch(error => console.log(error))
function xmrPriceToUSD(element) {
document.querySelector(element).innerText = "$" + (parseFloat(document.querySelector(element).innerText) * xmrPrice).toFixed(2);
}