Skip to content

Instantly share code, notes, and snippets.

@adelton
Last active February 27, 2018 09:04
Show Gist options
  • Save adelton/9b12ffa14c4e920b63351d0e3fe1a958 to your computer and use it in GitHub Desktop.
Save adelton/9b12ffa14c4e920b63351d0e3fe1a958 to your computer and use it in GitHub Desktop.
Google Calendar color tasks, not dots
// ==UserScript==
// @name Google Calendar color tasks, not dots
// @namespace adelton
// @description New 2018 Google Calendar, color the tasks instead of the colored dots
// @include https://www.google.com/calendar/*
// @include https://calendar.google.com/*
// @version 1.1
// @grant none
// ==/UserScript==
document.addEventListener('DOMNodeInserted', function() {
var i;
var cal_items = document.querySelectorAll('span.yzifAd');
for (i of cal_items) {
if (i.parentNode.parentNode.firstChild.style.display !== "none") {
if (i.parentNode.parentNode.firstChild.className == "QNFxAc") {
i.style.color = i.parentNode.parentNode.firstChild.firstChild.style.borderColor;
i.parentNode.parentNode.firstChild.style.display = "none";
}
}
}
var agenda_dot_items = document.querySelectorAll('div.Oxm52e');
for (i of agenda_dot_items) {
if (i.parentNode.parentNode.style.display !== "none") {
if (i.parentNode.parentNode.previousSibling.classList.contains("EmMre")) {
i.parentNode.parentNode.previousSibling.style.color = i.style.borderColor;
i.parentNode.parentNode.style.display = "none";
}
}
}
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment