User:Ozuzanna/chat.js

// Custom inline alerts function inlineAlert(message) { mainRoom.model.chats.add(new models.InlineAlert({text:message})); $('[name="message"]').val('').removeAttr('disabled').focus; }

/* $(function {	var affiliatedWikis = /(12-forever|boomerangchannel|atfanfic|clarence|courage|community|dev|galactickidsnextdoor|gemstona-fan|lakewood-plaza-turbo|newgamesesp|starvstheforcesofevil|stevenuniversetheoryzone|stevenuniverse-fanon|steven-universe|pt-br.stevenuniverso|steven-universe-gemsona|theamazingworldofgumball|uncle-grandpa|wanderoveryonder|webarebears).wikia.com/i,	msg;
 * Stop users linking other wiki pages that aren't images except affiliated wikis, as well as pure whitespace
 * @author Ozuzanna

//Handle message input $('[name="message"]').keypress(function(e) {		if (e.which == 13 && mainRoom.active === true) {			msg = this.value;

//Prevent other wikis and chats being linked in main chat if (msg.match(/Special:Chat/i) || (msg.match(/wikia.com/i) && !msg.match(affiliatedWikis) && !msg.match(/.(png|gif|jpg|jpeg)/i))) { e.preventDefault; inlineAlert('You cannot post other wiki links in the main chat.'); }			//Stop posting of pure whitespace if (!msg.trim) { e.preventDefault; inlineAlert('You cannot post solely whitespace in the main chat.'); }		}	}); });