diff --git a/index.html b/index.html index 736f55a..0862b2e 100644 --- a/index.html +++ b/index.html @@ -853,7 +853,20 @@ uploadBtn.addEventListener('click', () => { uploadAnyInput.addEventListener('change', e => { const file = e.target.files[0]; - if (file) processFile(file); + if (!file) return; + if (outputSection.style.display && outputSection.style.display !== 'none') { + const name = file.name.toLowerCase(); + const isDataFormat = name.endsWith('.fit') || name.endsWith('.fits') || + name.endsWith('.cr2') || name.endsWith('.cr3') || + name.endsWith('.tif') || name.endsWith('.tiff'); + if (isDataFormat) { + processFile(file); + } else { + swapBackground(file); + } + } else { + processFile(file); + } uploadAnyInput.value = ''; });