Created
February 3, 2026 23:42
-
-
Save mdeguzis/a3796579224a4b01323df03230649631 to your computer and use it in GitHub Desktop.
google-calendar-delete-all-firefox-script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (async () => { | |
| // 1. Ask the user for the keyword | |
| const SEARCH_TERM = prompt("Enter the exact keyword of the events you want to delete:", "Meeting"); | |
| if (!SEARCH_TERM) { | |
| console.log("Deletion cancelled: No keyword provided."); | |
| return; | |
| } | |
| const confirmAction = confirm(`Are you sure you want to delete all visible events containing: "${SEARCH_TERM}"?`); | |
| if (!confirmAction) return; | |
| const DELETE_DELAY = 1000; | |
| const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms)); | |
| async function bulkDelete() { | |
| // Finding elements that act as event containers | |
| let events = Array.from(document.querySelectorAll('[role="button"], [role="gridcell"]')) | |
| .filter(el => el.innerText && el.innerText.includes(SEARCH_TERM)); | |
| if (events.length === 0) { | |
| alert("No events found matching that term on the current screen."); | |
| return; | |
| } | |
| console.log(`%c Found ${events.length} events. Starting...`, 'color: yellow; font-weight: bold;'); | |
| for (let event of events) { | |
| try { | |
| event.click(); | |
| await sleep(600); | |
| // Target the trash icon/delete button | |
| let deleteBtn = document.querySelector('[aria-label*="Delete"]'); | |
| if (deleteBtn) { | |
| deleteBtn.click(); | |
| console.log(`Deleted: ${SEARCH_TERM}`); | |
| await sleep(DELETE_DELAY); | |
| } | |
| } catch (err) { | |
| console.error("Skipped an item due to error:", err); | |
| } | |
| } | |
| alert("Batch deletion finished!"); | |
| } | |
| await bulkDelete(); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment