File size: 3,278 Bytes
33fefaf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
document.addEventListener('DOMContentLoaded', function() {
    const startBotBtn = document.getElementById('startBotBtn');
    const stopBotBtn = document.getElementById('stopBotBtn');
    const botStatus = document.getElementById('botStatus');
    const logContainer = document.getElementById('logContainer');
    
    let botRunning = false;
    let logEntries = [];
    let fakeOperationInterval;

    // Simulate bot operation
    function simulateBotOperation() {
        const now = new Date();
        const timeString = now.toLocaleTimeString();
        
        // Add log entry
        addLogEntry(`[${timeString}] Bot iniciado com sucesso`, 'info');
        addLogEntry(`[${timeString}] Conectado à IQ Option`, 'info');
        addLogEntry(`[${timeString}] Par de ativos: EURUSD-OTC`, 'info');
        addLogEntry(`[${timeString}] Martingale: 2 níveis`, 'info');
        
        // Simulate periodic operations
        fakeOperationInterval = setInterval(() => {
            const opTime = new Date();
            const opTimeString = opTime.toLocaleTimeString();
            const randomOutcome = Math.random() > 0.4 ? 'WIN' : 'LOSS';
            
            if (randomOutcome === 'WIN') {
                addLogEntry(`[${opTimeString}] Operação concluída: WIN! Lucro: $${(Math.random() * 5 + 1).toFixed(2)}`, 'info');
            } else {
                addLogEntry(`[${opTimeString}] Operação concluída: LOSS. Aplicando Martingale...`, 'warning');
            }
        }, 5000);
    }

    // Add log entry
    function addLogEntry(message, type = 'info') {
        const entry = document.createElement('div');
        entry.className = `log-entry ${type}`;
        entry.textContent = message;
        logContainer.prepend(entry);
        logEntries.unshift(message);
        
        // Keep log clean
        if (logEntries.length > 50) {
            logContainer.removeChild(logContainer.lastChild);
            logEntries.pop();
        }
    }

    // Start bot
    startBotBtn.addEventListener('click', function() {
        if (!botRunning) {
            botRunning = true;
            botStatus.className = 'inline-block w-3 h-3 rounded-full bg-green-500 mr-2 pulse-animation';
            startBotBtn.classList.add('opacity-50', 'cursor-not-allowed');
            startBotBtn.disabled = true;
            stopBotBtn.classList.remove('opacity-50', 'cursor-not-allowed');
            stopBotBtn.disabled = false;
            
            simulateBotOperation();
        }
    });

    // Stop bot
    stopBotBtn.addEventListener('click', function() {
        if (botRunning) {
            botRunning = false;
            botStatus.className = 'inline-block w-3 h-3 rounded-full bg-red-500 mr-2';
            stopBotBtn.classList.add('opacity-50', 'cursor-not-allowed');
            stopBotBtn.disabled = true;
            startBotBtn.classList.remove('opacity-50', 'cursor-not-allowed');
            startBotBtn.disabled = false;
            
            clearInterval(fakeOperationInterval);
            
            const now = new Date();
            const timeString = now.toLocaleTimeString();
            addLogEntry(`[${timeString}] Bot parado pelo usuário`, 'warning');
        }
    });

    // Initialize UI
    feather.replace();
});