(e)
| 157 | |
| 158 | // Handle file selection from the input element |
| 159 | function handleFileSelect(e) { |
| 160 | const files = Array.from(e.target.files); |
| 161 | console.log(`📂 File input selected ${files.length} files`); |
| 162 | files.forEach((file, i) => { |
| 163 | console.log(` ${i + 1}. ${file.name} (${file.type})`); |
| 164 | }); |
| 165 | |
| 166 | // Filter files based on WebP toggle |
| 167 | const webpEnabled = state.settings.webpSupport; |
| 168 | const validFiles = files.filter(file => { |
| 169 | if (webpEnabled) { |
| 170 | return file.type === 'image/gif' || file.type === 'image/webp' || file.type === 'image/png' || file.type === 'image/apng'; |
| 171 | } |
| 172 | return file.type === 'image/gif'; |
| 173 | }); |
| 174 | |
| 175 | if (validFiles.length === 0) { |
| 176 | const supportedFormats = webpEnabled ? 'GIF, WebP, or APNG' : 'GIF'; |
| 177 | alert(`No ${supportedFormats} files selected!`); |
| 178 | return; |
| 179 | } |
| 180 | |
| 181 | processFiles(validFiles); |
| 182 | } |
| 183 | |
| 184 | // Drag-and-drop handlers |
| 185 | function handleDragOver(e) { |
nothing calls this directly
no test coverage detected