News:

Support the VirtueMart project and become a member

Main Menu

Script order issues VM 2.0.20b

Started by bennie, July 01, 2013, 22:17:35 PM

Previous topic - Next topic

bennie

HI team ,
first would like to congratulate you on cleaning up VM   and I hope that for j3.x there will not be to many issues.

We would love to add some VM styles to our templates but we ran in to the issues with script loads ,
issue1:
all VM scripts load before the core ones instead after.
Disabling jQuery leaves JQ depending scripts loaded on top of Mootools
http://prntscr.com/1d0et9

issue2:
since we made a  JBootstrap plugin for J2.5.x which is actually a replica of J3.x bootstrap class our Jquery loads in same order
as in 3.x thus again we have the issue with all VM scripts

issue3:

I tried to use vmJsApi::js() class instead
http://dev.virtuemart.net/projects/virtuemart/wiki/JavascriptCSS_Template_Overrides_and_Avoiding_Conflicts_between_Libraries



which works as it should and loads the JQ where it should be
http://prntscr.com/1d0foq

but as you can see again , it leaves all JQ depending scripts on top of it.

JS folder overrides don't help either
Would you shed some light on this please .


The order we need is


mootools-core.js
core.js
mootools-more.js
modal.js

AND NOW ANY VM SCRIPT

Thank you.

kurai

I second this request.

Anwers elsewhere in the forum generally run along the lines of "don't load javascript from site template, then", which isn't enormously helpful and rather misses the point.

I've come up with a quick and dirty hack to get around the issue for the time being :-

File: $your_joomla_directory/administrator/components/com_virtuemart/helpers/config.php

Change part of public static function js() ...

line: 1012  (in VM 2.0.22)

from
            $document->addScript( $file );
to
            $document->addScript( $file, $type="text/javascript" , $defer=true );


This adds defer="defer" to the <script> element that vmJsApi::js() loads into <head>

i.e.
from
<script src="/joomla/components/com_virtuemart/assets/js/fancybox/jquery.fancybox-1.3.4.pack.js" type="text/javascript"></script>
to
<script src="/joomla/components/com_virtuemart/assets/js/fancybox/jquery.fancybox-1.3.4.pack.js" type="text/javascript" defer="defer"></script>


It doesn't really address the real load-order issue properly, but at least it gets the VM script's activation out of the way till everything that should be loaded before it has done it's stuff.
--
kurai

PRO


kurai

Gah ... never mind.  Ignore the config.php change.

Because it acts globally on *all* the javascript entities that vmJsApi::js() pulls in it causes horrible problems with every other .js VM loads.

PRO

Quote from: kurai on July 28, 2013, 02:57:30 AM
Gah ... never mind.  Ignore the config.php change.

Because it acts globally on *all* the javascript entities that vmJsApi::js() pulls in it causes horrible problems with every other .js VM loads.

not if you are using fancybox

only with modal

I only have mootools in content pages

& pages that use form validation