Wikia

Community Central

Help:JavaScript and CSS Cheatsheet

Talk13
91,212pages on
this wiki

This cheatsheet lists all the JavaScript and CSS files you can modify to enhance your favorite wikia and your general Wikia experience. The links to scripts and stylesheets below point to the wikia you're viewing this help page on.

Please be aware that edits to these files may not take effect instantly - you may need to wait a couple of minutes and clear your browser cache.

Stylesheets Edit

The most common choice is highlighted:

Stylesheet Located at Affected wikias Affected users Affected skins
MediaWiki:Wikia.css/Special:CSS
(Read more about Special:CSS here)
this wikia this wikia all users Wikia (default)
MediaWiki:Monobook.css this wikia this wikia all users Monobook
Special:MyPage/wikia.css this wikia this wikia you only Wikia (default)
Special:MyPage/monobook.css this wikia this wikia you only Monobook
Special:MyPage/common.css this wikia this wikia you only all
w:Special:MyPage/global.css community[1] all wikias you only all

Common.cssEdit

There is also MediaWiki:Common.css.

On older wikis
MediaWiki:Common.css is automatically used for Monobook but not the main Wikia skin. So, if you want to use MediaWiki:Common.css to create rules for both the Wikia and Monobook skins, you have to load it into MediaWiki:Wikia.css with an @import rule. See Help:Including additional JavaScript and CSS for further information. If you use this, make sure to clean up any old CSS in MediaWiki:Common.css before importing it, otherwise it may cause unexpected effects.
On newly created wikis
MediaWiki:Common.css is loaded for both Monobook and the main Wikia skin. The contents will automatically be added to the top of both MediaWiki:Wikia.css and MediaWiki:Monobook.css in a single file. This doesn't matter for most wikis, but if you use @import rules (like for importing custom fonts), they should be added to the top of MediaWiki:Common.css.

JavaScript Edit

The most common choices are highlighted:

Script file Located at Affected wikias Affected users Affected skins
MediaWiki:Common.js this wikia this wikia all users all
MediaWiki:Wikia.js this wikia this wikia all users Wikia (default)
MediaWiki:Monobook.js this wikia this wikia all users Monobook
Special:MyPage/wikia.js this wikia this wikia you only Wikia (default)
Special:MyPage/monobook.js this wikia this wikia you only Monobook
Special:MyPage/common.js this wikia this wikia you only all
w:Special:MyPage/global.js community[1] all wikias you only all
Bulb Duplicating JavaScript

Many scripts can have problems if they run multiple times on the same page. Make sure you only put each particular piece of code in only one of these files. Do not paste the same code in multiple files as it will likely conflict and cause confusing errors for you or other visitors.

Caching issuesEdit

Every file you download from the Internet gets cached. Normally that's great because it reduces traffic both for your own device and for Wikia's servers, but it becomes a problem when it comes to testing design changes. It may take a several hours before your changes take effect - unless you use the following tricks:

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
Gtk-ok Refresh twice!

Once for the JS/CSS page itself and once for your test page.

More often than not, that will be enough, but sometimes - especially when you test your edits with a different browser - you will need to purge Wikia's caches as well. Go to the URL bar of your browser and append ?action=purge to the URL like so:

http://example.wikia.com/wiki/MediaWiki:Cheatsheet

needs to be rewritten to:

http://example.wikia.com/wiki/MediaWiki:Cheatsheet?action=purge
Bulb Purge from the Edit menu

There's a nifty script at the Developer Wiki that adds a PurgeButton to your pages. That spares you the URL hacking.

Bulb Test with Firebug

Firebug users can easily find out whether a script has loaded by typing one of the script's variable or function names into the Firebug console. If it says "undefined", then you're not looking at the latest version of the page yet.

If nothing else seems to help, it might help to have a little patience. After a few hours each and every cache between you and Wikia will have updated.

See alsoEdit

Further help & feedbackEdit

NotesEdit

  1. 1.0 1.1 This file is located at Community Central. That is the only wiki where it will become magic and affect all other wikis. Creating a file with the same name at any other wikia will have no effect.

Around Wikia's network

Random Wiki