Skip to content

Instantly share code, notes, and snippets.

@wernersa
Last active June 1, 2023 01:11
Show Gist options
  • Save wernersa/f3bd3edd69dccb6a3a5386526a81a309 to your computer and use it in GitHub Desktop.
Save wernersa/f3bd3edd69dccb6a3a5386526a81a309 to your computer and use it in GitHub Desktop.
Userscript for hiding information from google calendar
// ==UserScript==
// @name Confidential google calendar
// @namespace https://gist.githubusercontent.com/wernersa/f3bd3edd69dccb6a3a5386526a81a309/raw/confidentialcalendar.user.js
// @version 0.24
// @description Remove any identifying information from being shown on google calendar
// @author Werner Sævland
// @match https://calendar.google.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @run-at document-idle
// @grant none
// @license unrestricted
// ==/UserScript==
(function() {
'use strict';
var but = document.createElement("button");
var sp = document.createElement("span");
but.appendChild(sp);
var t = document.createTextNode("Hide");
but.appendChild(t);
but.style.cursor = "pointer";
but.onclick = function() {
t.textContent = (t.textContent == "Hide") ? "Show" : "Hide"
var elementsToRemove = ["FAxxKc", // Event names
"eADW5d", // All day events
"m6vl0d", // Commas for compact events
"JClzi" , // Location names
"Jmftzc K9QN7e EiZ8Dd", // Location names
"dOqRGf", // Tasks
];
Array.from(elementsToRemove).forEach(function(toRemove) {
var x = document.getElementsByClassName(toRemove);
if (x.length !== 0) {
Array.from(x).forEach(function(item) {
item.style.display = (item.style.display == "none") ? "block" : "none"
});
}
});
};
var parentElement = document.getElementsByClassName("gb_0e")[0];
parentElement.insertBefore(but, parentElement.childNodes[1]);
})();
@wernersa
Copy link
Author

Illustration of the calendar after button click:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment