MediaWiki:Chat.js

importArticles({   type: 'script',    articles: [        'u:dev:Tabinsert.js', // Tab Insert        'u:dev:AjaxEmoticons/code.js', // AjaxEmoticons (so users don't have to refresh the chat to see the latest emoticons)        'u:dev:ChatAnnouncements/code.js',        'u:dev:ChatOptions/code.js',        'u:dev:ChatTags/code.js',        'u:dev:PrivateMessageAlert/code.js',        'u:dev:!kick/code.js',        'u:dev:!mods/code.js'    ] });

/* Add Buttons */ $(window).load(function addButtons {   if ($('#chatOptionsButton').length === 0) {        setTimeout(addButtons, 250);    } else if ($('.chat-button').length === 0) {        $('#chatOptionsButton').after(dayNightButton, clearChatText);        importScriptPage('MediaWiki:Emoticons/code.js', 'kocka');        setTimeout(function { $('.kockaEmoticonsSpan').wrap(' '); }, 2500);   } });

/* Clear chat */ function clearChatText { var $clearDiv = $(' ').addClass('chat-button'); var $clearLink = $('').addClass('wikia-button').text('Clear chat'); $clearDiv.html($clearLink); $clearLink.click(function {       $('.Chat li').remove;    }); return $clearDiv; }

/* Day/Night Switch Feature */ function dayNightButton { var dayText = 'Day theme'; var nightText = 'Night theme'; var $dayNightButton = $(' ').addClass('chat-button'); var $dayNightLink = $('').addClass('wikia-button').text(dayText); var $body = $('body'); $dayNightButton.html($dayNightLink); $dayNightLink.click(function {       $body.toggleClass('day');        $body.toggleClass('night');        $(this).text(function(index, text) { return text === dayText ? nightText : dayText; });   });    $body.addClass('night'); return $dayNightButton; } // Chat's topic. Remember to escape single quotes in the topic using \' to prevent this from breaking. var chatTopic = 'Welcome to the Steven Universe Wiki chat. Please read the rules before chatting.'; $(function {    $('#ChatHeader .public.wordmark').prepend('' + chatTopic + ' ') .find('a').attr('style','position:relative;text-decoration:none;'); }); $('#ChatHeader .public.wordmark div:not(:first-child)').remove;

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

// KockaEmoticons help text change window.kockaEmoticons = { help: 'Choose an emoticon by clicking on it. Full list.' }; // Function for message input $('[name="message"]').keypress(function(e) {   if (e.which == 13) {

var message = this.value;

// Stop posting of whitespace if (!message.trim) { e.preventDefault; $('[name="message"]').val('').removeAttr('disabled').focus; }       // Prevent other wiki chats being linked in main chat if (/[\/[]Special:Chat/i.test(message) && mainRoom.active === true) { e.preventDefault; inlineAlert('You cannot post other wiki chats in the main chat.'); }       // Prevent several websites being linked in main chat if (/60484617|kat\.cr|theworldofstevenuniverse\.blogspot\.com|kisscartoon\.me|watchonlinecartoons\.net|madridista-4-life\.tumblr\.com/i.test(message) && mainRoom.active === true) { e.preventDefault; inlineAlert('You cannot post this link in the main chat because it might violate our policies.'); }   } });