(groupRecord)
| 19420 | try { |
| 19421 | if (await isServerThumbnailWorkerContext()) { |
| 19422 | console.log('[Server thumbnails] Worker window: skipping initializeApp'); |
| 19423 | return; |
| 19424 | } |
| 19425 | // Load saved sort preference before initializing search |
| 19426 | const savedSortOption = await window.electron.getSetting('sortOption'); |
| 19427 | const sortSelect = document.getElementById('sort-select'); |
| 19428 | if (sortSelect && savedSortOption) { |
| 19429 | // Validate that the saved option is a valid sort option |
| 19430 | const validOptions = ['name-asc', 'name-desc', 'size-asc', 'size-desc', 'date-asc', 'date-desc', 'dateadded-asc', 'dateadded-desc', 'directory-asc', 'directory-desc', 'designer-asc', 'designer-desc', 'parentmodel-asc', 'parentmodel-desc', 'printed-asc', 'printed-desc', 'printstatus-asc', 'printstatus-desc', 'printcount-asc', 'printcount-desc', 'lastprinted-asc', 'lastprinted-desc', 'rating-asc', 'rating-desc']; |
| 19431 | if (validOptions.includes(savedSortOption)) { |
| 19432 | sortSelect.value = savedSortOption; |
| 19433 | } |
| 19434 | } |
| 19435 | |
| 19436 | // Initialize the combined search functionality from search.js |
| 19437 | if (typeof window.initializeCombinedSearch === 'function') { |
| 19438 | await window.initializeCombinedSearch(); |
| 19439 | } |
| 19440 | |
| 19441 | console.log('1. Starting initialization sequence'); |
| 19442 | |
| 19443 | // Initialize settings inline instead of calling initializeSettings() |
| 19444 | console.log('2. Loading settings...'); |
| 19445 | try { |
| 19446 | // Initialize other settings as needed |
| 19447 | const backgroundColor = await window.electron.getSetting('modelBackgroundColor'); |
| 19448 | if (backgroundColor) { |
| 19449 | document.documentElement.style.setProperty('--model-background-color', backgroundColor); |
| 19450 | const colorPicker = document.getElementById('model-background-color'); |
| 19451 | if (colorPicker) { |
| 19452 | colorPicker.value = backgroundColor; |
| 19453 | } |
| 19454 | } |
| 19455 | |
| 19456 | // Load UI theme |
| 19457 | const savedTheme = await window.electron.getSetting('uiTheme') || 'modern-cyan'; |
| 19458 | document.body.setAttribute('data-theme', savedTheme); |
| 19459 | const uiThemeSelect = document.getElementById('ui-theme'); |
| 19460 | if (uiThemeSelect) { |
| 19461 | uiThemeSelect.value = savedTheme; |
| 19462 | } |
| 19463 | |
| 19464 | // Apply theme colors if function exists |
| 19465 | if (typeof applyThemeColors === 'function') { |
| 19466 | applyThemeColors(savedTheme); |
| 19467 | } else { |
| 19468 | // Fallback: apply theme colors inline |
| 19469 | const root = document.documentElement; |
| 19470 | switch(savedTheme) { |
no test coverage detected