File size: 2,643 Bytes
66f69ed
 
 
 
 
 
 
 
 
 
 
 
 
 
1f3572e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66f69ed
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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);
    });
  });
});