1/** 2 * JavaScript for index.html page 3 * Handles collapse icon rotation and page-specific functionality 4 */ 5 6document.addEventListener('DOMContentLoaded', function() { 7 // Setup collapse icon rotations for all collapsible sections 8 const collapseConfigs = [ 9 { collapseId: 'resultsCollapse', iconId: 'resultsCollapseIcon' }, 10 { collapseId: 'statsOverviewCollapse', iconId: 'statsOverviewCollapseIcon' }, 11 { collapseId: 'qualityCollapse', iconId: 'qualityCollapseIcon' }, 12 { collapseId: 'licenseDistributionCollapse', iconId: 'licenseDistributionCollapseIcon' }, 13 { collapseId: 'topCommonDependenciesCollapse', iconId: 'topCommonDependenciesCollapseIcon' }, 14 { collapseId: 'versionSprawlCollapse', iconId: 'versionSprawlCollapseIcon' }, 15 { collapseId: 'portfolioSnapshotCollapse', iconId: 'portfolioSnapshotCollapseIcon' } 16 ]; 17 18 collapseConfigs.forEach(config => { 19 setupCollapseIcon(config.collapseId, config.iconId); 20 }); 21 22 // Attach event listeners for buttons that previously used onclick handlers 23 // Resume Analysis button 24 const resumeBtn = document.getElementById('resumeBtn'); 25 if (resumeBtn) { 26 resumeBtn.addEventListener('click', function() { 27 if (window.app && typeof window.app.resumeAnalysis === 'function') { 28 window.app.resumeAnalysis(); 29 } 30 }); 31 } 32 33 // Clear Rate Limit State button 34 const clearRateLimitBtn = document.getElementById('clearRateLimitBtn'); 35 if (clearRateLimitBtn) { 36 clearRateLimitBtn.addEventListener('click', function() { 37 if (window.app && typeof window.app.clearRateLimitState === 'function') { 38 window.app.clearRateLimitState(); 39 } 40 }); 41 } 42 43 // Start Analysis button 44 const analyzeBtn = document.getElementById('analyzeBtn'); 45 if (analyzeBtn) { 46 analyzeBtn.addEventListener('click', function() { 47 if (typeof startAnalysis === 'function') { 48 startAnalysis(); 49 } 50 }); 51 } 52 53 // Token section toggle 54 const tokenHeader = document.getElementById('tokenSectionHeader'); 55 if (tokenHeader) { 56 tokenHeader.addEventListener('click', function() { 57 if (typeof toggleTokenSection === 'function') { 58 toggleTokenSection(); 59 } 60 }); 61 } 62 63 // Save Token button 64 const saveTokenBtn = document.getElementById('saveTokenBtn'); 65 if (saveTokenBtn) { 66 saveTokenBtn.addEventListener('click', function() { 67 if (typeof saveToken === 'function') { 68 saveToken(); 69 } 70 }); 71 } 72 73 // Handle URL hash to activate upload tab if coming from upload.html redirect 74 if (window.location.hash === '#upload-tab') { 75 const uploadTab = document.getElementById('upload-tab'); 76 if (uploadTab) { 77 // Use Bootstrap's Tab API to show the upload tab 78 const tab = new bootstrap.Tab(uploadTab); 79 tab.show(); 80 // Scroll to the input section 81 const inputCard = uploadTab.closest('.card'); 82 if (inputCard) { 83 inputCard.scrollIntoView({ behavior: 'smooth', block: 'start' }); 84 } 85 } 86 } 87}); 88
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.