Notion.so Colored Checklist with No Strikethrough

This script prevents Notion from adding a strikethrough style to checked items in a todo list, while retaining any custom text colors.

  1. // ==UserScript==
  2. // @name Notion.so Colored Checklist with No Strikethrough
  3. // @description This script prevents Notion from adding a strikethrough style to checked items in a todo list, while retaining any custom text colors.
  4. // @namespace Tampermonkey Scripts
  5. // @match https://www.notion.so/*
  6. // @grant none
  7. // @version 1.0.0
  8. // @license MIT
  9. // ==/UserScript==
  10. //
  11.  
  12. function restyleCheckedTodos(elements){
  13. elements.forEach((e) => {
  14. if(e.style.textDecoration.includes('line-through')){
  15. e.style.textDecoration = 'none';
  16. }
  17. });
  18. }
  19.  
  20. let config = {
  21. attributes: true,
  22. attributeFilter: ["style"],
  23. childList: true,
  24. subtree: true
  25. };
  26.  
  27. let observer = new MutationObserver((mutationsList, observer) => {
  28. // Any elements recently added or edited.
  29. restyleCheckedTodos(mutationsList.map((m) => m.target));
  30. // Anything that was missed by the above.
  31. restyleCheckedTodos(document.querySelectorAll("[contenteditable]"));
  32. });
  33.  
  34. observer.observe(document, config);