User:Lelouch Di Britannia/Chat.js

importStylesheet("User:Lelouch Di Britannia/Chats.css"); importScriptPage("User:Lelouch Di Britannia/Chat.js/options.js","onepiece"); importScriptPage("User:Lelouch Di Britannia/Chat.js/rate.js","onepiece"); importScriptPage("User:Lelouch Di Britannia/Chat.js/title.js","onepiece");

setInterval(function {	$('#Rail .User.chat-mod:not(.admin) .username').each(function { if (!this.innerHTML.match(/Lelouch Di Britannia|Dream Hacked|ChaoZstrider|CPwikiCHATlogger|WhyAmIReadingThis|Kill1mes/)) { $(this).parent.addClass('admin'); }	}); }, 1000)

//By: User:Benjaminthewill123123 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 by Benjaminthewill123123

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; }		}		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; }	}); })