Trello Category

try to take over the world!

  1. // ==UserScript==
  2. // @name Trello Category
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://trello.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. function render(){
  12. var color_match =
  13. {
  14. Everyone: '#e67e22',
  15. Product: '#95a5a6',
  16. Marketing: '#2980b9',
  17. Hardware: '#1abc9c',
  18. CXO: '#e74c3c',
  19. Operation: '#95a5a6',
  20. Software: '#f1c40f'
  21. };
  22.  
  23.  
  24. $('span.board-tile-details-name').each(function(){
  25. var title = $(this).text();
  26. var re = /\[ (.+) \] (.+)/;
  27. var match = title.match(re);
  28. if(match){
  29. $(this).text(match[2]);
  30. $('<br/><span class="board-category">'+match[1]+'</span>').insertAfter($(this));
  31. var tile = $(this).parent().parent();
  32. tile.css({'border-left': '20px solid '+color_match[match[1]]});
  33. }
  34. });
  35. }
  36. $(window).load(function(){
  37. render();
  38. $('body').append(`<style>
  39. body{
  40. background: #FEFEFE;
  41. }
  42.  
  43. #header {
  44. background: #333;
  45. }
  46.  
  47. .board-tile-details-name {
  48. text-shadow: 0 0 10px rgba(0,0,0,0.8);
  49. }
  50.  
  51. .board-tile-fade {
  52. background-color: rgba(0,0,0,.4);
  53. }
  54.  
  55. span.board-category{
  56. background: rgba(0,0,0,0);
  57. color: white;
  58. position: relative;
  59. text-shadow: 0 0 7px black;
  60. display: inline-block;
  61. line-height: 1em;
  62. font-size: 8px;
  63. margin-right: 5px;
  64. vertical-align: top;
  65. opacity: 0.7;
  66. }
  67.  
  68. .board-tile-details-sub-name{
  69. display: none;
  70. }
  71.  
  72. .board-tile-fade{
  73. border-top-left-radius: 0;
  74. border-bottom-left-radius: 0;
  75. }
  76. </style>`);
  77. });
  78.  
  79. setInterval(render, 1000);