Color Style - quotes

changes color of the text within quotes

  1. // ==UserScript==
  2. // @name Color Style - quotes
  3. // @namespace An CSS user script
  4. // @match http://127.0.0.1:8000/*
  5. // @match https://beta.character.ai/chat*
  6. // @grant none
  7. // @license MIT
  8. // @version 1.1
  9. // @author chatgpt
  10. // @description changes color of the text within quotes
  11. // @run-at document-end
  12. // ==/UserScript==
  13. function changeColors() {
  14. const pTags = document.getElementsByTagName('p');
  15. let changed = false;
  16. for (let i = 0; i < pTags.length; i++) {
  17. const pTag = pTags[i];
  18. if (pTag.dataset.colorChanged === 'true') {
  19. continue;
  20. }
  21. let text = pTag.innerHTML;
  22. if (text.match(/(["“”«»].*?["“”«»])/)) {
  23. text = text.replace(/(["“”«»].*?["“”«»])/g, '<span style="color: #00FF00">$1</span>');
  24. pTag.innerHTML = text;
  25. pTag.dataset.colorChanged = 'true';
  26. changed = true;
  27. }
  28. }
  29. if (changed) {
  30. console.log('Changed quote colors!');
  31. }
  32. }
  33.  
  34. setTimeout(function() {
  35. changeColors();
  36. setInterval(changeColors, 500); // check every 500 milliseconds
  37. }, 2000); // 2 seconds delay