Created
July 1, 2021 11:07
-
-
Save igrek8/3ab18de359d58754d5214b22e8fe713a to your computer and use it in GitHub Desktop.
Hide all Google calendars
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 () => { | |
async function sleep(ms) { | |
return new Promise((resolve) => setTimeout(resolve, ms)); | |
} | |
let el = document.querySelector('[aria-label="My calendars"]').children[0]; | |
while (el) { | |
const label = el.querySelector("label"); | |
const checkbox = el.querySelector("[role=checkbox]"); | |
const value = checkbox.attributes["aria-checked"].value === "true"; | |
if (value) label.click(); | |
el.scrollIntoView(); | |
await sleep(100); | |
el = el.nextSibling; | |
} | |
console.log("done"); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment