Forum:Javascripts not working in Oasis theme

Hi there! I'm an admin on Holopedia, the Bulgarian version of Wookieepedia, the Star Wars Wiki.

I'm having problems with w:c:bg.starwars:MediaWiki:Common.js, it's not working on the modern Oasis theme, but works perfectly fine on the MonoBook theme. For example there's a simple show/hide script to manipulate the "display" css property of an element - it works on MonoBook - check it out on the top of the Sandbox page. And I've written one script that adds a subtitle just below the title of any article that has an interwiki link for Wookieepedia - the subtitle is the english title of the corresponding article in Wookieepedia and it links to it. This script also works on MonoBook, but doesn't on Oasis - see any page that has an english interwiki link, for example Anakin Skywalker.

I think the whole Common.js was taken (a long time ago mind you) from Wookieepedia's Common.js. Aside from the subtitle function, I haven't written any of it.

I believe the file does load on Oasis (I ca see its code in Firebug, in the Script tab), however the functions just don't work.

So any idea why Common.js won't work in the Oasis theme?

Thanks! adenry 20:50, January 24, 2012 (UTC)


 * Make sure the ids and classes your JS expects are actually on the page when rendered as Oasis skin. The CSS ids and classes will change between skins, so expecting Javascript to work the same on Monobook vs. Oasis isn't really realistic. Oasis specific JS should be put in MediaWiki:Wikia.js.
 * That said, Wikia's implementation of Oasis was definitely strange, since it does load MediaWiki:Common.js, but not MediaWiki:Common.css. -- Fandyllic (talk &middot; contr) 24 Jan 2012 2:30 PM Pacific


 * I know the css is different, that's taken into account. The ids do exist, that's not the problem. I tried to put the code in Wikia.js, but that didn't help.
 * I noticed a strange problem - on the MonoBook theme where the js works, if I use the show/hide script AND also use in the same article, the show/hide script won't work. If I delete the , show/hide is working fine.
 * Tried the same experiment with another test js function -- the test function won't work when the show/hide function is on the same page, but if it's only the test function it works just fine.
 * So it's like there's some sort of problem with multiple js functions in one page. Maby the functions in Common.js are clashing with some of Oasis's js functions (like the one that adds the facebook like button for example)... I really don't understand what's going on... adenry 01:00, January 25, 2012 (UTC)

Seems my problem is even bigger — the script in w:c:bg.starwars:MediaWiki:Wikia.js also doesn't work at all in Oasis! Again — it does load, but nothing I put in the $(document).ready(function {} ); is actually working! What is going on here?! This is just frustrating... So no javascript works at all in Oasis. Help... adenry 20:42, January 25, 2012 (UTC)