document.addEventListener('DOMContentLoaded', function() { // Fix for tooltips that stay bold after hover const tooltipTriggers = document.querySelectorAll('.tooltip-trigger'); tooltipTriggers.forEach(trigger => { trigger.addEventListener('mouseleave', function() { // Force style reset after hover setTimeout(() => { this.style.fontWeight = ''; this.style.fontSize = ''; this.style.textDecoration = ''; }, 50); }); }); // Additional fix to ensure cost analysis tooltips are initialized properly function fixCostAnalysisTooltips() { console.log("Fixing cost analysis tooltips"); // Wait for the cost-analysis tab to be visible const costTab = document.getElementById('cost-analysis'); if (!costTab) return; // Find all model tooltips in the cost analysis section const modelTooltips = costTab.querySelectorAll('td:first-child .tooltip-trigger, th:first-child .tooltip-trigger'); console.log(`Found ${modelTooltips.length} model tooltips in cost analysis tab`); // Ensure they have proper tooltip trigger classes and attributes modelTooltips.forEach(tooltip => { // Make sure they have proper classes and positioning tooltip.classList.add('tooltip-right'); tooltip.style.position = 'relative'; // Ensure they have the data we need if (!tooltip.getAttribute('data-title') && tooltip.innerText) { tooltip.setAttribute('data-title', tooltip.innerText); } }); // Force tooltips.js to rerun its initialization if (window.fixProblemTooltips) { console.log("Calling fixProblemTooltips for cost analysis"); window.fixProblemTooltips(); } } // Run the fix when the cost analysis tab is clicked const costTabLink = document.querySelector('a[href="#cost-analysis"]'); if (costTabLink) { console.log("Found cost analysis tab link"); costTabLink.addEventListener('click', function() { console.log("Cost analysis tab clicked"); // Give time for the content to be displayed setTimeout(fixCostAnalysisTooltips, 300); }); } // Also run when DOMContentLoaded to catch initial page load to that tab setTimeout(fixCostAnalysisTooltips, 500); // Run again when tabs are clicked to ensure tabs have proper tooltips const tabs = document.querySelectorAll('.tabs li a'); tabs.forEach(tab => { tab.addEventListener('click', () => { console.log(`Tab clicked: ${tab.textContent}`); // Give time for the content to be displayed setTimeout(fixCostAnalysisTooltips, 300); }); }); });