Advertisement
Guest User

TvH chat rainbow 1

a guest
Sep 1st, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @match http://hakugyokuro.go-board.com/*
  3. // ==/UserScript==
  4.  
  5. function getRandomColor() {
  6.     var letters = '0123456789ABCDEF'.split('');
  7.     var color = '#';
  8.     for (var i = 0; i < 6; i++ ) {
  9.         color += letters[Math.floor(Math.random() * 16)];
  10.     }
  11.     return color;
  12. }
  13. function changeColors() {
  14.         chatFrame = document.getElementById("frame_chatbox");
  15.         var anchors;
  16.         if(chatFrame == null)
  17.             anchors = document.getElementsByTagName("a");
  18.         else
  19.             anchors = chatFrame.contentDocument.getElementsByTagName("a");
  20.         var color = getRandomColor();
  21.         for(i = 0; i < anchors.length; i++) {
  22.           ref = anchors[i].getAttribute("href");
  23.           if(ref == null)
  24.                 ref = anchors[i].getAttribute("HREF");
  25.           if(ref != null) {
  26.                 user = (ref.search("/u") >= 0);
  27.                 if(user) {
  28.                   span = anchors[i].getElementsByTagName("span")[0];
  29.                   if(span != null)
  30.                     span.style.color = getRandomColor();
  31.                 }
  32.           }
  33.         }
  34. }
  35. setInterval(function() {changeColors();}, 500);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement