mirror of
https://github.com/Retropex/custom-ocean.xyz-dashboard.git
synced 2025-05-12 19:20:45 +02:00
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:
parent
08034ea9a7
commit
6f5b2ec359
@ -1224,9 +1224,11 @@ function updateUI() {
|
||||
if (dailyProfitElement) {
|
||||
dailyProfitElement.textContent = "$" + numberWithCommas(dailyProfitUSD.toFixed(2));
|
||||
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 {
|
||||
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) {
|
||||
monthlyProfitElement.textContent = "$" + numberWithCommas(monthlyProfitUSD.toFixed(2));
|
||||
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 {
|
||||
monthlyProfitElement.style.color = ""; // Reset to default color
|
||||
// Clear the style attribute completely
|
||||
monthlyProfitElement.removeAttribute("style");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user