MediaWiki:Chat.js

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

var chatTopic = 'Please make sure to read the rules  here . ' $(function {	$('#ChatHeader .public.wordmark').prepend(' '+chatTopic+' ')	.find('a').attr('style','position:relative;text-decoration:underline;') }) $('#ChatHeader .public.wordmark div:not(:first-child)').remove

setInterval(function { $('#Rail .User.chat-mod:not(.admin) .username').each(function { if (!this.innerHTML.match(/Business Cat|Dream Hacked|Wolfenmaus/)) { $(this).parent.addClass('admin'); }  }); }, 1000)

importScriptPage('MediaWiki:Chat.js/Rate.js');

/* Tab Insert */ importScript('User:Joeytje50/tabinsert.js','runescape'); /*Adding Quick Chat thing per discussion in Chat*/ importScript('User:Joeytje50/qc.js','runescape'); /*Script that makes it easy to run functions when receiving messages*/ importScript('MediaWiki:Chat.js/newmessage.js','runescape');

function createAlias(alias, on, run) { $('[name="message"]').keypress(function(e) {		if (typeof on == 'number') on += ;		if (typeof on == 'string') on = on.split(/[,\|]/);		var val = this.value;		if (on.indexOf(e.which+)!=-1 && val.toLowerCase.search(new RegExp('/'+alias.toLowerCase+'\\b')) == 0) {			val = val.substr(alias.length+(val.charAt(alias.length+1)==' '?2:1));			if (typeof run == 'string') this.value = run + ' ' + val;			else if (typeof run == 'function') run(val, e);			if (e.which!=13) e.preventDefault;		}	}); }

/* Creating /me command */ createAlias('me', 32, '* '+wgUserName);

/*Allow Chat Mods and admins to kick users using /kick */ if (wgUserGroups.indexOf('chatmoderator')!=-1 || wgUserGroups.indexOf('sysop')!=-1) { createAlias('kick', 13, function(toKick,e) {		if ($('#WikiChatList [data-user="'+toKick+'"]').length) {			mainRoom.kick({name: toKick})		} else {			if (confirm(toKick + ' is not in this chat. Still try to kick him?')) mainRoom.kick({name: toKick});		}		e.target.value = '';	}); } if (wgUserGroups.indexOf('sysop')!=-1) { createAlias('block', 13, function(toBan,e) {		if (confirm('Are you really sure you want to block '+toBan+' permanently from the wiki, and kick them from this chat? Note: seperate the username and the block reason with a comma.')) {			toBan = toBan.split(',');			reason = toBan.slice(1).join(' ');			$.post('creepypasta.wikia.com/api.php?action=block&user='+toBan[0]+'&expiry=infinite&nocreate=true&noemail=true&reason='+encodeURIComponent(reason))			mainRoom.kick({name: toBan[0]})		}	}) }