Google Ajax Library Plugin

A great way to save bandwidth is to take advantage of Google’s AJAX Libraries API to serve your favorite open-source JavaScript libraries.

For a Joomla user, Joomla import mootools.js automatically. Mootools.js is more than 70KB, If we host the mootools.js in Google, then how much bandwidth it will save?

For example, it will replace
"/media/system/js/mootools.js"
with
"http://ajax.googleapis.com/ajax/libs/mootools/1.11/mootools-yui-compressed.js"

or
"http://ajax.googleapis.com/ajax/libs/mootools/1.21/mootools-yui-compressed.js"



It depends the version you have set. The mootools version must host on Google's Ajax libraries.

The Joomla Plugin Google Ajax Library will automatically replace your local ajax libraries with Google's AJAX libraries.

Support Ajax libraries:

1. Mootools
2. Prototype
3. JQuery
4. YUI
5. SWFObject

Benefits of the using Joomla Plugin: GoogleAjaxLib

* Save bandwidth.
* Speed up your site's response.
* Service more online users.

V1.1 Use system plugin to give a big short replace.
V1.2 AddSWFObject

Report

It's nice plugin to manage updates for JS Framework. But it seem the plugin is not executed other than article component.

The event onAfterDisplayContent is never called for my component, so it still use included Joomla mootools (ver 1.11), maybe it's on Joomla (I'll try find which event suitable for the plugin)
bydelgardo on April 13, 2009
There is an error when using Mootools, because "caption.js" is loaded before mootools.js.

You can change this by doing the following in GoogleAjaxLib.php on line 47:

old:
$headerstuff['scripts']['http://ajax.googleapis.com/ajax/libs/mootools/'.$mootoolsVersion.'/mootools-yui-compressed.js']="text/javascript";

new:
$headerstuff['scripts'] = array('http://ajax.googleapis.com/ajax/libs/mootools/'.$mootoolsVersion.'/mootools-yui-compressed.js' => "text/javascript") + $headerstuff['scripts'];

Regards
delgardo
Owner's reply

Thanks, delgardo
I have fixed the bug.

Slick idea. Loads these bulky JS libs much faster. With all three of Joe's speedup plugins (CssJsCompress, StaticContent) running my page load times are much faster. Blink and there is the page. I have found no hassles or bugs.
bykorb on January 10, 2009
Hello,
Just tested this plugin, I like it. Very nice idea.

I might add: your plugin would be better if we can add multiple versions of Jquery or prototypes and mootools. For instance VM uses an older verision of prototypes and other hot extensions use latest jQuery, like Core Design Tools.

Thanks, and congrats.
Danny