Search code examples
jquerymootoolsjoomla2.5

Why is Joomla loading mootools-core and mootools-more twice?


Built a simple site, can't seem to figure out why this is happening:

<script src="media/system/js/mootools-core.js" type="text/javascript"></script>
<script src="media/system/js/core.js" type="text/javascript"></script>
<script src="media/system/js/mootools-more.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
<script src="/mylocalfolder/media/plg_jblibrary/jquery/jquery.noconflict.js" type="text/javascript"></script>
<script src="/mylocalfolder/media/system/js/mootools-core.js" type="text/javascript"></script>
<script src="/mylocalfolder/media/system/js/core.js" type="text/javascript"></script>
<script src="/mylocalfolder/media/system/js/caption.js" type="text/javascript"></script>
<script src="/mylocalfolder/media/system/js/modal.js" type="text/javascript"></script>
<script src="/mylocalfolder/media/system/js/mootools-more.js" type="text/javascript"></script>

What could be causing mootools-core.js, core.js, and mootools-more.js to be pulling in twice with two different paths? Where's a good place to search? Considering the only thing I was thinking about using it for is a modal window (deactivated, no effect) this is a lot of junk to be loading for nothing. I tried calling the JHTML::_('behavior.modal'); a few times to see if it would continue to call additional copies but it doesn't.

Any thoughts would be appreciated, thanks!


Solution

  • Joomla has a built-in api to load mootools like this: JHTML::_('behavior.mootools'); and it doesn't matter how many times you mention this, joomla will load mootools-core.js and mootools-more.js only once.

    I guess one of your modules or plugins are adding mootools to output's head manually, it may be like this:

    $doc =& JFactory::getDocument();
    $doc->addScript("media/system/js/mootools-core.js");