File size: 988 Bytes
6edb49c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
document.addEventListener('DOMContentLoaded', function() {
    // Format all currency elements
    document.querySelectorAll('.currency').forEach(el => {
        const amount = parseFloat(el.textContent);
        el.textContent = amount.toLocaleString('en-US', {
            style: 'currency',
            currency: 'USD'
        });
    });

    // Add tooltips to all elements with data-tooltip attribute
    tippy('[data-tooltip]', {
        content(reference) {
            return reference.getAttribute('data-tooltip');
        },
    });
});

// Balance pulse animation for low balance warning
function animateBalanceWarning() {
    const balanceWarning = document.querySelector('.balance-warning');
    if (balanceWarning) {
        balanceWarning.classList.add('animate-pulse-slow');
    }
}

// Initialize when DOM is loaded
if (document.readyState !== 'loading') {
    animateBalanceWarning();
} else {
    document.addEventListener('DOMContentLoaded', animateBalanceWarning);
}