Author Topic: Script order issues VM 2.0.20b  (Read 1192 times)

bennie

  • Beginner
  • *
  • Posts: 9
Script order issues VM 2.0.20b
« on: July 01, 2013, 22:17:35 pm »
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

  • Beginner
  • *
  • Posts: 3
Re: Script order issues VM 2.0.20b
« Reply #1 on: July 27, 2013, 22:48:51 pm »
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)

Code: [Select]
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.
Code: [Select]
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

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10400
  • VirtueMart Version: 3+
Re: Script order issues VM 2.0.20b
« Reply #2 on: July 28, 2013, 01:16:54 am »
why do you need mootools?
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

kurai

  • Beginner
  • *
  • Posts: 3
Re: Script order issues VM 2.0.20b
« Reply #3 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.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10400
  • VirtueMart Version: 3+
Re: Script order issues VM 2.0.20b
« Reply #4 on: July 28, 2013, 22:05:37 pm »
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

J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)