document.addEventListener('DOMContentLoaded', function () {
    // Load saved setting
    chrome.storage.sync.get(['kayitEdilsin'], function (result) {
        if (result.kayitEdilsin !== undefined) {
            document.getElementById('chkKayitEdilsin').checked = result.kayitEdilsin;
        }
    });

    // Listen for checkbox changes
    document.getElementById('chkKayitEdilsin').addEventListener('change', function () {
        const isChecked = this.checked;
        
        // Save setting
        chrome.storage.sync.set({ kayitEdilsin: isChecked });
        
        // Send message to active tab
        chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
            if (tabs[0]) {
                chrome.tabs.sendMessage(tabs[0].id, {
                    action: 'setKayitDurumu',
                    kayitEdilsin: isChecked
                });
            }
        });
    });

    // Your existing button event handlers
    document.getElementById('btnStart').addEventListener('click', function () {
        // Start functionality
    });
    
    document.getElementById('btnStop').addEventListener('click', function () {
        // Stop functionality
    });
}); 