Mootools & jQuery load from Google Library

Questions related to the configuration of Joomla, Templates, and Security related questions/issues
Rate this topic: Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.
GK User
Tue Apr 30, 2013 3:21 am
As the title said,

Is there any ways to do the loading for MooTools and jQuery from google library ?

I am using Joomla 3.1.1 with StartUp template v3.8
User avatar
Junior Boarder

GK User
Tue Apr 30, 2013 6:12 am
Hi,
unfortunately all plugins that supports Google’s AJAX Libraries , by now, are build for Joomla 2.5 --> http://extensions.joomla.org/extensions ... networking

You have to ask their developers to update.

Than you can disable (cut off) standard JS Libraries from template etc.
User avatar
Platinum Boarder

GK User
Tue Apr 30, 2013 12:38 pm
Hello,

Today, I tried to manually work to the code. Here is the example for the jQuery:

1. I make Joomla didn't load the default (/media/jui/js/jquery.min.js) and edit my /template/gk_startup/index.php with this qode:
Code: Select all
//Custom for JS Load
 if(JFactory::getUser()->guest == 1){
    JHtml::_('behavior.framework', true);
   
    unset($this->_scripts[JURI::root(true).'/media/jui/js/jquery.min.js']);
 
    if (isset($this->_script['text/javascript']))
    {
       $this->_script['text/javascript'] = preg_replace('%window\.addEvent\(\'load\',\s*function\(\)\s*{\s*new\s*JCaption\(\'img.caption\'\);\s*}\);\s*%', '', $this->_script['text/javascript']);
       if (empty($this->_script['text/javascript']))
          unset($this->_script['text/javascript']);
    }
}
//EOF Custom JS Load


2. I load the jQuery from Google Libraries by adding this code to the end of /templates/gk_startup/layouts/blocks/footer.php :
Code: Select all
<script src="//cdnjs.cloudflare.com/ajax/libs/mootools-more/1.4.0.1/mootools-more-yui-compressed.js" type="text/javascript"></script>


I think Igot what I need for the jQuery. :D

But, I have another question about the MooTools.

First, I would to say sorry if this question looks funny for the pros :blush:

If I look at the .JS that default Joomla load for the mootools is mootools-core.js and mootools-more.js, but the google's have mootools with mootools-yui-compressed.js. Can it work in my website ?

Thanks for your attention and sorry for my bad english.
User avatar
Junior Boarder

GK User
Thu May 02, 2013 10:30 pm
It depends the version you have set.
You also need to pay attention to the version of the JavaScript libraries. The mootools version hosted on Google's must have this same(!) version as those from Joomla. If yes, this should work.

Benefits of the using Google's Ajax libraries you know:
    * Save bandwidth.
    * Speed up your site's response.
User avatar
Platinum Boarder

GK User
Thu May 02, 2013 11:04 pm
Joomla 3.1.1 - uses Mootools v1.4.5 (!), not old 1.4.1 like was in J2.5
and jQuery v1.8.3
User avatar
Platinum Boarder


cron