File size: 1,562 Bytes
415ceb3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// 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 });
    }
});