Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name CC Chat RAINBOW!!
- // @namespace dgz345
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match http*://www.conquerclub.com/chat13/*
- // @grant unsafeWindow
- // 16f0075bdf38db1ce497
- // ==/UserScript==
- function init()
- {
- unsafeWindow.colorText = function(str,phase) {
- if (phase == undefined)
- phase = 0;
- var center = 128;
- var width = 127;
- var frequency = Math.PI*2/str.length;
- var cstr="";
- for (var i = 0; i < str.length; ++i) {
- var red = Math.sin(frequency*i+2+phase) * width + center;
- var green = Math.sin(frequency*i+0+phase) * width + center;
- var blue = Math.sin(frequency*i+4+phase) * width + center;
- cstr+= "[color=" + RGB2Color(red,green,blue) + "]" + str.substr(i,1) + "[/color]";
- }
- ColorMatters();
- return cstr;
- };
- unsafeWindow.ColorMatters = function() {
- };
- unsafeWindow.RGB2Color = function(r,g,b) {
- return '#' + byte2Hex(r) + byte2Hex(g) + byte2Hex(b);
- };
- unsafeWindow.byte2Hex=function(n) {
- var nybHexString = "0123456789ABCDEF";
- return String(nybHexString.substr((n >> 4) & 0x0F,1)) + nybHexString.substr(n & 0x0F,1);
- };
- var p=0;
- console.log(unsafeWindow.pfc);
- unsafeWindow.pfc.doSendMessage=function () {
- var w = this.el_words;
- var wval = w.value; // Append the string to the history.
- this.cmdhistory.push(wval);
- this.cmdhistoryid = this.cmdhistory.length;
- this.cmdhistoryissearching = false; // Send the string to the server.
- re = new RegExp("^(/[a-zA-Z0-9]+)( (.*)|)");
- if (wval.match(re)) { // A user command.
- cmd = wval.replace(re, '$1');
- param = wval.replace(re, '$3');
- this.sendRequest(cmd +' '+ param.substr(0, pfc_max_text_len + 2*this.clientid.length));
- } else { // A classic 'send' command.
- // Empty messages with only spaces.
- rx = new RegExp('^[ ]*$','g');
- wval = wval.replace(rx,''); // Truncate the text length.
- wval = wval.substr(0,pfc_max_text_len); // Colorize the text with current_text_color.
- if (this.current_text_color != '' && wval.length != '') {
- p=p+1;
- wval = colorText(wval,p);
- }
- this.sendRequest('/send '+ wval);
- } w.value = '';
- return false;
- };
- }
- var loadCheck = setInterval(function(){
- console.log("Waiting for pfc");
- if (unsafeWindow.pfc) {
- clearInterval(loadCheck);
- console.log("pfc loaded!");
- init();
- }
- }, 250);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement