Fandom

Wikia Developers Wiki

ChatObject

889pages on
this wiki
Add New Page
Talk1 Share

ChatObject is a script that creates a global object allowing for easier customization of Chat, such as adding action buttons and adjusting colors.

Rationale

Most of the chat customization scripts are spread across Wikia and written by various authors. They may be out-of-date, poorly documented, are polymorphic, and generally aren't aware of each other. This script aims to provide the functionality offered by them in one place, where it can be viewed and edited by many. See #Contributing about how you can help.

Setup

Assuming you already have imported custom Javascript into your chat (if not, check out https://github.com/sactage/wikia-js-snippets/blob/master/README.md steps 1, 2, and 3, authored by Sactage), place the following into MediaWiki:Chat.js:

importScriptPage( 'ChatObject/code.js', 'dev' );

Exploit

Using

The methods of the Chat object are documented extensively in the source code. You can simply call them in MediaWiki:Chat.js like:

// An example color scheme change
Chat.setColorScheme({
chatBackground: 'green',
pageBackground: 'black',
textColor: 'pink'
});

Hacking

You can easily extend the Chat object in MediaWiki:Chat.js with your own methods and properties:

Chat.helloWorld = function () {
console.log( 'Hello World!' );
};
 
Chat.myProperty = 'Hello World!';

Contributing

If you have created a particularly useful addition, please be so kind and post it on the talk page so that it can be implemented into core functionality for the benefit of others. Feel compelled to leave any feature requests and bug reports as well!

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.