User:Ysana/chat.js

Note: After saving, you have to bypass your browser's cache to see the changes.

Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button, or press Ctrl+F5. Firefox: hold down the Shift key while clicking Reload; alternatively press Ctrl+F5 or Ctrl-Shift-R. Opera users have to clear their caches through Tools→Preferences Konqueror and Safari users can just click the Reload button. Chrome: press Ctrl+F5 or Shift+F5 $(window).load(function { console.log('Special:MyPage/chat.js'); window.aliases = {}; function createAlias(alias, on, run) {	window.aliases[alias] = 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;		}	}	$('[name="message"]').keypress(window.aliases[alias]); } /*Script that makes it easy to run functions when receiving messages*/ importScript('MediaWiki:Chat.js/newmessage.js'); /*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 = '';	}); } importScriptPage('User:Joeytje50/chatmsg.js','runescape'); $('head').append('\n\n\n\n'); onchatmessage = function (text, rawtext) { //Scripts to run when you get a new message //Time stamp inline-alert setTimeout(function {		var e = $('#WikiaPage li.inline-alert:last-child:not(:has(span.time))'), n, t, h, m, s;		if (e.length) {			n = new Date;                       h = n.getHours;                        m = n.getMinutes;                        s = n.getSeconds;                        t = (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s);			e.prepend(' [ '+t+' ]  ');		}	}, 20); return text; //DO NOT EDIT THIS LINE }; importScriptPage('User:BryghtShadow/global.js', 'c'); });