()
| 86 | APP INIT (shared) |
| 87 | ========================= */ |
| 88 | export function initializeApp() { |
| 89 | const saved = parseInt(localStorage.getItem('rowHeight') || '44', 10); |
| 90 | document.documentElement.style.setProperty('--file-row-height', saved + 'px'); |
| 91 | |
| 92 | // Ensure zoom script is loaded for toolbar controls |
| 93 | try { |
| 94 | const QVER = (window.APP_QVER && String(window.APP_QVER)) || '{{APP_QVER}}'; |
| 95 | import(withBase(`/js/zoom.js?v=${encodeURIComponent(QVER)}`)).catch(err => { |
| 96 | console.warn('[zoom] failed to load zoom.js', err); |
| 97 | }); |
| 98 | } catch (err) { |
| 99 | console.warn('[zoom] load error:', err); |
| 100 | } |
| 101 | |
| 102 | const last = localStorage.getItem('lastOpenedFolder'); |
| 103 | window.currentFolder = last ? last : "root"; |
| 104 | |
| 105 | const stored = localStorage.getItem('showFoldersInList'); |
| 106 | // default: false (unchecked) |
| 107 | window.showFoldersInList = stored === 'true'; |
| 108 | |
| 109 | // Load public site config early (safe subset) |
| 110 | loadAdminConfigFunc(); |
| 111 | |
| 112 | // Enable tag search UI; initial file list load is controlled elsewhere |
| 113 | initTagSearch(); |
| 114 | |
| 115 | |
| 116 | /* |
| 117 | // Hook DnD relay from fileList area into upload area |
| 118 | const fileListArea = document.getElementById('fileList'); |
| 119 | |
| 120 | if (fileListArea) { |
| 121 | let hoverTimer = null; |
| 122 | |
| 123 | fileListArea.addEventListener('dragover', e => { |
| 124 | e.preventDefault(); |
| 125 | fileListArea.classList.add('drop-hover'); |
| 126 | // (optional) auto-open after brief hover so users see the drop target |
| 127 | if (!hoverTimer) { |
| 128 | hoverTimer = setTimeout(() => { |
| 129 | if (typeof window.openUploadModal === 'function') window.openUploadModal(); |
| 130 | }, 400); |
| 131 | } |
| 132 | }); |
| 133 | |
| 134 | fileListArea.addEventListener('dragleave', () => { |
| 135 | fileListArea.classList.remove('drop-hover'); |
| 136 | if (hoverTimer) { clearTimeout(hoverTimer); hoverTimer = null; } |
| 137 | }); |
| 138 | |
| 139 | fileListArea.addEventListener('drop', async e => { |
| 140 | e.preventDefault(); |
| 141 | fileListArea.classList.remove('drop-hover'); |
| 142 | if (hoverTimer) { clearTimeout(hoverTimer); hoverTimer = null; } |
| 143 | |
| 144 | // 1) open the same modal that the Create menu uses |
| 145 | openUploadModal(); |
no test coverage detected