From 8f0d87e37d594a22de78e73e08f5047e338a3613 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Thu, 6 Nov 2025 18:12:18 +0100 Subject: [PATCH] Load sponsor data dynamically (from hades) --- src/serena/resources/dashboard/dashboard.js | 41 +++++++++++++++++++-- src/serena/resources/dashboard/index.html | 19 +--------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/serena/resources/dashboard/dashboard.js b/src/serena/resources/dashboard/dashboard.js index 261d4f58..a28627d1 100644 --- a/src/serena/resources/dashboard/dashboard.js +++ b/src/serena/resources/dashboard/dashboard.js @@ -53,8 +53,41 @@ class SponsorRotation { } init() { - this.startPlatinumRotation(); - this.startGoldRotation(); + let self = this; + this.loadSponsors(function() { + self.startPlatinumRotation(); + self.startGoldRotation(); + }); + } + + loadSponsors(onSuccess) { + $.ajax({ + url: 'https://v32155.1blu.de/serena-sponsors/manifest.php', + type: 'GET', + success: function (response) { + console.log('Sponsors loaded:', response); + let $goldContainer = $('#gold-sponsors'); + $.each(response.gold, function (index, sponsor) { + let $sponsor = $('
'); + if (index === 0) { + $sponsor.addClass('active'); + } + $goldContainer.append($sponsor); + }); + let $platinumContainer = $('#platinum-sponsors'); + $.each(response.platinum, function (index, sponsor) { + let $sponsor = $('
'); + if (index === 0) { + $sponsor.addClass('active'); + } + $platinumContainer.append($sponsor); + }); + onSuccess(); + }, + error: function (xhr, status, error) { + console.error('Error loading sponsors:', error); + } + }); } startPlatinumRotation() { @@ -414,7 +447,9 @@ class Dashboard { console.log('Polling for config overview...'); let self = this; $.ajax({ - url: '/get_config_overview', type: 'GET', success: function (response) { + url: '/get_config_overview', + type: 'GET', + success: function (response) { self.failureCount = 0; // Check if the config data has actually changed diff --git a/src/serena/resources/dashboard/index.html b/src/serena/resources/dashboard/index.html index c1752bd7..17870a6e 100644 --- a/src/serena/resources/dashboard/index.html +++ b/src/serena/resources/dashboard/index.html @@ -24,16 +24,7 @@ -
-
- -
-
- -
-
- -
+
@@ -143,13 +134,7 @@ -
-
- -
-
- -
+