Looks for specific key words and changes the background of the cell of a google task to a predefined color
< Feedback on Color Code Individual Google Tasks
// ==UserScript== // @name Color Code Individual Google Tasks // @namespace Tevi // @description Looks for specific key words and changes the background of the cell of a google task to a predefined color // @include https://www.google.com/calendar/* // @include https://calendar.google.com/* // @version 1.1 // @grant none // ==/UserScript== var keyWords = ["FB", "TXT","NL","BT"]; var backgroundColors = ['#DB4437','#9E0000','#D67B5C','#1E8096'];
document.addEventListener('DOMNodeInserted', function() { var checkBox = document.querySelectorAll('span.tc-icon'); for (var J = checkBox.length-1; J >= 0; --J){ var str = checkBox[J].parentNode.textContent.toString(); for (var I = keyWords.length - 1; I>= 0; --I) if(str.toLowerCase().indexOf(keyWords[I].toLowerCase()) >= 0) checkBox[J].parentNode.parentNode.style.background = backgroundColors[I]; } }, false);
Sorry I didn't see the email notification for the comment.
See https://greasyfork.runtimutd.eu.org/en/forum/discussion/59896/x
Google changed their css and broke the script, its a relatively easy fix, although I can't guarantee it will work for all cases.
Not working
I changed the keyword values. However, when I refresh my calendar, there is no change to the tasks. What am I doing wrong?