mirror of
https://github.com/Retropex/custom-ocean.xyz-dashboard.git
synced 2025-05-13 03:30:46 +02:00
Update workers.js
This commit is contained in:
parent
8e2f912616
commit
b8368cd537
@ -70,6 +70,9 @@ function formatHashrateForDisplay(value, unit) {
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
console.log("Worker page initializing...");
|
console.log("Worker page initializing...");
|
||||||
|
|
||||||
|
// Initialize notification badge
|
||||||
|
initNotificationBadge();
|
||||||
|
|
||||||
// Set up initial UI
|
// Set up initial UI
|
||||||
initializePage();
|
initializePage();
|
||||||
|
|
||||||
@ -134,6 +137,33 @@ function initializePage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update unread notifications badge in navigation
|
||||||
|
function updateNotificationBadge() {
|
||||||
|
$.ajax({
|
||||||
|
url: "/api/notifications/unread_count",
|
||||||
|
method: "GET",
|
||||||
|
success: function (data) {
|
||||||
|
const unreadCount = data.unread_count;
|
||||||
|
const badge = $("#nav-unread-badge");
|
||||||
|
|
||||||
|
if (unreadCount > 0) {
|
||||||
|
badge.text(unreadCount).show();
|
||||||
|
} else {
|
||||||
|
badge.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize notification badge checking
|
||||||
|
function initNotificationBadge() {
|
||||||
|
// Update immediately
|
||||||
|
updateNotificationBadge();
|
||||||
|
|
||||||
|
// Update every 60 seconds
|
||||||
|
setInterval(updateNotificationBadge, 60000);
|
||||||
|
}
|
||||||
|
|
||||||
// Server time update via polling - enhanced to use shared storage
|
// Server time update via polling - enhanced to use shared storage
|
||||||
function updateServerTime() {
|
function updateServerTime() {
|
||||||
console.log("Updating server time...");
|
console.log("Updating server time...");
|
||||||
|
Loading…
Reference in New Issue
Block a user