Update workers.js

This commit is contained in:
DJObleezy 2025-03-27 09:50:19 -07:00 committed by GitHub
parent 8e2f912616
commit b8368cd537
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,6 +70,9 @@ function formatHashrateForDisplay(value, unit) {
$(document).ready(function () {
console.log("Worker page initializing...");
// Initialize notification badge
initNotificationBadge();
// Set up initial UI
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
function updateServerTime() {
console.log("Updating server time...");