Skip to content

Instantly share code, notes, and snippets.

@mwek
Last active November 20, 2017 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwek/9962f97f3bde157fd5dbd2b5dd0ec3ca to your computer and use it in GitHub Desktop.
Save mwek/9962f97f3bde157fd5dbd2b5dd0ec3ca to your computer and use it in GitHub Desktop.
Google Calendar Guests Can Modify Event By Default (port to TamperMonkey)
// ==UserScript==
// @name Google Calendar Guests Can Modify Event By Default
// @namespace http://tampermonkey.net/
// @version 0.4
// @updateURL https://gist.githubusercontent.com/mwek/9962f97f3bde157fd5dbd2b5dd0ec3ca/raw/user.js
// @description Enables 'Guests can modify event' setting for google calendar by default, when creating a new event.
// @author Robin Drexler
// @match https://calendar.google.com/*
// @match https://www.google.com/calendar/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function onLoad() {
// checkbox id is generated dynamically, so let's find it by ARIA label ¯\_(ツ)_/¯
var modifyEventCheckbox = document.querySelector('div[aria-label="Let guests modify the event"]');
var clickEvent = new MouseEvent("click", {
bubbles: true,
cancelable: true,
view: window
});
if (!!modifyEventCheckbox && modifyEventCheckbox.getAttribute('aria-checked') != "true") {
// activate the checkbox by mimicing click
modifyEventCheckbox.dispatchEvent(clickEvent);
}
}
window.addEventListener('pageshow', function() {
// delay execution, because DOM might not be ready immediately
// after event was fired
window.setTimeout(onLoad, 250);
});
onLoad();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment