File size: 1,247 Bytes
679329e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// توابع کمکی فرمت‌دهی زمان و تاریخ
function getPersianDate() {
    const d = new Date();
    const option = { month: 'long', day: 'numeric', year: 'numeric' };
    return d.toLocaleDateString('fa-IR', option);
}

function fmt(s) { 
    let sec = Math.floor(s); 
    let ms = Math.round((s - sec) * 100); 
    return `${sec < 10 ? '0'+sec : sec}.${ms < 10 ? '0'+ms : ms}`; 
}

function formatTimeSimple(sec) { 
    let m = Math.floor(sec / 60); 
    let s = Math.floor(sec % 60); 
    return `${m}:${s < 10 ? '0'+s : s}`; 
}

// انیمیشن ساده
function startAnim(selector) { 
    const container = document.querySelector(selector); 
    if(!container) return; 
    const words = container.querySelectorAll('.anim-word'); 
    let i = 0; 
    setInterval(() => { 
        words.forEach(w => w.classList.remove('active')); 
        words[i].classList.add('active'); 
        i = (i + 1) % words.length; 
    }, 600); 
}

// همگام‌سازی دکمه‌های استایل
function syncModeButtons() { 
    document.querySelectorAll('.mode-btn').forEach(b => { 
        b.classList.remove('active'); 
        if(b.getAttribute('onclick').includes(`'${state.st.type}'`)) b.classList.add('active'); 
    }); 
}