MediaWiki:Chat.js

/*Courtesy of the Runescape Wiki*/ //Chat's topic. Remember to escape single quotes in the topic using \' to prevent this from breaking. var chatTopic = 'USERS: Please be respectful when chatting.' $(function { $('#ChatHeader .public.wordmark').prepend(''+chatTopic+' ') .find('a').attr('style','position:relative;text-decoration:underline;') }) $('#ChatHeader .public.wordmark div:not(:first-child)').remove /* Creating /me command */ document.getElementsByName('message')[0].onkeypress = function(e) { if (e.which == 32) { if (this.value == '/me') { this.value = '* '+wgUserName; } } } /*Tab Insert*/ importScriptPage('User:Joeytje50/tabinsert.js','runescape')

/*Mark admins*/ setInterval(function {	$('#Rail .User.chat-mod:not(.admin) .username').each(function { if (!this.innerHTML.match(/LeonSkunk|Chibitracy|Ailourophile|Miggy7215/)) { $(this).parent.addClass('admin'); }	}); }, 1000)

//Clear chat button Special thanks to Utter solitude function addClearChatText{ if ($('.clearChatText').length <= 0) { var clearChatText = document.createElement('span'); $('Clear chat ').prependTo('.Rail'); } } function clearChat{ chatSize = $('div.Chat:first ul li').size-1; $('.Chat:first li:lt('+chatSize+')').remove; } window.onload=addClearChatText; //END Clear chat button

// ********** // Chat topic // ********** // Remember to escape single quotes in the topic using \' to prevent this from breaking. // Credit to Runescape Wiki // *************** // Spam protection // *************** // Credit to Joeytje50, script modified slightly for more leniency/easier changing // Change these variables to modify the leniency of the script var maxLimit = 6; // limit for sent lines var maxLength = 1250; // limit for how long a line can be (in chars) var limitTimeout = 2000; // timeout for the sent lines limiter 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/Project:Chat/Ratelimit_triggered"; 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); // ******************* // END Spam protection // ******************* // ************ // Chat options import // ************ var chatOptionsLoaded = false; if (!chatOptionsLoaded){ chatOptionsLoaded = true; importScriptPage('MediaWiki:Chat.js/options.js','cod'); } // **************** // END Chat options import // ****************

background: #bdebfc; /* Old browsers */ background: -moz-radial-gradient(center, ellipse cover, #bdebfc 49%, #e5dda0 61%); /* FF3.6+ */ background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(49%,#bdebfc), color-stop(61%,#e5dda0)); /* Chrome,Safari4+ */ background: -webkit-radial-gradient(center, ellipse cover, #bdebfc 49%,#e5dda0 61%); /* Chrome10+,Safari5.1+ */ background: -o-radial-gradient(center, ellipse cover, #bdebfc 49%,#e5dda0 61%); /* Opera 12+ */ background: -ms-radial-gradient(center, ellipse cover, #bdebfc 49%,#e5dda0 61%); /* IE10+ */ background: radial-gradient(ellipse at center, #bdebfc 49%,#e5dda0 61%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bdebfc', endColorstr='#e5dda0',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */