MCPcopy Create free account
hub / github.com/MemeTray/MemeTray / handleFileSelect

Function handleFileSelect

tools/all-in-one/script.js:159–182  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

157
158// Handle file selection from the input element
159function 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
185function handleDragOver(e) {

Callers

nothing calls this directly

Calls 1

processFilesFunction · 0.70

Tested by

no test coverage detected