- Open stylus manager page
- F12
- Paste this script in the console
Or add this snippet. Then Ctrl + Enter
Last active
March 8, 2026 06:03
-
-
Save KevinNitroG/35df1b7168a5b509258c02b1698921ad to your computer and use it in GitHub Desktop.
Delete all stylus styles
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
| // Helper to pause execution | |
| const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
| function getNextOldCatppuccinStyle() { | |
| // Grab ALL entries on the page | |
| const entries = document.querySelectorAll(".entry"); | |
| for (const entry of entries) { | |
| const nameLink = entry.querySelector(".style-name-link"); | |
| const styleInfo = entry.querySelector(".style-info"); | |
| // Skip if required elements are missing | |
| if (!nameLink || !styleInfo) continue; | |
| const name = nameLink.textContent.trim(); | |
| if (!name.includes("Catppuccin")) continue; | |
| const version = styleInfo.textContent.trim(); | |
| const majorVersion = Number(version.split(".")[0]); | |
| if (!isNaN(majorVersion) && majorVersion < 10) { | |
| console.log(`Target acquired: ${name} v${version}`); | |
| return entry; // Return the first valid target we find | |
| } | |
| } | |
| return null; // Nothing left to delete | |
| } | |
| async function deleteStyle(entry) { | |
| const deleteBtn = entry.querySelector("a.delete"); | |
| if (!deleteBtn) { | |
| console.log("No delete button found on target."); | |
| return false; | |
| } | |
| deleteBtn.click(); | |
| // Wait dynamically for the confirm button to exist (up to a reasonable limit) | |
| let confirmBtn = null; | |
| let attempts = 0; | |
| while (!confirmBtn && attempts < 20) { | |
| await sleep(100); | |
| confirmBtn = document.querySelector( | |
| "#message-box-buttons > button:nth-child(1)", | |
| ); | |
| attempts++; | |
| } | |
| if (confirmBtn) { | |
| confirmBtn.click(); | |
| } else { | |
| console.log("Confirmation button never appeared."); | |
| return false; | |
| } | |
| // Wait dynamically for the entry to be removed from the DOM | |
| while (document.body.contains(entry)) { | |
| await sleep(100); | |
| } | |
| return true; | |
| } | |
| async function main() { | |
| console.log("Starting cleanup..."); | |
| while (true) { | |
| const entry = getNextOldCatppuccinStyle(); | |
| if (!entry) { | |
| console.log("No more old Catppuccin styles found."); | |
| break; | |
| } | |
| const success = await deleteStyle(entry); | |
| if (!success) { | |
| console.log( | |
| "Failed to delete an entry. Stopping to prevent infinite loops.", | |
| ); | |
| break; | |
| } | |
| await sleep(200); | |
| } | |
| console.log("Cleanup complete!"); | |
| } | |
| main(); |
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 function deleteStyle() { | |
| const deleteBtn = document.querySelector("p.actions > a.delete"); | |
| if (!deleteBtn) { | |
| console.log("No more delete buttons found."); | |
| return false; | |
| } | |
| deleteBtn.click(); | |
| await new Promise((resolve) => | |
| setTimeout(() => { | |
| const confirmBtn = document.querySelector( | |
| "#message-box-buttons > button:nth-child(1)", | |
| ); | |
| if (confirmBtn) confirmBtn.click(); | |
| resolve(); | |
| }, 300), | |
| ); | |
| return true; | |
| } | |
| async function main() { | |
| let continuing = true; | |
| while (continuing) { | |
| // We MUST 'await' the result here | |
| continuing = await deleteStyle(); | |
| if (continuing) { | |
| await new Promise((resolve) => setTimeout(resolve, 300)); | |
| } | |
| } | |
| console.log("Cleanup complete!"); | |
| } | |
| main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment