extension console logs only in debug mode

This commit is contained in:
MDeeApp
2025-10-05 20:40:59 +02:00
parent 19ea180390
commit be7b65b799
3 changed files with 99 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
const profileSelect = document.getElementById('profileSelect');
const statusEl = document.getElementById('status');
const debugToggle = document.getElementById('debugLoggingToggle');
function apiFetch(url, options = {}) {
const config = {
@@ -76,6 +77,19 @@ async function initProfileSelect() {
initProfileSelect();
chrome.storage.sync.get(['debugLoggingEnabled'], (result) => {
const enabled = Boolean(result && result.debugLoggingEnabled);
debugToggle.checked = enabled;
});
debugToggle.addEventListener('change', () => {
const enabled = debugToggle.checked;
chrome.storage.sync.set({ debugLoggingEnabled: enabled }, () => {
updateStatus(`Debug-Logging ${enabled ? 'aktiviert' : 'deaktiviert'}`, true);
reloadFacebookTabs();
});
});
function reloadFacebookTabs() {
chrome.tabs.query({ url: ['https://www.facebook.com/*', 'https://facebook.com/*'] }, (tabs) => {
tabs.forEach(tab => {