Advertisement
Guest User

TvH chat seizure 3

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