Color Code Individual Google Tasks

Looks for specific key words and changes the background of the cell of a google task to a predefined color

  1. // ==UserScript==
  2. // @name Color Code Individual Google Tasks
  3. // @namespace Tevi
  4. // @description Looks for specific key words and changes the background of the cell of a google task to a predefined color
  5. // @include https://www.google.com/calendar/*
  6. // @include https://calendar.google.com/*
  7. // @version 1.1
  8. // @grant none
  9. // ==/UserScript==
  10. var keyWords = ["workout", "exam","research","homework"];
  11. var backgroundColors = ['#D6BD2D','#9E0000','#D67B5C','#1E8096'];
  12.  
  13. document.addEventListener('DOMNodeInserted', function() {
  14. var checkBox = document.querySelectorAll('span.tc-icon');
  15. for (var J = checkBox.length-1; J >= 0; --J){
  16. var str = checkBox[J].parentNode.textContent.toString();
  17. for (var I = keyWords.length - 1; I>= 0; --I)
  18. if(str.toLowerCase().indexOf(keyWords[I].toLowerCase()) >= 0)
  19. checkBox[J].parentNode.parentNode.style.background = backgroundColors[I];
  20. }
  21. }, false);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址