Spaces:
Running
Running
// Handle concept card clicks | |
function conceptClick(conceptId) { | |
// Find the hidden input field and update its value | |
const conceptSelection = document.getElementById('concept-selection'); | |
if (conceptSelection) { | |
conceptSelection.value = conceptId; | |
conceptSelection.dispatchEvent(new Event('input', { bubbles: true })); | |
// Highlight the selected card | |
document.querySelectorAll('.concept-card').forEach(card => { | |
card.classList.remove('selected-card'); | |
if (card.getAttribute('data-concept-id') === conceptId) { | |
card.classList.add('selected-card'); | |
} | |
}); | |
} | |
} | |
// Enhance image display after loading | |
document.addEventListener('DOMContentLoaded', function() { | |
const graphContainer = document.getElementById('concept-graph'); | |
if (graphContainer) { | |
const observer = new MutationObserver(function(mutations) { | |
mutations.forEach(function(mutation) { | |
if (mutation.addedNodes && mutation.addedNodes.length > 0) { | |
const img = graphContainer.querySelector('img'); | |
if (img) { | |
img.style.maxWidth = '100%'; | |
img.style.height = 'auto'; | |
img.style.borderRadius = '8px'; | |
img.style.boxShadow = '0 4px 8px rgba(0,0,0,0.1)'; | |
} | |
} | |
}); | |
}); | |
observer.observe(graphContainer, { childList: true, subtree: true }); | |
} | |
}); |