Ensure user Home Screen display preferences are propogated to the native (hidden) select inputs

This commit is contained in:
HighImKevin committed 2026-02-01 00:38:35 -05:00
1 parent f57bf43a93
commit 59aea0be00
2 files changed
+30 -6

No files matched your search

+29 -5
View File
@@ -375,15 +375,39 @@
} }
}); });
// Ensure each section has a unique jellyfinBaseId
const uniqueHomeSections = sectionsForHomesectionN.filter((section, index, self) =>
index === self.findIndex(s => s.jellyfinBaseId === section.jellyfinBaseId)
);
// Sort all sections by order // Sort all sections by order
sectionsForHomesectionN.sort((a, b) => (a.order || 0) - (b.order || 0)); uniqueHomeSections.sort((a, b) => (a.order || 0) - (b.order || 0));
// Assign each section to homesectionN sequentially // Assign each section to homesectionN sequentially
sectionsForHomesectionN.forEach((section, index) => { for (let i = 0; i <= 9; i++) {
if (index <= 8) { // Only homesection0 through homesection8 const selectHomeSection = document.querySelector(`.homeScreenSettingsContainer #selectHomeSection${i+1}`);
customPrefs[`homesection${index}`] = section.jellyfinBaseId; if (i <= uniqueHomeSections.length - 1) {
const selectedSection = uniqueHomeSections[i].jellyfinBaseId;
customPrefs[`homesection${i}`] = selectedSection;
const selectedOption = selectHomeSection.querySelector(`option[value="${selectedSection}"]`);
if (selectedOption) {
selectHomeSection.value = selectedOption.value;
} else {
selectHomeSection.value = '';
}
} else {
customPrefs[`homesection${i}`] = 'none';
// Find the value of the "None" option label, some have value="none" and some have no value at all
const noneOption = selectHomeSection.querySelector('option[value="none"]');
if (noneOption) {
selectHomeSection.value = noneOption.value;
} else {
selectHomeSection.value = '';
}
} }
}); }
// Save // Save
const success = await window.userHelper.updateDisplayPreferences(displayPrefs); const success = await window.userHelper.updateDisplayPreferences(displayPrefs);
+1 -1
View File
@@ -716,7 +716,7 @@
} }
async function loadConfigurationJS() { async function loadConfigurationJS() {
const configDependencyNames = ['modal', 'toaster', 'utils', 'homeScreen-configuration', 'search-configuration', 'seriesEpisodes-configuration', 'seriesInfo-configuration', 'skinManager-configuration', 'customMenuLinks-configuration']; const configDependencyNames = ['modal', 'toaster', 'utils', 'homeScreenConfig2', 'homeScreen-migration', 'homeScreen-configuration', 'search-configuration', 'seriesEpisodes-configuration', 'seriesInfo-configuration', 'skinManager-configuration', 'customMenuLinks-configuration'];
for (const depName of configDependencyNames) { for (const depName of configDependencyNames) {
const depScript = SCRIPT_DEFINITIONS.find(script => script.name === depName); const depScript = SCRIPT_DEFINITIONS.find(script => script.name === depName);
if (depScript) { if (depScript) {