Reddit Link Name Highlighter

When you are linked direct to a comment, sometimes you want to see all the other comments by that person, this does that and nothing else

当前为 2015-05-10 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Reddit Link Name Highlighter
  3. // @namespace http://robertmeta.com
  4. // @version 0.1
  5. // @description When you are linked direct to a comment, sometimes you want to see all the other comments by that person, this does that and nothing else
  6. // @author Robert Melton
  7. // @match http*://www.reddit.com/r/*/comments/*
  8. // @grant none
  9. // ==/UserScript==
  10. var commentSection = document.getElementsByClassName('sitetable nestedlisting');
  11. var linksInCommentSection = commentSection[0].getElementsByTagName("a");
  12. var originalPersonLink = "";
  13. var color = "lightgreen";
  14. for ( i = 0; i < linksInCommentSection.length; i++ ) {
  15. if (linksInCommentSection[i].href.match("user")) {
  16. if (originalPersonLink === "") { // first person
  17. originalPersonLink = linksInCommentSection[i].href;
  18. }
  19. if (linksInCommentSection[i].href.match(originalPersonLink)) {
  20. linksInCommentSection[i].style.background = color;
  21. }
  22. }
  23. }