chromium bugs colorize

Colorize bug list based on status

目前为 2018-12-24 提交的版本。查看 最新版本

  1. // ==UserScript==//
  2. // @name chromium bugs colorize
  3. // @description Colorize bug list based on status
  4. // @match https://bugs.chromium.org/p/*/list*
  5. // @version 1.0.2
  6. // @author wOxxOm
  7. // @namespace wOxxOm.scripts
  8. // @license MIT License
  9. // @run-at document-start
  10. // @require https://greasyfork.org/scripts/12228/code/setMutationHandler.js
  11. // ==/UserScript==
  12.  
  13. (document.head || document.documentElement).insertAdjacentHTML('beforeend', `
  14. <style>
  15. .wOxxOm-Starred { font-weight: bold }
  16. .wOxxOm-Archived { color: gray }
  17. .wOxxOm-Assigned { color: #3f71b1 }
  18. .wOxxOm-Available { color: #92479a }
  19. .wOxxOm-Duplicate,
  20. .wOxxOm-Invalid { opacity: 0.3 }
  21. .wOxxOm-ExternalDependency { color: #ababab }
  22. .wOxxOm-Fixed { color: #227700 }
  23. .wOxxOm-Started,
  24. .wOxxOm-FixPending { color: #06908b }
  25. .wOxxOm-Unconfirmed,
  26. .wOxxOm-New { color: black }
  27. .wOxxOm-Untriaged { color: #947911 }
  28. .wOxxOm-Verified, .wOxxOm-Accepted { color: #6a846f }
  29. .wOxxOm-WontFix { color: #d00 }
  30. </style>
  31. `);
  32.  
  33. colorize(document.getElementsByTagName('td'));
  34. setMutationHandler(document, 'td', colorize);
  35.  
  36. function colorize(nodes) {
  37. for (var i = 0, n; (n = nodes[i++]); ) {
  38. var text = n.textContent;
  39. if (!text)
  40. continue;
  41. text = text.trim();
  42. switch (text) {
  43. case 'Accepted':
  44. case 'Archived':
  45. case 'Assigned':
  46. case 'Available':
  47. case 'Duplicate':
  48. case 'ExternalDependency':
  49. case 'FixPending':
  50. case 'Fixed':
  51. case 'Invalid':
  52. case 'New':
  53. case 'Started':
  54. case 'Unconfirmed':
  55. case 'Untriaged':
  56. case 'Verified':
  57. case 'WontFix':
  58. n.parentNode.classList.add('wOxxOm-' + text);
  59. break;
  60. case '★':
  61. n.parentNode.classList.add('wOxxOm-Starred');
  62. break;
  63. }
  64. }
  65. }