Thread:Project:Support desk/Loading race condition for javascript

MediaWiki version: 1.19.6 PHP version: 5.4.11-1~lucid+1 (apache2handler) Database version: 5.1.63-rel13.4-log Wiki URL: http://dragon-story.wikia.com/wiki/Dragon_Story_Wiki Script URL: http://dragon-story.wikia.com/wiki/MediaWiki:BreedingCalculator.js Problem: Even though I am using $(document).ready(function{}); to wrap my initial onload functions, I am experiencing a race condition where defined .prototype functions are not recognized if I attempt to access them while in the supposed onload stack. 1) This does not occur without the jQuery call inside a MediaWiki file. For example, if I simply run the script in my browser using a body onload event, everything runs perfectly fine. 2) This problem does not surface outside of the intended onload stack. For example, if I send a button click event, the defined .prototype functions will easily be found. The problem only arises with the functions called during the onload event (jQuery's document.ready in this case). Previously, I have dealt with this race condition issue by avoiding .prototype function access within the onload stack. This could be done by transforming certain .prototype functions into general functions instead, writing not-so-efficient workaround code to simulate the intended behavior, etc. However, I'd like to avoid continuing to do this if possible, because it grates on my perfectionist nerves. I wonder if this has anything to do with the fact that I use MediaWiki:Wikia.js to verify a particular wgPageName before attempting to load the script at all. I do not want to add the script to MediaWiki:Common.js, because loading it for every user on every page would be madness. Do I have any other alternatives to ensure that the document is correctly loaded before the script attempts to run? The jQuery document.ready call does not seem to be functioning correctly in this instance. Thanks in advance.