Improve style handling in updateUI function

Updated the `updateUI` function to use `setAttribute` for applying styles with `!important` to `dailyProfitElement` and `monthlyProfitElement`. Changed the reset logic to remove the entire style attribute instead of setting it to an empty string, ensuring complete style clearance for positive profit values.
This commit is contained in:
DJObleezy 2025-04-11 22:52:45 -07:00
parent 08034ea9a7
commit 6f5b2ec359

View File

@ -1224,9 +1224,11 @@ function updateUI() {
if (dailyProfitElement) { if (dailyProfitElement) {
dailyProfitElement.textContent = "$" + numberWithCommas(dailyProfitUSD.toFixed(2)); dailyProfitElement.textContent = "$" + numberWithCommas(dailyProfitUSD.toFixed(2));
if (dailyProfitUSD < 0) { if (dailyProfitUSD < 0) {
dailyProfitElement.style.color = "#ff5555 !important"; // Use setAttribute to properly set the style with !important
dailyProfitElement.setAttribute("style", "color: #ff5555 !important; font-weight: bold !important;");
} else { } else {
dailyProfitElement.style.color = ""; // Reset to default color // Clear the style attribute completely instead of setting it to empty
dailyProfitElement.removeAttribute("style");
} }
} }
@ -1236,9 +1238,11 @@ function updateUI() {
if (monthlyProfitElement) { if (monthlyProfitElement) {
monthlyProfitElement.textContent = "$" + numberWithCommas(monthlyProfitUSD.toFixed(2)); monthlyProfitElement.textContent = "$" + numberWithCommas(monthlyProfitUSD.toFixed(2));
if (monthlyProfitUSD < 0) { if (monthlyProfitUSD < 0) {
monthlyProfitElement.style.color = "#ff5555 !important"; // Use setAttribute to properly set the style with !important
monthlyProfitElement.setAttribute("style", "color: #ff5555 !important; font-weight: bold !important;");
} else { } else {
monthlyProfitElement.style.color = ""; // Reset to default color // Clear the style attribute completely
monthlyProfitElement.removeAttribute("style");
} }
} }