Shape 5

Joomla Templates => Lime Light - Club => : kurai July 28, 2013, 09:19:36 AM



: Javascript load order (specifically re VirtueMart)
: kurai July 28, 2013, 09:19:36 AM
Hiya.

Is there any mechanism in the S5/Vertex framework to change the load-order of template javascript libraries ?
( ./templates/lime_light/js/jquery/etc)

Specific issue is with VirtueMart 2.0.22 (on Joomla 2.5)
VirtueMart's FancyBox modal popup for product images insists on loading it's jquery .js script before lime_light loads it's jquery libs.

Is there any way to force the lime_light libs to load just after the ./media/system/js/mootools|core|modal stuff, but before any .js called by VirtueMart ?

The general load-order precedence seems to be:-
/media/system libs (core/mootools etc)
component scripts (VM's offending thing)
template libs (jquery min & no-conflict)
module scripts (any special .js modules require)

Have you guys had to do anything special on your VirtueMart enabled templates, to deal with this sort of thing, that might be applicable here ?

I've tried a whole bunch of VirtueMart black magic to try and make it behave, but no joy.
I'm currently working around it with a *really* ugly hack - in the VirtueMart component assets I've changed their called .js to be empty files, and added the complete versions of the .js to load in vertex/css_and_js.php, just after <?php require(dirname(__FILE__)."/../js/s5_vertex_addons.php"); ?>
It works, but man, it's :nasty: (obviously it loads the VM .js in *every* page, instead of just the ones VM requires it on)

Any thoughts/advice on how I might try and address this more elegantly ?


: Re: Javascript load order (specifically re VirtueMart)
: kurai July 28, 2013, 11:29:52 AM
Never mind ... solved the issue by using the jQuery Easy plugin by http://www.simplifyyourweb.com/
(http://extensions.joomla.org/extensions/core-enhancements/performance/jquery-scripts/18327)

It calls jQuery libs from Google CDN (or local paths if needed) and inserts them into <head> with the Joomla core libs, before any other plugin or module.
It also solves various other conflict/multiple-library-instances/versions issues

It seems to play nice with lime_light, and I've not seen any ill effects from it stripping out the templates jquery libs.

Hopefully this whole mess will go away when Joomla 3.5LTS arrives, with jQuery properly built in from the get go.  ::)