Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ const dropZone = document.getElementById('dropZone');
+ const fileInput = document.getElementById('fileInput');
+ const processBtn = document.getElementById('processBtn');
+ const modelCards = document.querySelectorAll('.model-card');
+
+ let selectedFile = null;
+ let selectedModel = null;
+
+ // File upload handling
+ dropZone.addEventListener('click', () => fileInput.click());
+
+ dropZone.addEventListener('dragover', (e) => {
+ e.preventDefault();
+ dropZone.style.borderColor = var(--primary);
+ });
+
+ dropZone.addEventListener('dragleave', () => {
+ dropZone.style.borderColor = '#ccd';
+ });
+
+ dropZone.addEventListener('drop', (e) => {
+ e.preventDefault();
+ const file = e.dataTransfer.files[0];
+ handleFile(file);
+ });
+
+ fileInput.addEventListener('change', (e) => {
+ const file = e.target.files[0];
+ handleFile(file);
+ });
+
+ // Model selection
+ modelCards.forEach(card => {
+ card.addEventListener('click', () => {
+ modelCards.forEach(c => c.style.border = 'none');
+ card.style.border = `2px solid var(--primary)`;
+ selectedModel = card.dataset.model;
+ updateProcessButton();
+ });
+ });
+
+ function handleFile(file) {
+ if (file && (file.name.endsWith('.nii') || file.name.endsWith('.nii.gz'))) {
+ selectedFile = file;
+ dropZone.innerHTML = `
Selected: ${file.name}
`;
+ updateProcessButton();
+ } else {
+ alert('Please upload a valid NII file');
+ }
+ }
+
+ function updateProcessButton() {
+ processBtn.disabled = !(selectedFile && selectedModel);
+ }
+
+ processBtn.addEventListener('click', () => {
+ // Here you would implement the actual processing logic
+ alert(`Processing ${selectedFile.name} with ${selectedModel} model`);
+ });
+ });