mirror of
https://github.com/Retropex/custom-ocean.xyz-dashboard.git
synced 2025-05-13 03:30:46 +02:00
Update main.js
This commit is contained in:
parent
13a38d351e
commit
1a99c93ec9
@ -1108,24 +1108,36 @@ function updateUI() {
|
|||||||
const payoutText = data.est_time_to_payout;
|
const payoutText = data.est_time_to_payout;
|
||||||
updateElementText("est_time_to_payout", payoutText);
|
updateElementText("est_time_to_payout", payoutText);
|
||||||
|
|
||||||
if (payoutText && payoutText.toLowerCase().includes("next block")) {
|
// Check for "next block" in any case format
|
||||||
$("#est_time_to_payout").css({
|
if (payoutText && /next\s+block/i.test(payoutText)) {
|
||||||
"color": "#32CD32",
|
$("#est_time_to_payout").attr("style", "color: #32CD32 !important; text-shadow: 0 0 6px rgba(50, 205, 50, 0.6) !important; animation: glowPulse 1s infinite !important;");
|
||||||
"animation": "glowPulse 1s infinite"
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
const daysMatch = payoutText ? payoutText.match(/(\d+)/) : null;
|
// Trim any extra whitespace
|
||||||
const days = daysMatch ? parseFloat(daysMatch[1]) : NaN;
|
const cleanText = payoutText ? payoutText.trim() : "";
|
||||||
if (!isNaN(days)) {
|
// Use an improved regex that optionally captures hours after days (with or without a comma)
|
||||||
if (days < 4) {
|
const regex = /(\d+)\s*days(?:,?\s*(\d+)\s*hours?)?/i;
|
||||||
$("#est_time_to_payout").css({ "color": "#32CD32", "animation": "none" });
|
const match = cleanText.match(regex);
|
||||||
} else if (days > 20) {
|
|
||||||
$("#est_time_to_payout").css({ "color": "red", "animation": "none" });
|
console.log("Payout text:", cleanText, "Match:", match); // Debug output
|
||||||
|
|
||||||
|
let totalDays = NaN;
|
||||||
|
if (match) {
|
||||||
|
const days = parseFloat(match[1]);
|
||||||
|
const hours = match[2] ? parseFloat(match[2]) : 0;
|
||||||
|
totalDays = days + (hours / 24);
|
||||||
|
console.log("Total days computed:", totalDays); // Debug output
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isNaN(totalDays)) {
|
||||||
|
if (totalDays < 4) {
|
||||||
|
$("#est_time_to_payout").attr("style", "color: #32CD32 !important; text-shadow: 0 0 6px rgba(50, 205, 50, 0.6) !important; animation: none !important;");
|
||||||
|
} else if (totalDays > 20) {
|
||||||
|
$("#est_time_to_payout").attr("style", "color: #ff5555 !important; text-shadow: 0 0 6px rgba(255, 85, 85, 0.6) !important; animation: none !important;");
|
||||||
} else {
|
} else {
|
||||||
$("#est_time_to_payout").css({ "color": "#ffd700", "animation": "none" });
|
$("#est_time_to_payout").attr("style", "color: #ffd700 !important; text-shadow: 0 0 6px rgba(255, 215, 0, 0.6) !important; animation: none !important;");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$("#est_time_to_payout").css({ "color": "#ffd700", "animation": "none" });
|
$("#est_time_to_payout").attr("style", "color: #ffd700 !important; text-shadow: 0 0 6px rgba(255, 215, 0, 0.6) !important; animation: none !important;");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user