0b61f86dd4
Site history is now managed in localStorage for faster access and better cross-tab experience, with file sync for persistence. Added a dropdown for quick site history access in the address bar, updated settings page to display and manage site history from localStorage, and improved history recording logic in both main and renderer processes. Also added debug info and test data utilities for development.
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
// Use require('electron') since webviews have nodeIntegrationInSubFrames: true
|
|
const { ipcRenderer } = require('electron');
|
|
|
|
const clearBtn = document.getElementById('clear-data-btn');
|
|
const statusDiv = document.getElementById('status');
|
|
const statusText = document.getElementById('status-text');
|
|
|
|
function showStatus(message) {
|
|
statusText.textContent = message;
|
|
statusDiv.classList.remove('hidden'); // Ensure the hidden class is removed
|
|
setTimeout(() => {
|
|
statusDiv.classList.add('hidden'); // Add the hidden class back after 2 seconds
|
|
}, 2000);
|
|
}
|
|
|
|
clearBtn.onclick = async () => {
|
|
statusDiv.classList.remove('hidden'); // Show spinner immediately
|
|
statusText.textContent = 'Clearing all browser data...'; // Update text while clearing
|
|
|
|
try {
|
|
// Invoke the main process to clear cookies, local storage, and cache
|
|
const ok = await ipcRenderer.invoke('clear-browser-data');
|
|
showStatus(ok
|
|
? 'All browser data and bookmarks cleared!'
|
|
: 'Failed to clear browser data.');
|
|
} catch (error) {
|
|
console.error('Error clearing browser data:', error);
|
|
showStatus('An error occurred while clearing data.');
|
|
}
|
|
};
|