Skip to content

Instantly share code, notes, and snippets.

@igrek8
Created July 1, 2021 11:07
Show Gist options
  • Save igrek8/3ab18de359d58754d5214b22e8fe713a to your computer and use it in GitHub Desktop.
Save igrek8/3ab18de359d58754d5214b22e8fe713a to your computer and use it in GitHub Desktop.
Hide all Google calendars
(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