CF show colors

Show colored thread title on codingforums

  1. // ==UserScript==
  2. // @name CF show colors
  3. // @namespace http://websocket.bplaced.net
  4. // @version 1.1
  5. // @description Show colored thread title on codingforums
  6. // @match http://www.codingforums.com/*
  7. // @copyright 2014, Thomas Theiner
  8. // ==/UserScript==
  9.  
  10. window.addEventListener('load', function() {
  11. if(unsafeWindow.jQuery) {
  12. $ = unsafeWindow.jQuery;
  13. $('#threads li.new').each(function() {
  14. var theMatch = $(this).find('.threadstats').text().match(/Replies\:\s(\d+)/);
  15. if(theMatch) {
  16. var replies = parseInt(theMatch[1], 10);
  17. if(replies == 0)
  18. $(this).find('.threadinfo').css({'background-color': '#c1343b'});
  19. }
  20. });
  21. }
  22. }, false);