// popup.js
const STORAGE_ENDPOINT = '/_extension_storage';
document.getElementById('clearTrace').addEventListener('click', function() {
    fetch(`${STORAGE_ENDPOINT}?clogs=true`)
        .catch(() => {});
    document.getElementById('cleared').textContent = 'Cleared: trace';
});

document.getElementById('clearPoints').addEventListener('click', function() {
    fetch(`${STORAGE_ENDPOINT}?cpts=true`)
            .catch(() => {});
    document.getElementById('cleared').textContent = 'Cleared: points';
});

// Handle the checkbox for enabling/disabling the font
document.getElementById('toggleFont').addEventListener('change', function() {
    const isChecked = this.checked;
    // Set the font state in the extension's storage
    chrome.storage.local.set({ fontDisabled: !isChecked });
});

// Check the current font state when the popup is opened
chrome.storage.local.get(['fontDisabled'], function(result) {
    document.getElementById('toggleFont').checked = !result.fontDisabled; // Set checkbox based on stored value
});