diff options
author | sameerasw <[email protected]> | 2025-04-11 10:40:28 +0530 |
---|---|---|
committer | sameerasw <[email protected]> | 2025-04-11 10:40:28 +0530 |
commit | e00792dd9f90093d93b527c66af2b6de18f98294 (patch) | |
tree | 7e5d008b47ec5a29722491493617339c14bcd49a | |
parent | c0d8d4a6621f608911b8dec805de078c78f8f440 (diff) |
fixed the delete data button
-rw-r--r-- | data-viewer/data-viewer.js | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/data-viewer/data-viewer.js b/data-viewer/data-viewer.js index 11ec2db..7f21906 100644 --- a/data-viewer/data-viewer.js +++ b/data-viewer/data-viewer.js @@ -23,8 +23,12 @@ document.addEventListener("DOMContentLoaded", function () { }); // Event listener for delete all data button - Fixed implementation - deleteAllButton.addEventListener("click", function() { - if (confirm("WARNING: This will delete ALL extension data including settings, website styles, and preferences. This action cannot be undone!\n\nAre you sure you want to proceed?")) { + deleteAllButton.addEventListener("click", function () { + if ( + confirm( + "WARNING: This will delete ALL extension data including settings, website styles, and preferences. This action cannot be undone!\n\nAre you sure you want to proceed?" + ) + ) { deleteAllData(); } }); @@ -33,10 +37,12 @@ document.addEventListener("DOMContentLoaded", function () { try { // Clear all storage data await browser.storage.local.clear(); - + // Show confirmation message - alert("All data has been deleted successfully. The page will now reload."); - + alert( + "All data has been deleted successfully. The page will now reload." + ); + // Reload the page to show empty state window.location.reload(); } catch (error) { @@ -132,10 +138,18 @@ document.addEventListener("DOMContentLoaded", function () { // Add Clear List button if (skipList.length > 0) { const clearListButton = document.createElement("button"); - clearListButton.classList.add("action-button", "secondary", "clear-list-button"); + clearListButton.classList.add( + "action-button", + "secondary", + "clear-list-button" + ); clearListButton.innerHTML = '<i class="fas fa-trash"></i> Clear List'; - clearListButton.addEventListener("click", function() { - if (confirm(`Are you sure you want to clear the entire ${modeType} list? This will affect how styling is applied to websites.`)) { + clearListButton.addEventListener("click", function () { + if ( + confirm( + `Are you sure you want to clear the entire ${modeType} list? This will affect how styling is applied to websites.` + ) + ) { clearSkipList(); } }); @@ -178,7 +192,9 @@ document.addEventListener("DOMContentLoaded", function () { loadAllData(); // Reload data to reflect changes } catch (error) { console.error("Error clearing skip list:", error); - alert("An error occurred while trying to clear the list: " + error.message); + alert( + "An error occurred while trying to clear the list: " + error.message + ); } } @@ -286,7 +302,7 @@ document.addEventListener("DOMContentLoaded", function () { const domainName = siteName.startsWith("+") ? siteName.slice(1) : siteName; - const settingsData = + const settingsData = siteSettings[domainName] || siteSettings[`www.${domainName}`] || {}; header.innerHTML = ` |