Deep Screen

DeepSeek icin gelismis alarm kontrol paneli

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

You will need to install an extension such as Tampermonkey to install this script.

Tendrás que instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Tendrás que instalar una extensión como Tampermonkey antes de poder instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

// ==UserScript==
// @name         Deep Screen
// @namespace    https://greasyfork.org/users/deep-screen-alarm
// @version      3.1.0
// @description  DeepSeek icin gelismis alarm kontrol paneli
// @author       Ali Osman Dinke
// @match        https://chat.deepseek.com/*
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// @run-at       document-end
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    let soundList = GM_getValue('soundList', []);
    let activeSoundId = GM_getValue('activeSoundId', null);

    if (soundList.length === 0) {
        soundList.push({
            id: Date.now(),
            ad: 'ARINMA GECESI',
            url: 'https://myinstants.net/AllSounds/17d08409-00c9-4544-b61a-394cb5add81c.mp3',
            tur: 'UYARI'
        });
        activeSoundId = soundList[0].id;
        GM_setValue('soundList', soundList);
        GM_setValue('activeSoundId', activeSoundId);
    }

    let settings = {
        enabled: GM_getValue('enabled', true),
        volume: GM_getValue('volume', 0.7),
        flashEffect: GM_getValue('flashEffect', true),
        flashColor: GM_getValue('flashColor', '#ff0000'),
        titleAlert: GM_getValue('titleAlert', true),
        titleText: GM_getValue('titleText', '🔴 CONTINUE BUTONU! 🔴'),
        titleText2: GM_getValue('titleText2', '🚨 ALARM AKTIF! 🚨')
    };

    let isAlerting = false;
    let currentAudio = null;
    let flashInterval = null;

    const soundTypes = ['YUMUSAK', 'UYARI', 'ALARM', 'EGLENCELI', 'BILDIRIM'];

    function getActiveSound() {
        return soundList.find(s => s.id === activeSoundId) || soundList[0];
    }

    function createPanel() {
        const panel = document.createElement('div');
        panel.id = 'deep-screen-panel';
        panel.innerHTML = `
            <style>
                #deep-screen-panel {
                    position: fixed;
                    top: 20px;
                    right: 20px;
                    width: 340px;
                    background: white;
                    border-radius: 12px;
                    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
                    z-index: 10000;
                    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
                    border: 1px solid #ddd;
                }

                #deep-screen-panel.minimized {
                    width: auto;
                    background: white;
                }

                .panel-header {
                    padding: 12px 16px;
                    background: white;
                    color: black;
                    border-radius: 12px 12px 0 0;
                    cursor: move;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    border-bottom: 1px solid #ddd;
                }

                .panel-header-left {
                    display: flex;
                    align-items: center;
                    gap: 10px;
                }

                .panel-logo {
                    width: 28px;
                    height: 28px;
                    border-radius: 6px;
                }

                .panel-title {
                    font-size: 20px;
                    font-weight: bold;
                    letter-spacing: 3px;
                    color: black;
                }

                .minimize-btn {
                    background: #f0f0f0;
                    border: none;
                    color: black;
                    cursor: pointer;
                    width: 30px;
                    height: 30px;
                    border-radius: 6px;
                    font-size: 18px;
                }

                .minimize-btn:hover {
                    background: #e0e0e0;
                }

                .settings-area {
                    padding: 16px;
                    background: white;
                }

                .setting-group {
                    margin-bottom: 16px;
                    padding-bottom: 12px;
                    border-bottom: 1px solid #eee;
                }

                .setting-label {
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    margin-bottom: 8px;
                    font-size: 14px;
                    font-weight: bold;
                    color: black;
                    text-transform: uppercase;
                }

                .gear-icon {
                    cursor: pointer;
                    font-size: 16px;
                    margin-left: 8px;
                    transition: transform 0.2s;
                }

                .gear-icon:hover {
                    transform: rotate(30deg);
                }

                input[type="range"] {
                    width: 100%;
                    height: 6px;
                    border-radius: 3px;
                    background: #ddd;
                    outline: none;
                    -webkit-appearance: none;
                }

                input[type="range"]::-webkit-slider-thumb {
                    -webkit-appearance: none;
                    width: 16px;
                    height: 16px;
                    border-radius: 50%;
                    background: #333;
                    cursor: pointer;
                }

                .volume-container {
                    position: relative;
                }

                .volume-tooltip {
                    position: absolute;
                    bottom: 100%;
                    left: 50%;
                    transform: translateX(-50%);
                    background: #333;
                    color: white;
                    padding: 4px 8px;
                    border-radius: 4px;
                    font-size: 12px;
                    white-space: nowrap;
                    pointer-events: none;
                    opacity: 0;
                    transition: opacity 0.2s;
                    margin-bottom: 5px;
                }

                .volume-container:hover .volume-tooltip {
                    opacity: 1;
                }

                .sound-select {
                    width: 100%;
                    padding: 8px;
                    border: 1px solid #ddd;
                    border-radius: 6px;
                    background: white;
                    color: black;
                    font-size: 13px;
                    margin-bottom: 8px;
                }

                .sound-item {
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    padding: 6px 8px;
                    margin: 4px 0;
                    background: #f9f9f9;
                    border-radius: 6px;
                    cursor: pointer;
                }

                .sound-item.active {
                    background: #e3f2fd;
                    border-left: 3px solid #2196f3;
                }

                .sound-item-left {
                    display: flex;
                    align-items: center;
                    gap: 8px;
                    flex: 1;
                }

                .sound-check {
                    width: 18px;
                    height: 18px;
                    border-radius: 50%;
                    border: 2px solid #ccc;
                    display: inline-flex;
                    align-items: center;
                    justify-content: center;
                }

                .sound-item.active .sound-check {
                    background: #4caf50;
                    border-color: #4caf50;
                    color: white;
                }

                .sound-check:after {
                    content: "✓";
                    font-size: 12px;
                    display: none;
                }

                .sound-item.active .sound-check:after {
                    display: block;
                }

                .sound-name {
                    font-weight: 500;
                }

                .sound-type {
                    font-size: 10px;
                    padding: 2px 6px;
                    border-radius: 10px;
                    background: #e0e0e0;
                }

                .sound-gear {
                    cursor: pointer;
                    font-size: 14px;
                    padding: 4px;
                }

                .toggle-switch {
                    position: relative;
                    display: inline-block;
                    width: 44px;
                    height: 24px;
                }

                .toggle-switch input {
                    opacity: 0;
                    width: 0;
                    height: 0;
                }

                .toggle-slider {
                    position: absolute;
                    cursor: pointer;
                    top: 0;
                    left: 0;
                    right: 0;
                    bottom: 0;
                    background-color: #ccc;
                    transition: 0.3s;
                    border-radius: 24px;
                }

                .toggle-slider:before {
                    position: absolute;
                    content: "";
                    height: 18px;
                    width: 18px;
                    left: 3px;
                    bottom: 3px;
                    background-color: white;
                    transition: 0.3s;
                    border-radius: 50%;
                }

                input:checked + .toggle-slider {
                    background-color: #333;
                }

                input:checked + .toggle-slider:before {
                    transform: translateX(20px);
                }

                .test-btn {
                    width: 100%;
                    padding: 8px;
                    background: #333;
                    color: white;
                    border: none;
                    border-radius: 6px;
                    cursor: pointer;
                    font-size: 14px;
                    font-weight: 500;
                    margin-top: 8px;
                }

                .test-btn:hover {
                    background: #555;
                }

                .status-badge {
                    display: inline-block;
                    padding: 2px 8px;
                    border-radius: 12px;
                    font-size: 11px;
                    font-weight: bold;
                }

                .status-active {
                    background: #4caf50;
                    color: white;
                }

                .status-inactive {
                    background: #f44336;
                    color: white;
                }

                .modal {
                    position: fixed;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 100%;
                    background: rgba(0,0,0,0.5);
                    z-index: 20000;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                }

                .modal-content {
                    background: white;
                    border-radius: 12px;
                    width: 400px;
                    max-width: 90%;
                    padding: 20px;
                }

                .modal-header {
                    font-size: 18px;
                    font-weight: bold;
                    margin-bottom: 16px;
                    padding-bottom: 10px;
                    border-bottom: 1px solid #ddd;
                }

                .modal-input {
                    width: 100%;
                    padding: 8px;
                    margin: 8px 0;
                    border: 1px solid #ddd;
                    border-radius: 6px;
                }

                .modal-select {
                    width: 100%;
                    padding: 8px;
                    margin: 8px 0;
                    border: 1px solid #ddd;
                    border-radius: 6px;
                }

                .modal-buttons {
                    display: flex;
                    gap: 10px;
                    margin-top: 16px;
                }

                .modal-btn {
                    flex: 1;
                    padding: 8px;
                    border: none;
                    border-radius: 6px;
                    cursor: pointer;
                }

                .modal-btn-save {
                    background: #333;
                    color: white;
                }

                .modal-btn-cancel {
                    background: #f0f0f0;
                    color: black;
                }

                .sound-list-container {
                    max-height: 200px;
                    overflow-y: auto;
                    margin: 10px 0;
                }

                .add-sound-btn {
                    width: 100%;
                    padding: 8px;
                    background: #f0f0f0;
                    border: 1px dashed #ccc;
                    border-radius: 6px;
                    cursor: pointer;
                    margin-top: 8px;
                }

                .delete-sound-btn {
                    color: #f44336;
                    cursor: pointer;
                    font-size: 12px;
                    margin-left: 8px;
                }
            </style>

            <div class="panel-header">
                <div class="panel-header-left">
                    <img class="panel-logo" src="https://images.seeklogo.com/logo-png/61/2/deepseek-ai-icon-logo-png_seeklogo-611473.png" alt="DeepSeek">
                    <div class="panel-title">DEEP SCREEN</div>
                </div>
                <button class="minimize-btn" id="minimizePanel">−</button>
            </div>

            <div class="settings-area">
                <div class="setting-group">
                    <div class="setting-label">
                        <span>🔊 SISTEM DURUMU</span>
                        <span class="status-badge ${settings.enabled ? 'status-active' : 'status-inactive'}">
                            ${settings.enabled ? 'AKTIF' : 'PASIF'}
                        </span>
                    </div>
                    <label class="toggle-switch">
                        <input type="checkbox" id="enableAlarm" ${settings.enabled ? 'checked' : ''}>
                        <span class="toggle-slider"></span>
                    </label>
                </div>

                <div id="dynamicSettings" style="display: ${settings.enabled ? 'block' : 'none'};">
                    <div class="setting-group">
                        <div class="setting-label">
                            <span>🔊 SES SEVIYESI</span>
                            <span id="volumeValue">${Math.round(settings.volume * 100)}%</span>
                        </div>
                        <div class="volume-container">
                            <input type="range" id="volumeControl" min="0" max="1" step="0.01" value="${settings.volume}">
                            <div class="volume-tooltip">🎛️ Fare tekerlegi ile ayarla</div>
                        </div>
                    </div>

                    <div class="setting-group">
                        <div class="setting-label">
                            <span>🎵 SES SEC</span>
                            <span class="gear-icon" id="openSoundModal">⚙️</span>
                        </div>
                        <div id="soundListContainer"></div>
                    </div>

                    <div class="setting-group">
                        <div class="setting-label">
                            <span>📝 BASLIK UYARISI</span>
                            <span class="gear-icon" id="openTitleModal">⚙️</span>
                        </div>
                        <label class="toggle-switch">
                            <input type="checkbox" id="titleAlert" ${settings.titleAlert ? 'checked' : ''}>
                            <span class="toggle-slider"></span>
                        </label>
                    </div>

                    <div class="setting-group">
                        <div class="setting-label">
                            <span>✨ ARKA PLAN EFEKTI</span>
                        </div>
                        <label class="toggle-switch">
                            <input type="checkbox" id="flashEffect" ${settings.flashEffect ? 'checked' : ''}>
                            <span class="toggle-slider"></span>
                        </label>
                        <div style="margin-top: 8px;">
                            <input type="color" id="flashColor" value="${settings.flashColor}" style="width: 100%;">
                        </div>
                    </div>

                    <button class="test-btn" id="testAlarm">🔔 TEST ALARM</button>
                </div>
            </div>
        `;

        document.body.appendChild(panel);
        makeDraggable(panel);
        attachPanelEvents();
        refreshSoundList();
    }

    function refreshSoundList() {
        const container = document.getElementById('soundListContainer');
        if (!container) return;

        const activeSound = getActiveSound();

        container.innerHTML = soundList.map(sound => `
            <div class="sound-item ${activeSoundId === sound.id ? 'active' : ''}" data-id="${sound.id}">
                <div class="sound-item-left">
                    <div class="sound-check"></div>
                    <div class="sound-name">${sound.ad}</div>
                    <div class="sound-type">${sound.tur}</div>
                </div>
                <div class="sound-gear" data-action="edit" data-id="${sound.id}">⚙️</div>
            </div>
        `).join('');

        container.querySelectorAll('.sound-item').forEach(el => {
            el.addEventListener('click', (e) => {
                if (e.target.classList.contains('sound-gear')) return;
                const id = parseInt(el.dataset.id);
                activeSoundId = id;
                GM_setValue('activeSoundId', activeSoundId);
                refreshSoundList();
            });

            const gear = el.querySelector('[data-action="edit"]');
            if (gear) {
                gear.addEventListener('click', (e) => {
                    e.stopPropagation();
                    const id = parseInt(gear.dataset.id);
                    openSoundEditModal(id);
                });
            }
        });
    }

    function openSoundModal() {
        const modal = document.createElement('div');
        modal.className = 'modal';
        modal.innerHTML = `
            <div class="modal-content">
                <div class="modal-header">🎵 SES YONETIMI</div>
                <div class="sound-list-container" id="soundListModal"></div>
                <button class="add-sound-btn" id="addNewSound">+ YENI SES EKLE</button>
                <div class="modal-buttons">
                    <button class="modal-btn modal-btn-cancel" id="closeModal">KAPAT</button>
                </div>
            </div>
        `;
        document.body.appendChild(modal);

        function refreshModalList() {
            const container = modal.querySelector('#soundListModal');
            container.innerHTML = soundList.map((sound, index) => `
                <div class="sound-item" style="margin-bottom: 8px;">
                    <div class="sound-item-left" style="flex-direction: column; align-items: flex-start;">
                        <div><strong>${sound.ad}</strong> <span class="sound-type">${sound.tur}</span></div>
                        <div style="font-size: 10px; color: #666; word-break: break-all;">${sound.url.substring(0, 50)}...</div>
                    </div>
                    <div style="display: flex; gap: 5px;">
                        <span class="sound-gear" data-action="edit-modal" data-id="${sound.id}">✏️</span>
                        <span class="delete-sound-btn" data-action="delete" data-id="${sound.id}" data-index="${index}">🗑️</span>
                    </div>
                </div>
            `).join('');

            container.querySelectorAll('[data-action="edit-modal"]').forEach(el => {
                el.addEventListener('click', (e) => {
                    const id = parseInt(el.dataset.id);
                    modal.remove();
                    openSoundEditModal(id);
                });
            });

            container.querySelectorAll('[data-action="delete"]').forEach(el => {
                el.addEventListener('click', (e) => {
                    const id = parseInt(el.dataset.id);
                    if (soundList.length === 1) {
                        alert('En az bir ses kaydi olmalidir!');
                        return;
                    }
                    soundList = soundList.filter(s => s.id !== id);
                    if (activeSoundId === id) {
                        activeSoundId = soundList[0].id;
                        GM_setValue('activeSoundId', activeSoundId);
                    }
                    GM_setValue('soundList', soundList);
                    refreshModalList();
                    refreshSoundList();
                });
            });
        }

        modal.querySelector('#addNewSound').onclick = () => {
            modal.remove();
            openSoundEditModal(null);
        };

        modal.querySelector('#closeModal').onclick = () => modal.remove();

        refreshModalList();
    }

    function openSoundEditModal(soundId) {
        const isEdit = soundId !== null;
        const sound = isEdit ? soundList.find(s => s.id === soundId) : null;

        const modal = document.createElement('div');
        modal.className = 'modal';
        modal.innerHTML = `
            <div class="modal-content">
                <div class="modal-header">${isEdit ? '✏️ SES DUZENLE' : '➕ YENI SES EKLE'}</div>
                <label>SES ADI</label>
                <input type="text" class="modal-input" id="soundName" placeholder="Orn: ARINMA GECESI" value="${sound ? sound.ad : ''}">
                <label>SES URL</label>
                <input type="text" class="modal-input" id="soundUrl" placeholder="https://...mp3" value="${sound ? sound.url : ''}">
                <label>SES TURU</label>
                <select class="modal-select" id="soundType">
                    ${soundTypes.map(t => `<option value="${t}" ${sound && sound.tur === t ? 'selected' : ''}>${t}</option>`).join('')}
                </select>
                <div class="modal-buttons">
                    <button class="modal-btn modal-btn-save" id="saveSound">KAYDET</button>
                    <button class="modal-btn modal-btn-cancel" id="cancelModal">IPTAL</button>
                </div>
            </div>
        `;
        document.body.appendChild(modal);

        modal.querySelector('#saveSound').onclick = () => {
            const ad = modal.querySelector('#soundName').value.trim();
            const url = modal.querySelector('#soundUrl').value.trim();
            const tur = modal.querySelector('#soundType').value;

            if (!ad || !url) {
                alert('Ses adi ve URL gereklidir!');
                return;
            }

            if (isEdit) {
                sound.ad = ad;
                sound.url = url;
                sound.tur = tur;
            } else {
                const newSound = {
                    id: Date.now(),
                    ad: ad,
                    url: url,
                    tur: tur
                };
                soundList.push(newSound);
                if (!activeSoundId) activeSoundId = newSound.id;
            }

            GM_setValue('soundList', soundList);
            GM_setValue('activeSoundId', activeSoundId);
            refreshSoundList();
            modal.remove();
        };

        modal.querySelector('#cancelModal').onclick = () => modal.remove();
    }

    function openTitleModal() {
        const modal = document.createElement('div');
        modal.className = 'modal';
        modal.innerHTML = `
            <div class="modal-content">
                <div class="modal-header">📝 BASLIK UYARISI DUZENLE</div>
                <label>1. METIN (yanip sonen)</label>
                <input type="text" class="modal-input" id="titleText1" value="${settings.titleText.replace(/"/g, '&quot;')}">
                <label>2. METIN (yanip sonen)</label>
                <input type="text" class="modal-input" id="titleText2" value="${settings.titleText2.replace(/"/g, '&quot;')}">
                <label>Emoji secenekleri:</label>
                <div style="display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0;">
                    <span style="cursor: pointer; font-size: 20px;" class="emoji-picker">🔴</span>
                    <span style="cursor: pointer; font-size: 20px;" class="emoji-picker">🚨</span>
                    <span style="cursor: pointer; font-size: 20px;" class="emoji-picker">⚠️</span>
                    <span style="cursor: pointer; font-size: 20px;" class="emoji-picker">🔔</span>
                    <span style="cursor: pointer; font-size: 20px;" class="emoji-picker">⛔</span>
                    <span style="cursor: pointer; font-size: 20px;" class="emoji-picker">❗</span>
                    <span style="cursor: pointer; font-size: 20px;" class="emoji-picker">❌</span>
                    <span style="cursor: pointer; font-size: 20px;" class="emoji-picker">🔥</span>
                </div>
                <div class="modal-buttons">
                    <button class="modal-btn modal-btn-save" id="saveTitle">KAYDET</button>
                    <button class="modal-btn modal-btn-cancel" id="cancelModal">IPTAL</button>
                </div>
            </div>
        `;
        document.body.appendChild(modal);

        modal.querySelectorAll('.emoji-picker').forEach(emoji => {
            emoji.onclick = () => {
                const input = document.activeElement;
                if (input && (input.id === 'titleText1' || input.id === 'titleText2')) {
                    input.value += emoji.textContent;
                }
            };
        });

        modal.querySelector('#saveTitle').onclick = () => {
            settings.titleText = modal.querySelector('#titleText1').value;
            settings.titleText2 = modal.querySelector('#titleText2').value;
            GM_setValue('titleText', settings.titleText);
            GM_setValue('titleText2', settings.titleText2);
            modal.remove();
        };

        modal.querySelector('#cancelModal').onclick = () => modal.remove();
    }

    function makeDraggable(element) {
        let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
        const header = element.querySelector('.panel-header');

        header.onmousedown = dragMouseDown;

        function dragMouseDown(e) {
            if (e.target.classList.contains('minimize-btn')) return;
            e.preventDefault();
            pos3 = e.clientX;
            pos4 = e.clientY;
            document.onmouseup = closeDragElement;
            document.onmousemove = elementDrag;
        }

        function elementDrag(e) {
            e.preventDefault();
            pos1 = pos3 - e.clientX;
            pos2 = pos4 - e.clientY;
            pos3 = e.clientX;
            pos4 = e.clientY;
            element.style.top = (element.offsetTop - pos2) + "px";
            element.style.left = (element.offsetLeft - pos1) + "px";
            element.style.right = "auto";
        }

        function closeDragElement() {
            document.onmouseup = null;
            document.onmousemove = null;
        }
    }

    function attachPanelEvents() {
        const minimizeBtn = document.getElementById('minimizePanel');
        const panel = document.getElementById('deep-screen-panel');
        const dynamicSettings = document.getElementById('dynamicSettings');

        minimizeBtn.onclick = () => {
            panel.classList.toggle('minimized');
            minimizeBtn.textContent = panel.classList.contains('minimized') ? '+' : '−';
        };

        const volumeSlider = document.getElementById('volumeControl');
        if (volumeSlider) {
            volumeSlider.oninput = (e) => {
                settings.volume = parseFloat(e.target.value);
                GM_setValue('volume', settings.volume);
                document.getElementById('volumeValue').textContent = `${Math.round(settings.volume * 100)}%`;
                if (currentAudio) currentAudio.volume = settings.volume;
            };

            volumeSlider.addEventListener('wheel', (e) => {
                e.preventDefault();
                let newVal = settings.volume + (e.deltaY > 0 ? -0.05 : 0.05);
                newVal = Math.min(1, Math.max(0, newVal));
                settings.volume = newVal;
                GM_setValue('volume', settings.volume);
                volumeSlider.value = settings.volume;
                document.getElementById('volumeValue').textContent = `${Math.round(settings.volume * 100)}%`;
                if (currentAudio) currentAudio.volume = settings.volume;
            });
        }

        document.getElementById('enableAlarm').onchange = (e) => {
            settings.enabled = e.target.checked;
            GM_setValue('enabled', settings.enabled);
            dynamicSettings.style.display = settings.enabled ? 'block' : 'none';
            const badge = document.querySelector('.status-badge');
            badge.className = `status-badge ${settings.enabled ? 'status-active' : 'status-inactive'}`;
            badge.textContent = settings.enabled ? 'AKTIF' : 'PASIF';
            if (!settings.enabled && isAlerting) stopAlert();
        };

        const flashEffectCheck = document.getElementById('flashEffect');
        if (flashEffectCheck) {
            flashEffectCheck.onchange = (e) => {
                settings.flashEffect = e.target.checked;
                GM_setValue('flashEffect', settings.flashEffect);
            };
        }

        const flashColorPicker = document.getElementById('flashColor');
        if (flashColorPicker) {
            flashColorPicker.onchange = (e) => {
                settings.flashColor = e.target.value;
                GM_setValue('flashColor', settings.flashColor);
            };
        }

        const titleAlertCheck = document.getElementById('titleAlert');
        if (titleAlertCheck) {
            titleAlertCheck.onchange = (e) => {
                settings.titleAlert = e.target.checked;
                GM_setValue('titleAlert', settings.titleAlert);
            };
        }

        const testBtn = document.getElementById('testAlarm');
        if (testBtn) {
            testBtn.onclick = () => {
                if (isAlerting) {
                    stopAlert();
                    setTimeout(() => startAlert(true), 100);
                } else {
                    startAlert(true);
                    setTimeout(() => stopAlert(), 3000);
                }
            };
        }

        const openSoundModalBtn = document.getElementById('openSoundModal');
        if (openSoundModalBtn) openSoundModalBtn.onclick = () => openSoundModal();

        const openTitleModalBtn = document.getElementById('openTitleModal');
        if (openTitleModalBtn) openTitleModalBtn.onclick = () => openTitleModal();
    }

    function playSound() {
        if (!isAlerting) return;

        const activeSound = getActiveSound();
        if (currentAudio) {
            currentAudio.pause();
            currentAudio.currentTime = 0;
        }

        currentAudio = new Audio(activeSound.url);
        currentAudio.volume = settings.volume;
        currentAudio.loop = true;
        currentAudio.play().catch(e => console.log('[Deep Screen] Ses hatası:', e));
    }

    function stopSound() {
        if (currentAudio) {
            currentAudio.pause();
            currentAudio.currentTime = 0;
            currentAudio = null;
        }
    }

    function startAlert(isTest = false) {
        if (!settings.enabled && !isTest) return;
        if (isAlerting) return;
        isAlerting = true;

        console.log('[Deep Screen] 🚨 ALARM AKTIF! 🚨');

        if (!isTest) playSound();
        else {
            const activeSound = getActiveSound();
            const testAudio = new Audio(activeSound.url);
            testAudio.volume = settings.volume;
            testAudio.play().catch(e => console.log('Test ses hatası:', e));
        }

        if (settings.flashEffect) {
            let flashCount = 0;
            flashInterval = setInterval(() => {
                if (!isAlerting) {
                    clearInterval(flashInterval);
                    return;
                }
                document.body.style.backgroundColor = flashCount++ % 2 === 0 ? settings.flashColor : '#ffffff';
            }, 300);
        }

        if (settings.titleAlert && !isTest) {
            let titleCount = 0;
            const titleInterval = setInterval(() => {
                if (!isAlerting) {
                    clearInterval(titleInterval);
                    return;
                }
                document.title = titleCount++ % 2 === 0 ? settings.titleText : settings.titleText2;
            }, 500);
        }
    }

    function stopAlert() {
        if (!isAlerting) return;
        isAlerting = false;

        stopSound();

        if (flashInterval) {
            clearInterval(flashInterval);
            flashInterval = null;
        }
        document.body.style.backgroundColor = '';
        document.title = 'DeepSeek Chat';

        console.log('[Deep Screen] Alarm durduruldu');
    }

    function checkButton() {
        const btn = document.querySelector('div._8e85838 button');

        if (!btn) {
            if (isAlerting) stopAlert();
            return;
        }

        const span = btn.querySelector('span');
        if (!span || span.textContent !== 'Continue') {
            if (isAlerting) stopAlert();
            return;
        }

        if (!isAlerting && settings.enabled) startAlert();
    }

    const observer = new MutationObserver(() => checkButton());
    observer.observe(document.body, { childList: true, subtree: true });

    setInterval(checkButton, 500);
    checkButton();

    setTimeout(createPanel, 1000);

    console.log('[Deep Screen] Script başarıyla yüklendi!');
})();