User:Dr. Frohman/Chat.js

// ***************** // * APRIL FOOL'S! * // ***************** // Written by Callofduty4, using some code from Megan // Spinning Trollface on Chat // No, this does not work in Internet Explorer. // No, I don't care. var interval = null; var degrees = 0; function spinTroll { $('.WikiaPage').append(''); $('#trollface').css({        "position": "fixed",         "bottom": "150px",         "left": "400px",      }); clearInterval(interval); interval = setInterval(function{      if (degrees != -360) {           degrees -= 1;           $('#trollface').css({ MozTransform: 'rotate(-' + -degrees + 'deg)', WebkitTransform: 'rotate(' + -degrees + 'deg)', transform: 'rotate(' + -degrees + 'deg)' });      }else{           degrees = 360;       }   }, 10); } // END Spinning Trollface // Colour changing stuff function randColourTimer { var timerMessage=setTimeout("randColourMessage", 2000); var timerUsername=setTimeout("randColourUsername", 2000); /*  var timerTextInput=setTimeout("randColourTextInput", 2000); var timerTextInputText=setTimeout("randColourTextInputText", 2000); var timerChatHeader=setTimeout("randColourChatHeader", 2000); var timerRail=setTimeout("randColourRail", 2000); var timerBody=setTimeout("randColourBody", 2000); */ } function randColourMessage { var colourMessage = '#'; var hexadecMessage = '0123456789ABCDEF'.split(''); for (var i = 0; i < 6; i++ ) { colourMessage += hexadecMessage[Math.round(Math.random * 15)]; }  $('.Chat .message').css({      color: colourMessage   }); randColourTimer; } function randColourUsername { var colourUsername = '#'; var hexadecUsername = '0123456789ABCDEF'.split(''); for (var i = 0; i < 6; i++ ) { colourUsername += hexadecUsername[Math.round(Math.random * 15)]; }  $('.Chat .username').css({      color: colourUsername   }); } /* function randColourTextInput { var colourTextInput = '#'; var hexadecTextInput = '0123456789ABCDEF'.split(''); for (var i = 0; i < 6; i++ ) { colourTextInput += hexadecTextInput[Math.round(Math.random * 15)]; }  $('.Write [name="message"]').css({      backgroundColor: colourTextInput   }); } function randColourTextInputText { var colourTextInputText = '#'; var hexadecTextInputText = '0123456789ABCDEF'.split(''); for (var i = 0; i < 6; i++ ) { colourTextInputText += hexadecTextInputText[Math.round(Math.random * 15)]; }  $('.Write [name="message"]').css({      color: colourTextInputText   }); } function randColourChatHeader { var colourChatHeader = '#'; var hexadecChatHeader = '0123456789ABCDEF'.split(''); for (var i = 0; i < 6; i++ ) { colourChatHeader += hexadecChatHeader[Math.round(Math.random * 15)]; }  $('.ChatHeader').css({      backgroundColor: colourChatHeader   }); } function randColourRail { var colourRail = '#'; var hexadecRail = '0123456789ABCDEF'.split(''); for (var i = 0; i < 6; i++ ) { colourRail += hexadecRail[Math.round(Math.random * 15)]; }  $('.Rail').css({      backgroundColor: colourRail   }); } function randColourBody { var colourBody = '#'; var hexadecBody = '0123456789ABCDEF'.split(''); for (var i = 0; i < 6; i++ ) { colourBody += hexadecBody[Math.round(Math.random * 15)]; }  $('body').css({      backgroundColor: colourBody   }); } // END Rainbow text // Loading function load { if ($('#trollface').length > 0) { return }else{ if (wgPageName == "Special:Chat") { spinTroll; }     randColourTimer; } } window.onload=load // END Loading