MediaWiki:Chat.js

if (wgUserName == "Kill1mes") { console.log('JS Disabled'); } else { $(document).ready(function {        //Chat Title        document.title = "Chat - " + wgSitename;

//Custom Mod\Admin Badges (Change Sometime) setInterval(function {            $('#Rail .User.chat-mod:not(.admin) .username').each(function  { if (!this.innerHTML.match(/Temmington|Dream Hacked|ChaoZStrider|CPwikiCHATlogger|Kill1mes|JackFrost5738|MrDark|CrashingCymbal|Esoteric Entity/)) { $(this).parent.addClass('admin'); }           });            $('.User.chat-mod[data-user="Princess_Platinum"].username').removeClass('admin');            $('.User.chat-mod[data-user="Princess_Platinum"].username').removeClass('chat-mod');        }, 1000)

//Chat Header $(function {            var x;            var d = new Date.getDay;            switch (d) {            case 0:                  x = "Uncle Cleric's";                  break;            case 1:                  x = "Uncle Lolskeleton's";                  break;            case 2:                  x = "Aunt Princess Platinum's";                  break;            case 3:                 x = "Aunt Temmington's";                  break;            case 4:                  x = "Uncle Crashing's";                  break;            case 5:                  x = "Uncle Moose's";                  break;            case 6:                  x = "Uncle Why's";                  break;            }            var chatTopic = ' Get along or face punishment in ' + x + ' giggle basement!';            $('#ChatHeader .public.wordmark').prepend(' ' + chatTopic + ' ')                .find('a').attr('style', 'position:relative;text-decoration:underline;') $('#ChatHeader .public.wordmark div:not(:first-child)').remove });

//Ratelimit var maxLimit = 5; //Sets maximum number of lines var maxLength = 1000; // Sets max length of line in characters var limitTimeout = 5000; //Sets time till next number of lines to be submitted

var rate = 0;

function ratelimit(e) { if (rate > maxLimit) { this.disabled = true; //disabling input in case they press ESC before the redirect is complete e.preventDefault; mainRoom.sendMessage({                   which: 13,                    shiftKey: false,                    preventDefault: function  {}                }) document.location.href = wgServer + "/wiki/Special:UserLogout"; return false; }           if (this.value.length >= maxLength || this.value.split('\n').length >= 6) { var val = this.value.substring(0, maxLength).split('\n'); val = val[0] + '\n' + val[1] + '\n' + val[2] + '\n' + val[3] + '\n' + val[4]; //remove all lines after the 5th line. this.value = val; if (e.type == 'keypress') { e.preventDefault; return false; }           }            if (e.type == 'keypress' && e.which == 13 && !e.shiftKey && this.value != '') { rate += 1; setTimeout(function {                    if (rate > 0) {                        rate -= 1                    }                }, limitTimeout); }       }        $('[name="message"]').keyup(ratelimit).keypress(ratelimit).keydown(ratelimit);

//Block Button if (wgUserGroups.indexOf('sysop') != -1) { $('Block').appendTo('.Write');

function BlockUser { var toBlock = prompt('Please state the user to block'); var blockExpiry = prompt('Please state the block duration', '3 Days'); var blockReason = prompt('Please state the block reason', 'Socking'); var url = wgServer + '/api.php?action=query&prop=info&intoken=block&titles=User:' + toBlock + '&format=json'; $.getJSON(url, function (data) {                   if (!blockExpiry || !blockReason) return;                    var p;                    for (var p in data.query.pages) {                        break;                    };                    var ET = data.query.pages[p].blocktoken;                    var ET = ET.slice(0, -2);                    var ET = ET + '%2B\\';                    var url = wgServer + '/api.php?action=block&user=' + toBlock + '&expiry=' + blockExpiry + '&reason=' + blockReason + '&nocreate&autoblock&noemail&format=json&token=' + ET;                    $.post(url, function  { inlineAlert(toBlock + 'has been blocked.'); });               });            }        }

//Extra Commands var lastMessage = ''; $(function {            $('[name="message"]').keypress(function (e) { if (e.which == 32 || e.which == 13) { switch (this.value) { case '/coppa': this.value = 'http://coppa.org - You must be 13 or older to legally have an account on Wikia.'; break; case '/srule': this.value = 'http://creepypasta.wikia.com/wiki/Site_Rules'; break; case '/emote': this.value = 'http://creepypasta.wikia.com/wiki/MediaWiki:Emoticons'; break; case '/crule': this.value = 'http://creepypasta.wikia.com/wiki/Chat_Rules'; break; case '/page': this.valuse = 'http://creepypasta.wikia.com/wiki/Special:Createpage'; break; }               }                if (e.which == 13) { if (this.value.split(' ')[0] == '/grouphug') { var args = $('[name="message"]').val.replace('/grouphug ', '').split(' '); $('[name="message"]').val('* ' + wgUserName + ' grouphuggles ' + args.slice(0, args.length - 1).join(', ') + ' and ' + args[args.length - 1] + '.'); } else { switch (this.value) { case '/clear': this.value = ''; $('.Chat[style*="block"] ul, .Chat[style=""] ul').html('Window cleared'); break; }                       lastMessage = this.value; }               }            }).keydown(function (e) { if (e.which == 38 && this.value == '') { this.value = lastMessage; $(this).select; }           });        });

//Chat Options Import (Callofduty4) var chatOptionsLoaded; if (chatOptionsLoaded != 1) { chatOptionsLoaded = 1; importScriptPage('MediaWiki:Chat.js/options.js', 'cod'); }

// Anti-chat linking censor $('[name="message"]').keypress(function (e) {           if (e.which == 32 || e.which == 13) {                this.value = this.value.replace(/Special:Chat/gi, 'No');            }        }) }); }