Wikia

Tron Wiki

Help:JavaScript and CSS Cheatsheet

Create Talk0
Gtk-ok This page has different links on different wikis

This page is part of the Shared Help which is available on (almost) every wiki. The links to scripts and stylesheets below point to the wiki you're viewing this page in.

This cheatsheet lists all the JavaScript and CSS files you can modify to enhance your favorite wiki and/or your general Wikia experience. Be aware that edits to these files do not take effect instantly, you may need to wait a couple of minutes and clear your browser cache.

Stylesheets

The most common choice is highlighted:

Stylesheet Located at Affected wiki Affected users Affected skin
MediaWiki:Wikia.css this wiki this wiki all users Oasis (default)
MediaWiki:Monobook.css this wiki this wiki all users Monobook
Special:MyPage/wikia.css this wiki this wiki you only Oasis (default)
Special:MyPage/monobook.css this wiki this wiki you only Monobook
Special:MyPage/common.css this wiki this wiki you only any
w:Special:MyPage/global.css community[1] all wikis you only any


Bulb CSS for both skins

There is also MediaWiki:Common.css which is automatically included by MediaWiki:Monobook.css but not by MediaWiki:Wikia.css. So if you want to use MediaWiki:Common.css to create rules for both Oasis and Monobook you have to load it into MediaWiki:Wikia.css with an @import rule:

/* LEAVE THIS IMPORT ABOVE EVERYTHING ELSE */
@import url("/load.php?mode=articles&only=styles&articles=MediaWiki:Common.css");

Remove any old CSS in MediaWiki:Common.css before importing it. Otherwise the old CSS may mess things up in MediaWiki:Wikia.css and the Oasis/Wikia skin.

JavaScript

The most common choices are highlighted:

Script file Located at Affected wiki Affected users Affected skin
MediaWiki:Common.js this wiki this wiki all users any
MediaWiki:Wikia.js this wiki this wiki all users Oasis (default)
MediaWiki:Monobook.js this wiki this wiki all users Monobook
Special:MyPage/wikia.js this wiki this wiki you only Oasis (default)
Special:MyPage/monobook.js this wiki this wiki you only Monobook
Special:MyPage/common.js this wiki this wiki you only any
w:Special:MyPage/global.js community[1] all wikis you only any
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 difficult to understand errors for you or other wiki visitors.


Caching issues

Every file you download from the Internet gets cached. Normally that's great because it reduces traffic both for your own computer 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's 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 also

Further help & feedback


Notes

  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 wiki will have no effect.

Photos

Add a Photo
3,320photos on this wiki
See all photos >

Recent Wiki Activity

See more >

Around Wikia's network

Random Wiki