| 6266 | } |
| 6267 | |
| 6268 | async function saveStlHomeExcludeDirectoriesSetting() { |
| 6269 | if (!window._stlHomeExcludeDirsLoaded) return; |
| 6270 | const dirs = Array.isArray(window._stlHomeExcludeDirs) ? window._stlHomeExcludeDirs : []; |
| 6271 | await window.electron.saveSetting('stlHomeExcludeDirectories', JSON.stringify(dirs)); |
| 6272 | } |
| 6273 | window.saveStlHomeExcludeDirectoriesSetting = saveStlHomeExcludeDirectoriesSetting; |
| 6274 | |
| 6275 | function bindStlHomeExcludeControls() { |
| 6276 | const list = document.getElementById('stl-home-exclude-list'); |
| 6277 | const browseBtn = document.getElementById('stl-home-exclude-browse'); |
| 6278 | const addBtn = document.getElementById('stl-home-exclude-add'); |
| 6279 | const input = document.getElementById('stl-home-exclude-input'); |
| 6280 | if (list && !list.dataset.bound) { |
| 6281 | list.dataset.bound = '1'; |
| 6282 | list.addEventListener('click', (e) => { |
| 6283 | const btn = e.target.closest && e.target.closest('.stl-home-exclude-remove'); |
| 6284 | if (!btn || !list.contains(btn)) return; |
| 6285 | const index = Number(btn.dataset.index); |
| 6286 | if (!Number.isInteger(index)) return; |
| 6287 | const next = (window._stlHomeExcludeDirs || []).slice(); |