+
-
+
@@ -1950,6 +1955,8 @@
// Load specific data when tabs are opened
if (tabName === 'news') {
loadNewsManagerData();
+ } else if (tabName === 'sports') {
+ refreshSportsConfig();
} else if (tabName === 'logs') {
fetchLogs();
} else if (tabName === 'raw-json') {
@@ -2215,6 +2222,24 @@
}
}
+ async function loadLayout(){
+ try {
+ const res = await fetch('/api/editor/layouts');
+ const data = await res.json();
+ if (data.status === 'success' && data.data && data.data.elements) {
+ currentElements = data.data.elements;
+ selectedElement = null;
+ updatePreview();
+ updatePropertiesPanel();
+ showNotification('Layout loaded', 'success');
+ } else {
+ showNotification('No saved layout found', 'warning');
+ }
+ } catch (err) {
+ showNotification('Error loading layout: ' + err, 'error');
+ }
+ }
+
// Utility functions
function showNotification(message, type) {
const notification = document.getElementById('notification');
@@ -2843,9 +2868,88 @@
showNotification('News status refreshed', 'success');
}
- // Sports configuration placeholder
- function saveSportsConfig() {
- showNotification('Sports configuration saved (placeholder)', 'success');
+ // Sports configuration
+ async function refreshSportsConfig(){
+ try {
+ const res = await fetch('/api/system/status');
+ const stats = await res.json();
+ // Build a minimal sports UI off current config
+ const cfg = currentConfig;
+ const leagues = [
+ { key: 'nfl_scoreboard', label: 'NFL' },
+ { key: 'mlb', label: 'MLB' },
+ { key: 'milb', label: 'MiLB' },
+ { key: 'nhl_scoreboard', label: 'NHL' },
+ { key: 'nba_scoreboard', label: 'NBA' },
+ { key: 'ncaa_fb_scoreboard', label: 'NCAA FB' },
+ { key: 'ncaa_baseball_scoreboard', label: 'NCAA Baseball' },
+ { key: 'ncaam_basketball_scoreboard', label: 'NCAAM Basketball' },
+ { key: 'soccer_scoreboard', label: 'Soccer' }
+ ];
+ const container = document.getElementById('sports-config');
+ const html = leagues.map(l => {
+ const sec = cfg[l.key] || {};
+ const fav = (sec.favorite_teams || []).join(', ');
+ return `
+
Live Display Preview
+
+
+ `;
+ }).join('');
+ container.innerHTML = html || 'No sports configuration found.';
+ } catch (err) {
+ document.getElementById('sports-config').textContent = 'Failed to load sports configuration';
+ }
+ }
+
+ async function saveSportsConfig(){
+ try {
+ const leagues = document.querySelectorAll('.sp-enabled');
+ const fragment = {};
+ leagues.forEach(chk => {
+ const key = chk.getAttribute('data-league');
+ const enabled = chk.checked;
+ const livePriority = document.querySelector(`.sp-live-priority[data-league="${key}"]`)?.checked || false;
+ const showOdds = document.querySelector(`.sp-show-odds[data-league="${key}"]`)?.checked || false;
+ const favoritesOnly = document.querySelector(`.sp-favorites-only[data-league="${key}"]`)?.checked || false;
+ const favs = document.querySelector(`.sp-favorites[data-league="${key}"]`)?.value || '';
+ const favorite_teams = favs.split(',').map(s => s.trim()).filter(Boolean);
+ fragment[key] = {
+ enabled,
+ live_priority: livePriority,
+ show_odds: showOdds,
+ show_favorite_teams_only: favoritesOnly,
+ favorite_teams
+ };
+ });
+ await saveConfigJson(fragment);
+ } catch (err) {
+ showNotification('Error saving sports configuration: ' + err, 'error');
+ return;
+ }
+ showNotification('Sports configuration saved', 'success');
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Comma-separated abbreviations
+