Help:JavaScript and CSS Cheatsheet
Talk11this wiki
This cheatsheet lists all the JavaScript and CSS files you can modify to enhance your favorite wiki and/or your general Wikia experience. Since you may find that your edits don't have an immediate effect, this cheatsheet also includes a few notes about caching.
Stylesheets
Edit
The most common choice is highlighted in green:
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 |
![]() | 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("http://example.wikia.com/index.php?title=MediaWiki:Common.css&usemsgcache=yes&ctype=text/css&smaxage=86400&action=raw&maxage=86400"); 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
Edit
The most common choices are highlighted in green:
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 |
Be sure to put your code into only one of the script files. Otherwise it may not work correctly.
Caching Issues
Edit
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:
You need to bypass your browser's cache:
- 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
![]() | 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://yourwiki.wikia.com/wiki/MediaWiki:Cheatsheet
needs to be rewritten to:
http://example.wikia.com/wiki/MediaWiki:Cheatsheet?action=purge
![]() ![]() ![]() | 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. |
![]() ![]() ![]() | 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
Edit
Further Help & Feedback
Edit
- Check Help:Wikia Community Central for sources of further help
- Check Help:Contacting Wikia for how to report any errors or unclear steps in this article
Notes
Edit
- ↑ 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.