Last active
November 16, 2023 12:19
-
-
Save olejorgenb/3b0b0c5dfcfae1fbbf9cfbd5bbfa3112 to your computer and use it in GitHub Desktop.
Toggle meeting room calendar visibility in Google Calendar
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
// bookmarklet_title: Toggle meeting rooms | |
// bookmarklet_about: Toogle meeting room calendar visibility (Google Calendar) | |
function findCalendarCheckboxesOf(labelRegex) { | |
const calendarDiv = document.querySelector("[aria-label='Other calendars']") | |
let matches = [] | |
for (const li of calendarDiv.querySelectorAll("li")) { | |
if (li.innerText.match(labelRegex)) { | |
matches.push(li.querySelector("input[type=checkbox]")) | |
} | |
} | |
return matches | |
} | |
function toggleCalendars(labelRegex) { | |
findCalendarCheckboxesOf(labelRegex).forEach(cb => cb.click()) | |
} | |
toggleCalendars(/^HQ-[0-9]-.*/) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://bookmarkl.ink/olejorgenb/3b0b0c5dfcfae1fbbf9cfbd5bbfa3112