Last active
November 20, 2017 09:31
-
-
Save mwek/9962f97f3bde157fd5dbd2b5dd0ec3ca to your computer and use it in GitHub Desktop.
Google Calendar Guests Can Modify Event By Default (port to TamperMonkey)
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
// ==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