Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
361559cbec | ||
|
|
e08bf66a53 | ||
|
|
d6ef81138d | ||
|
|
35f21e680a | ||
|
|
705fbaed9d | ||
|
|
9e52198ef7 | ||
|
|
b1943dfe17 | ||
|
|
c55e900c0f | ||
|
|
503e9addee | ||
|
|
d630fdd217 | ||
|
|
7e4a7c2a6e | ||
|
|
1716a771f3 | ||
|
|
36347cc4b0 | ||
|
|
7f94164e55 | ||
|
|
cbab7de546 | ||
|
|
d0de5cd021 | ||
|
|
16628e9902 | ||
|
|
72bfe0a14a | ||
|
|
6498ec4216 | ||
|
|
0d350fc76b | ||
|
|
2c6e4ce610 | ||
|
|
0c552774dc | ||
|
|
9ab605bb74 | ||
|
|
3d6cba0fe4 |
@@ -69,8 +69,7 @@
|
|||||||
is="emby-checkbox" />
|
is="emby-checkbox" />
|
||||||
<span>Allow Client-Side Toggle</span>
|
<span>Allow Client-Side Toggle</span>
|
||||||
</label>
|
</label>
|
||||||
<div class="fieldDescription">If enabled, users will see a seasonals icon in the header to toggle
|
<div class="fieldDescription">If enabled, users will see a seasonals icon in the header to toggle seasonals for their browser (device-specific).</div>
|
||||||
seasonals for their browser.</div>
|
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<!-- <TreatWarningsAsErrors>false</TreatWarningsAsErrors> -->
|
<!-- <TreatWarningsAsErrors>false</TreatWarningsAsErrors> -->
|
||||||
<Title>Jellyfin Seasonals Plugin</Title>
|
<Title>Jellyfin Seasonals Plugin</Title>
|
||||||
<Authors>CodeDevMLH</Authors>
|
<Authors>CodeDevMLH</Authors>
|
||||||
<Version>1.6.13.0</Version>
|
<Version>1.6.13.3</Version>
|
||||||
<RepositoryUrl>https://github.com/CodeDevMLH/Jellyfin-Seasonals</RepositoryUrl>
|
<RepositoryUrl>https://github.com/CodeDevMLH/Jellyfin-Seasonals</RepositoryUrl>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
// theme-configs.js
|
/*
|
||||||
|
* Seasonals Plugin (Client Side Manager Logic)
|
||||||
|
*/
|
||||||
|
|
||||||
// theme configurations
|
const ThemeConfigs = {
|
||||||
const themeConfigs = {
|
|
||||||
snowflakes: {
|
snowflakes: {
|
||||||
css: '/Seasonals/Resources/snowflakes.css',
|
css: '/Seasonals/Resources/snowflakes.css',
|
||||||
js: '/Seasonals/Resources/snowflakes.js',
|
js: '/Seasonals/Resources/snowflakes.js',
|
||||||
@@ -67,195 +68,65 @@ const themeConfigs = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// determine current theme based on the current month
|
const SettingsManager = {
|
||||||
function determineCurrentTheme() {
|
initialized: false,
|
||||||
const date = new Date();
|
config: null,
|
||||||
const month = date.getMonth(); // 0-11
|
|
||||||
const day = date.getDate(); // 1-31
|
|
||||||
|
|
||||||
if ((month === 11 && day >= 28) || (month === 0 && day <= 5)) return 'fireworks'; //new year fireworks december 28 - january 5
|
init(config) {
|
||||||
|
if (this.initialized) return;
|
||||||
|
this.config = config;
|
||||||
|
|
||||||
if (month === 1 && day >= 10 && day <= 18) return 'hearts'; // valentine's day february 10 - 18
|
// Only inject settings if enabled on server by admin
|
||||||
|
if (this.config && this.config.EnableClientSideToggle !== false) {
|
||||||
if (month === 11 && day >= 22 && day <= 27) return 'santa'; // christmas december 22 - 27
|
this.injectSettingsIcon();
|
||||||
// if (month === 11 && day >= 22 && day <= 27) return 'christmas'; // christmas december 22 - 27
|
this.initialized = true;
|
||||||
|
console.log("Seasonals: Client-Side Settings Manager initialized.");
|
||||||
if (month === 11) return 'snowflakes'; // snowflakes december
|
|
||||||
if (month === 0 || month === 1) return 'snowfall'; // snow january, february
|
|
||||||
// if (month === 0 || month === 1) return 'snowstorm'; // snow january, february
|
|
||||||
|
|
||||||
if ((month === 2 && day >= 25) || (month === 3 && day <= 25)) return 'easter'; // easter march 25 - april 25
|
|
||||||
|
|
||||||
//NOT IMPLEMENTED YET
|
|
||||||
//if (month >= 2 && month <= 4) return 'spring'; // spring march, april, may
|
|
||||||
|
|
||||||
//NOT IMPLEMENTED YET
|
|
||||||
//if (month >= 5 && month <= 7) return 'summer'; // summer june, july, august
|
|
||||||
|
|
||||||
if ((month === 9 && day >= 24) || (month === 10 && day <= 5)) return 'halloween'; // halloween october 24 - november 5
|
|
||||||
|
|
||||||
if (month >= 8 && month <= 10) return 'autumn'; // autumn september, october, november
|
|
||||||
|
|
||||||
return 'none'; // Fallback (nothing)
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// helper to resolve paths for local testing vs production
|
getSetting(key, defaultValue) {
|
||||||
function resolvePath(path) {
|
const value = localStorage.getItem(`seasonals-${key}`);
|
||||||
if (window.location.protocol === 'file:' || window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
|
|
||||||
return path.replace('/Seasonals/Resources/', './');
|
|
||||||
}
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
// load theme csss
|
|
||||||
function loadThemeCSS(cssPath) {
|
|
||||||
if (!cssPath) return;
|
|
||||||
|
|
||||||
const link = document.createElement('link');
|
|
||||||
link.rel = 'stylesheet';
|
|
||||||
// link.href = resolvePath(cssPath);
|
|
||||||
link.href = cssPath;
|
|
||||||
|
|
||||||
link.onerror = () => {
|
|
||||||
console.error(`Failed to load CSS: ${cssPath}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
document.body.appendChild(link);
|
|
||||||
console.log(`CSS file "${cssPath}" loaded.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// load theme js
|
|
||||||
function loadThemeJS(jsPath) {
|
|
||||||
if (!jsPath) return;
|
|
||||||
|
|
||||||
const script = document.createElement('script');
|
|
||||||
script.src = jsPath;
|
|
||||||
// script.src = resolvePath(jsPath);
|
|
||||||
script.defer = true;
|
|
||||||
|
|
||||||
script.onerror = () => {
|
|
||||||
console.error(`Failed to load JS: ${jsPath}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
document.body.appendChild(script);
|
|
||||||
console.log(`JS file "${jsPath}" loaded.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// update theme container class name
|
|
||||||
function updateThemeContainer(containerClass) {
|
|
||||||
// Create container if it doesn't exist
|
|
||||||
let container = document.querySelector('.seasonals-container');
|
|
||||||
if (!container) {
|
|
||||||
container = document.createElement('div');
|
|
||||||
container.className = 'seasonals-container';
|
|
||||||
document.body.appendChild(container);
|
|
||||||
}
|
|
||||||
|
|
||||||
container.className = `seasonals-container ${containerClass}`;
|
|
||||||
console.log(`Seasonals-Container class updated to "${containerClass}".`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// function removeSelf() {
|
|
||||||
// const script = document.currentScript;
|
|
||||||
// if (script) script.parentNode.removeChild(script);
|
|
||||||
// console.log('External script removed:', script);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// initialize theme
|
|
||||||
async function initializeTheme() {
|
|
||||||
|
|
||||||
// Check local user preference
|
|
||||||
const isEnabled = getSavedSetting('seasonals-enabled', 'true') === 'true';
|
|
||||||
if (!isEnabled) {
|
|
||||||
console.log('Seasonals disabled by user preference.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const forcedTheme = getSavedSetting('seasonals-theme', 'auto');
|
|
||||||
|
|
||||||
let automateThemeSelection = true;
|
|
||||||
let defaultTheme = 'none';
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch('/Seasonals/Config');
|
|
||||||
if (response.ok) {
|
|
||||||
const config = await response.json();
|
|
||||||
automateThemeSelection = config.AutomateSeasonSelection;
|
|
||||||
defaultTheme = config.SelectedSeason;
|
|
||||||
window.SeasonalsPluginConfig = config;
|
|
||||||
console.log('Seasonals Config loaded:', config);
|
|
||||||
} else {
|
|
||||||
console.error('Failed to fetch Seasonals config');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching Seasonals config:', error);
|
|
||||||
}
|
|
||||||
|
|
||||||
let currentTheme;
|
|
||||||
|
|
||||||
if (forcedTheme !== 'auto') {
|
|
||||||
currentTheme = forcedTheme;
|
|
||||||
console.log(`User forced theme: ${currentTheme}`);
|
|
||||||
} else if (automateThemeSelection === false) {
|
|
||||||
currentTheme = defaultTheme;
|
|
||||||
} else {
|
|
||||||
currentTheme = determineCurrentTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`Selected theme: ${currentTheme}`);
|
|
||||||
|
|
||||||
if (!currentTheme || currentTheme === 'none') {
|
|
||||||
console.log('No theme selected.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const theme = themeConfigs[currentTheme];
|
|
||||||
|
|
||||||
if (!theme) {
|
|
||||||
console.error(`Theme "${currentTheme}" not found.`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
updateThemeContainer(theme.containerClass);
|
|
||||||
|
|
||||||
if (theme.css) loadThemeCSS(theme.css);
|
|
||||||
if (theme.js) loadThemeJS(theme.js);
|
|
||||||
|
|
||||||
console.log(`Theme "${currentTheme}" loaded.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
initializeTheme();
|
|
||||||
|
|
||||||
|
|
||||||
// User UI Seasonal Settings
|
|
||||||
|
|
||||||
function getSavedSetting(key, defaultValue) {
|
|
||||||
const value = localStorage.getItem(key);
|
|
||||||
return value !== null ? value : defaultValue;
|
return value !== null ? value : defaultValue;
|
||||||
}
|
},
|
||||||
|
|
||||||
function setSavedSetting(key, value) {
|
setSetting(key, value) {
|
||||||
localStorage.setItem(key, value);
|
localStorage.setItem(`seasonals-${key}`, value);
|
||||||
}
|
},
|
||||||
|
|
||||||
function createSettingsIcon() {
|
createIcon() {
|
||||||
const button = document.createElement('button');
|
const button = document.createElement('button');
|
||||||
button.type = 'button';
|
button.type = 'button';
|
||||||
button.className = 'paper-icon-button-light headerButton seasonal-settings-button';
|
button.className = 'paper-icon-button-light headerButton seasonal-settings-button';
|
||||||
button.title = 'Seasonal Settings';
|
button.title = 'Seasonal Settings';
|
||||||
// button.innerHTML = '<span class="material-icons">ac_unit</span>';
|
// button.innerHTML = '<span class="material-icons">ac_unit</span>';
|
||||||
|
// button.innerHTML = '<img src="/Seasonals/Resources/assets/logo_SW.svg" style="width: 52px; height: 24px; vertical-align: middle;">';
|
||||||
button.innerHTML = '<img src="/Seasonals/Resources/assets/logo_SW.svg" style="width: 24px; height: 24px; vertical-align: middle;">';
|
button.innerHTML = '<img src="/Seasonals/Resources/assets/logo_SW.svg" style="width: 24px; height: 24px; vertical-align: middle;">';
|
||||||
button.style.verticalAlign = 'middle';
|
button.style.verticalAlign = 'middle';
|
||||||
|
|
||||||
button.addEventListener('click', (e) => {
|
button.addEventListener('click', (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
toggleSettingsPopup(button);
|
this.toggleSettingsPopup(button);
|
||||||
});
|
});
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
},
|
||||||
|
|
||||||
function createSettingsPopup(anchorElement) {
|
injectSettingsIcon() {
|
||||||
|
const observer = new MutationObserver((mutations, obs) => {
|
||||||
|
const headerRight = document.querySelector('.headerRight');
|
||||||
|
if (headerRight && !document.querySelector('.seasonal-settings-button')) {
|
||||||
|
const icon = this.createIcon();
|
||||||
|
headerRight.prepend(icon);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
observer.observe(document.body, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
createPopup(anchorElement) {
|
||||||
const existing = document.querySelector('.seasonal-settings-popup');
|
const existing = document.querySelector('.seasonal-settings-popup');
|
||||||
if (existing) existing.remove();
|
if (existing) existing.remove();
|
||||||
|
|
||||||
@@ -276,6 +147,7 @@ function createSettingsPopup(anchorElement) {
|
|||||||
|
|
||||||
const rect = anchorElement.getBoundingClientRect();
|
const rect = anchorElement.getBoundingClientRect();
|
||||||
|
|
||||||
|
// Positioning logic
|
||||||
let rightPos = window.innerWidth - rect.right;
|
let rightPos = window.innerWidth - rect.right;
|
||||||
if (window.innerWidth < 450 || (window.innerWidth - rightPos) < 260) {
|
if (window.innerWidth < 450 || (window.innerWidth - rightPos) < 260) {
|
||||||
popup.style.right = '1rem';
|
popup.style.right = '1rem';
|
||||||
@@ -284,10 +156,12 @@ function createSettingsPopup(anchorElement) {
|
|||||||
popup.style.right = `${rightPos}px`;
|
popup.style.right = `${rightPos}px`;
|
||||||
popup.style.left = 'auto';
|
popup.style.left = 'auto';
|
||||||
}
|
}
|
||||||
|
|
||||||
popup.style.top = `${rect.bottom + 10}px`;
|
popup.style.top = `${rect.bottom + 10}px`;
|
||||||
|
|
||||||
popup.innerHTML = `
|
// Popup HTML
|
||||||
|
let html = `
|
||||||
|
<h3 style="margin-top:0; margin-bottom:1em; border-bottom:1px solid #444; padding-bottom:0.5em;">Seasonal Settings</h3>
|
||||||
|
|
||||||
<div class="checkboxContainer checkboxContainer-withDescription" style="margin-bottom: 0.5em;">
|
<div class="checkboxContainer checkboxContainer-withDescription" style="margin-bottom: 0.5em;">
|
||||||
<label class="emby-checkbox-label">
|
<label class="emby-checkbox-label">
|
||||||
<input id="seasonal-enable-toggle" type="checkbox" is="emby-checkbox" class="emby-checkbox" />
|
<input id="seasonal-enable-toggle" type="checkbox" is="emby-checkbox" class="emby-checkbox" />
|
||||||
@@ -303,33 +177,35 @@ function createSettingsPopup(anchorElement) {
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
popup.innerHTML = html;
|
||||||
|
|
||||||
// Populate Select Options
|
// Populate Select Options
|
||||||
const themeSelect = popup.querySelector('#seasonal-theme-select');
|
const themeSelect = popup.querySelector('#seasonal-theme-select');
|
||||||
Object.keys(themeConfigs).forEach(key => {
|
Object.keys(ThemeConfigs).forEach(key => {
|
||||||
if (key === 'none') return;
|
if (key === 'none') return;
|
||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
option.value = key;
|
option.value = key;
|
||||||
// Capitalize first letter
|
|
||||||
option.textContent = key.charAt(0).toUpperCase() + key.slice(1);
|
option.textContent = key.charAt(0).toUpperCase() + key.slice(1);
|
||||||
themeSelect.appendChild(option);
|
themeSelect.appendChild(option);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set Initial Values
|
// Set Initial Values
|
||||||
const enabledCheckbox = popup.querySelector('#seasonal-enable-toggle');
|
const enabledCheckbox = popup.querySelector('#seasonal-enable-toggle');
|
||||||
enabledCheckbox.checked = getSavedSetting('seasonals-enabled', 'true') === 'true';
|
enabledCheckbox.checked = this.getSetting('enabled', 'true') === 'true';
|
||||||
|
themeSelect.value = this.getSetting('theme', 'auto');
|
||||||
themeSelect.value = getSavedSetting('seasonals-theme', 'auto');
|
|
||||||
|
|
||||||
|
// Event Listeners
|
||||||
enabledCheckbox.addEventListener('change', (e) => {
|
enabledCheckbox.addEventListener('change', (e) => {
|
||||||
setSavedSetting('seasonals-enabled', e.target.checked);
|
this.setSetting('enabled', e.target.checked);
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
themeSelect.addEventListener('change', (e) => {
|
themeSelect.addEventListener('change', (e) => {
|
||||||
setSavedSetting('seasonals-theme', e.target.value);
|
this.setSetting('theme', e.target.value);
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Close on outside click
|
||||||
const closeHandler = (e) => {
|
const closeHandler = (e) => {
|
||||||
if (!popup.contains(e.target) && e.target !== anchorElement && !anchorElement.contains(e.target)) {
|
if (!popup.contains(e.target) && e.target !== anchorElement && !anchorElement.contains(e.target)) {
|
||||||
popup.remove();
|
popup.remove();
|
||||||
@@ -339,36 +215,157 @@ function createSettingsPopup(anchorElement) {
|
|||||||
setTimeout(() => document.addEventListener('click', closeHandler), 0);
|
setTimeout(() => document.addEventListener('click', closeHandler), 0);
|
||||||
|
|
||||||
document.body.appendChild(popup);
|
document.body.appendChild(popup);
|
||||||
}
|
},
|
||||||
|
|
||||||
function toggleSettingsPopup(anchorElement) {
|
toggleSettingsPopup(anchorElement) {
|
||||||
const existing = document.querySelector('.seasonal-settings-popup');
|
const existing = document.querySelector('.seasonal-settings-popup');
|
||||||
if (existing) {
|
if (existing) {
|
||||||
existing.remove();
|
existing.remove();
|
||||||
} else {
|
} else {
|
||||||
createSettingsPopup(anchorElement);
|
this.createPopup(anchorElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const SeasonalsManager = {
|
||||||
|
config: null,
|
||||||
|
|
||||||
|
async init() {
|
||||||
|
// Fetch Config
|
||||||
|
try {
|
||||||
|
const response = await fetch('/Seasonals/Config');
|
||||||
|
if (response.ok) {
|
||||||
|
this.config = await response.json();
|
||||||
|
window.SeasonalsPluginConfig = this.config;
|
||||||
|
console.log('Seasonals: Config loaded:', this.config);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Seasonals: Error fetching config:', error);
|
||||||
|
}
|
||||||
|
|
||||||
function injectSettingsIcon() {
|
// Initialize Settings UI
|
||||||
const observer = new MutationObserver((mutations, obs) => {
|
SettingsManager.init(this.config);
|
||||||
// Check if admin has enabled this feature
|
|
||||||
if (window.SeasonalsPluginConfig && window.SeasonalsPluginConfig.EnableClientSideToggle === false) {
|
// User Preference Check
|
||||||
|
const isEnabled = SettingsManager.getSetting('enabled', 'true') === 'true';
|
||||||
|
if (!isEnabled) {
|
||||||
|
console.log('Seasonals: Disabled by user preference.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const headerRight = document.querySelector('.headerRight');
|
// Determine Theme
|
||||||
if (headerRight && !document.querySelector('.seasonal-settings-button')) {
|
const themeName = this.selectTheme();
|
||||||
const icon = createSettingsIcon();
|
console.log(`Seasonals: Selected theme: ${themeName}`);
|
||||||
headerRight.prepend(icon);
|
|
||||||
// obs.disconnect();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
observer.observe(document.body, {
|
if (!themeName || themeName === 'none') {
|
||||||
childList: true,
|
return;
|
||||||
subtree: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
injectSettingsIcon();
|
// Apply Theme
|
||||||
|
this.applyTheme(themeName);
|
||||||
|
},
|
||||||
|
|
||||||
|
selectTheme() {
|
||||||
|
// Check local override
|
||||||
|
const forcedTheme = SettingsManager.getSetting('theme', 'auto');
|
||||||
|
if (forcedTheme !== 'auto') {
|
||||||
|
console.log(`Seasonals: User forced theme: ${forcedTheme}`);
|
||||||
|
return forcedTheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
const automate = this.config ? this.config.AutomateSeasonSelection : true;
|
||||||
|
const defaultTheme = this.config ? this.config.SelectedSeason : 'none';
|
||||||
|
|
||||||
|
if (!automate) {
|
||||||
|
return defaultTheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.determineCurrentThemeDate();
|
||||||
|
},
|
||||||
|
|
||||||
|
determineCurrentThemeDate() {
|
||||||
|
const date = new Date();
|
||||||
|
const month = date.getMonth(); // 0-11
|
||||||
|
const day = date.getDate(); // 1-31
|
||||||
|
|
||||||
|
if ((month === 11 && day >= 28) || (month === 0 && day <= 5)) return 'fireworks'; //new year fireworks december 28 - january 5
|
||||||
|
|
||||||
|
if (month === 1 && day >= 10 && day <= 18) return 'hearts'; // valentine's day february 10 - 18
|
||||||
|
|
||||||
|
if (month === 11 && day >= 22 && day <= 27) return 'santa'; // santa december 22 - 27
|
||||||
|
// if (month === 11 && day >= 22 && day <= 27) return 'christmas'; // christmas december 22 - 27
|
||||||
|
|
||||||
|
if (month === 11) return 'snowflakes'; // snowflakes december
|
||||||
|
if (month === 0 || month === 1) return 'snowfall'; // snow january, february
|
||||||
|
// if (month === 0 || month === 1) return 'snowstorm'; // snow january, february
|
||||||
|
|
||||||
|
if ((month === 2 && day >= 25) || (month === 3 && day <= 25)) return 'easter'; // easter march 25 - april 25
|
||||||
|
|
||||||
|
//NOT IMPLEMENTED YET
|
||||||
|
//if (month >= 2 && month <= 4) return 'spring'; // spring march, april, may
|
||||||
|
|
||||||
|
//NOT IMPLEMENTED YET
|
||||||
|
//if (month >= 5 && month <= 7) return 'summer'; // summer june, july, august
|
||||||
|
|
||||||
|
if ((month === 9 && day >= 24) || (month === 10 && day <= 5)) return 'halloween'; // halloween october 24 - november 5
|
||||||
|
|
||||||
|
if (month >= 8 && month <= 10) return 'autumn'; // autumn september, october, november
|
||||||
|
|
||||||
|
return 'none'; // Fallback (no theme)
|
||||||
|
},
|
||||||
|
|
||||||
|
applyTheme(themeName) {
|
||||||
|
const theme = ThemeConfigs[themeName];
|
||||||
|
if (!theme) {
|
||||||
|
console.error(`Seasonals: Theme "${themeName}" not found.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateThemeContainer(theme.containerClass);
|
||||||
|
|
||||||
|
if (theme.css) this.loadResource('css', theme.css);
|
||||||
|
if (theme.js) this.loadResource('js', theme.js);
|
||||||
|
|
||||||
|
console.log(`Seasonals: Theme "${themeName}" applied.`);
|
||||||
|
},
|
||||||
|
|
||||||
|
updateThemeContainer(containerClass) {
|
||||||
|
let container = document.querySelector('.seasonals-container');
|
||||||
|
if (!container) {
|
||||||
|
container = document.createElement('div');
|
||||||
|
container.className = 'seasonals-container';
|
||||||
|
document.body.appendChild(container);
|
||||||
|
}
|
||||||
|
container.className = `seasonals-container ${containerClass}`;
|
||||||
|
},
|
||||||
|
|
||||||
|
// helper to resolve paths for local testing vs production
|
||||||
|
resolvePath(path) {
|
||||||
|
if (window.location.protocol === 'file:' || window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
|
||||||
|
return path.replace('/Seasonals/Resources/', './');
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
},
|
||||||
|
|
||||||
|
loadResource(type, path) {
|
||||||
|
if (!path) return;
|
||||||
|
|
||||||
|
if (type === 'css') {
|
||||||
|
const link = document.createElement('link');
|
||||||
|
link.rel = 'stylesheet';
|
||||||
|
link.href = path;
|
||||||
|
// link.href = resolvePath(cssPath);
|
||||||
|
link.onerror = () => console.error(`Seasonals: Failed to load CSS: ${path}`);
|
||||||
|
document.body.appendChild(link);
|
||||||
|
} else if (type === 'js') {
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.src = path;
|
||||||
|
// script.src = resolvePath(jsPath);
|
||||||
|
script.defer = true;
|
||||||
|
script.onerror = () => console.error(`Seasonals: Failed to load JS: ${path}`);
|
||||||
|
document.body.appendChild(script);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SeasonalsManager.init();
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
"imageUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/Jellyfin-Seasonals-Plugin/raw/branch/main/logo.png",
|
"imageUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/Jellyfin-Seasonals-Plugin/raw/branch/main/logo.png",
|
||||||
"versions": [
|
"versions": [
|
||||||
{
|
{
|
||||||
"version": "1.6.13.0",
|
"version": "1.6.13.3",
|
||||||
"changelog": "- feat: Add client-side toggle option for seasonal settings",
|
"changelog": "- Refactor seasonals.js",
|
||||||
"targetAbi": "10.11.0.0",
|
"targetAbi": "10.11.0.0",
|
||||||
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/Jellyfin-Seasonals-Plugin/releases/download/v1.6.13.0/Jellyfin.Plugin.Seasonals.zip",
|
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/Jellyfin-Seasonals-Plugin/releases/download/v1.6.13.3/Jellyfin.Plugin.Seasonals.zip",
|
||||||
"checksum": "171e02dc929fe93497e784e603475e50",
|
"checksum": "db8bcc00ef0e10d3e56f8079bbbb9491",
|
||||||
"timestamp": "2026-02-03T23:12:28Z"
|
"timestamp": "2026-02-04T15:22:39Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"version": "1.5.1.0",
|
"version": "1.5.1.0",
|
||||||
@@ -107,6 +107,54 @@
|
|||||||
"category": "General",
|
"category": "General",
|
||||||
"imageUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/raw/branch/main/logo.png",
|
"imageUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/raw/branch/main/logo.png",
|
||||||
"versions": [
|
"versions": [
|
||||||
|
{
|
||||||
|
"version": "1.4.0.1",
|
||||||
|
"changelog": "- feat: Add client-side settings feature for selected media bar settings",
|
||||||
|
"targetAbi": "10.11.0.0",
|
||||||
|
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.4.0.1/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||||
|
"checksum": "4068c03b1ab809906d64d4faed1c1b0e",
|
||||||
|
"timestamp": "2026-02-04T15:01:50Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "1.4.0.0",
|
||||||
|
"changelog": "- feat: Add client-side settings feature for selected media bar settings",
|
||||||
|
"targetAbi": "10.11.0.0",
|
||||||
|
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.4.0.0/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||||
|
"checksum": "20faa2a703dbb46591f4bd09e6ab7ec3",
|
||||||
|
"timestamp": "2026-02-04T12:49:45Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "1.3.0.3",
|
||||||
|
"changelog": "- feat: Enhance custom media ID functionality with manual trailer override support",
|
||||||
|
"targetAbi": "10.11.0.0",
|
||||||
|
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.3.0.3/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||||
|
"checksum": "1d9e0a8342d46f84aed3f7bd1bee32d3",
|
||||||
|
"timestamp": "2026-02-04T01:41:35Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "1.3.0.2",
|
||||||
|
"changelog": "- feat: Enhance custom media ID functionality with manual trailer override support",
|
||||||
|
"targetAbi": "10.11.0.0",
|
||||||
|
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.3.0.2/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||||
|
"checksum": "22e79daa5f433ca09a3db4f8e37679b4",
|
||||||
|
"timestamp": "2026-02-04T01:27:55Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "1.3.0.1",
|
||||||
|
"changelog": "- feat: Enhance custom media ID functionality with manual trailer override support",
|
||||||
|
"targetAbi": "10.11.0.0",
|
||||||
|
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.3.0.1/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||||
|
"checksum": "5a4f555e29c733dabd51169f6ace56eb",
|
||||||
|
"timestamp": "2026-02-04T01:14:19Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "1.3.0.0",
|
||||||
|
"changelog": "- feat: Enhance custom media ID functionality with manual trailer override support",
|
||||||
|
"targetAbi": "10.11.0.0",
|
||||||
|
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.3.0.0/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||||
|
"checksum": "83c26ba8f7ad6e1a7fe73c7190f532f3",
|
||||||
|
"timestamp": "2026-02-04T00:07:15Z"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "1.2.3.7",
|
"version": "1.2.3.7",
|
||||||
"changelog": "- Fixes the issue where buttons were cut off on smaller screens such as on S24/S25.\n- Update mediaBarEnhanced.js and mediaBarEnhanced.css with version 3.0.9 from original repo",
|
"changelog": "- Fixes the issue where buttons were cut off on smaller screens such as on S24/S25.\n- Update mediaBarEnhanced.js and mediaBarEnhanced.css with version 3.0.9 from original repo",
|
||||||
|
|||||||
Reference in New Issue
Block a user