Kongregate statuscolor

Shows a color to display the status of a poster instead of a symbol.

  1. // ==UserScript==
  2. // @name Kongregate statuscolor
  3. // @description Shows a color to display the status of a poster instead of a symbol.
  4. // @include http://www.kongregate.com/forums/*/topics/*
  5. // @version 0.0.1.20160306133352
  6. // @namespace https://greatest.deepsurf.us/users/32649
  7. // ==/UserScript==
  8.  
  9. var posts = document.getElementsByClassName("post hentry");
  10. var cimg, i, span, op, link, ptitle, len = posts.length;
  11. function getPostSpan(ind) {
  12. return posts[ind].getElementsByTagName("td")[0].getElementsByClassName("fn")[0];
  13. }
  14. function getPostLink() {
  15. return span.getElementsByTagName("a")[0];
  16. }
  17.  
  18. for(i=0;i<len;i++) {
  19. span = getPostSpan(i);
  20. link = getPostLink();
  21. op = link.className.indexOf("post_creator") != -1;
  22. ptitle = (link.className.match(/[a-zA-Z_]+_icon/) || "null").toString().toLowerCase();
  23. switch(ptitle) {
  24. case "null":
  25. break;
  26. case "developer_icon":
  27. link.style.color = op ? "#9999FF" : "#0000FF";
  28. break;
  29. case "admin_icon":
  30. link.style.color = op ? "#FF9999" : "#FF0000";
  31. break;
  32. case "forummod_icon":
  33. link.style.color = op ? "#DDAA77" : "#CC6600";
  34. break;
  35. default:
  36. link.style.color = op ? "#FFCC99" : "#FF9900";
  37. break;
  38. }
  39. if(ptitle == "null") continue;
  40. link.className = null;
  41. link.title = ptitle.charAt(0).toUpperCase()+ptitle.split("_")[0].slice(1)+(op?" (OP)":"");
  42. }