<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,5 @@
 Javascript Dependency Manager
-====
+=============================
 This plugin is a basic javascript dependency manager. It makes it simple to 
 specify the dependencies for specific javascript files/libraries and implicitly
 include them.
@@ -46,4 +46,49 @@ Note: All the default dependencies are defined already (prototype/scriptaculous)
 5. That's it. It's a work in progress, feel free to contribute to it:
    http://github.com/arya/js_dependency_manager
 
-  
\ No newline at end of file
+  
+Using Google AJAX Libraries
+===========================
+Google provides hosting for popular javascript libraries
+http://code.google.com/apis/ajaxlibs/documentation/index.html
+
+Using this plugin, you can opt to use libraries from their server rather than yours.
+
+By default, only local (/public/javascripts/) javascripts are used
+but if you want to use Google's server, simply add this to an initializer:
+
+  JavascriptHelper::JavascriptHelperConfig.use_google_ajax_libs = true
+  
+You can put it in your environment files (development/production) to differentiate 
+settings for development mode and production.
+
+You can technically also put it in your application helper after &quot;include JavascriptHelper&quot;,
+but that's kind of ugly and not recommended.
+
+If you set use_google_ajax_libs to true, when you do
+
+  js :prototype
+  
+it will yield
+
+  &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+  
+  
+Here is a list of the libraries provided by Google:
+  * jQuery
+  * prototype
+  * scriptaculous (builder, effects, dragdrop, controls, slider, sound)
+  * mootools
+  * dojo
+
+If you wish to use the compressed version of the library, you can specify that like this:
+
+  JavascriptHelper::JavascriptHelperConfig.google_ajax_libs[:jQuery][:prefer_compressed] = true
+  
+
+Note: compressed versions are not provided for prototype or scriptaculous libraries.
+
+By default, the latest versions of the libraries as of the updating of this plugin are used,
+but you can specify the version you want yourself like so:
+
+  JavascriptHelper::JavascriptHelperConfig.google_ajax_libs[:effects][:version] = &quot;1.8.2&quot;
\ No newline at end of file</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -14,6 +14,9 @@ module JavascriptHelper
       :effects =&gt; [:prototype],
       :dragdrop =&gt; [:prototype, :effects],
       :controls =&gt; [:prototype, :effects],
+      :builder =&gt; [:prototype],
+      :slider =&gt; [:prototype, :effects],
+      :sound =&gt; [:prototype],
       :behaviour =&gt; [:prototype],
       :lowpro =&gt; [:prototype]
     }.merge(respond_to?(:js_dependencies) ? js_dependencies : {})[js.to_sym] || []
@@ -21,7 +24,55 @@ module JavascriptHelper
   
   def javascript_tags
     (@required_javascripts || []).collect do |js|
-      javascript_include_tag(&quot;#{js}.js&quot;)
+      path = JavascriptHelperConfig.use_google_ajax_libs &amp;&amp; google_ajax_libs_url(js) || &quot;#{js}.js&quot;
+      javascript_include_tag(path)
     end.join(&quot;\n&quot;)
   end
+  
+  def google_ajax_libs_url(lib)
+    if cfg = JavascriptHelperConfig.google_ajax_libs[lib.to_sym]
+      url = cfg[:prefer_compressed] &amp;&amp; cfg[:compressed_url] || cfg[:uncompressed_url]
+      url.sub(&quot;{version}&quot;, cfg[:version])
+    end
+  end
+
+  # used this class to name to avoid collisions since this is included in ApplicationHelper
+  class JavascriptHelperConfig
+    cattr_accessor :use_google_ajax_libs
+    cattr_accessor :google_ajax_libs
+    self.use_google_ajax_libs = false
+    
+    self.google_ajax_libs = {
+      :jQuery =&gt; {
+        :version =&gt; &quot;1.2.6&quot;,
+        :compressed_url =&gt; &quot;http://ajax.googleapis.com/ajax/libs/jquery/{version}/jquery.min.js&quot;,
+        :uncompressed_url =&gt; &quot;http://ajax.googleapis.com/ajax/libs/jquery/{version}/jquery.js&quot;,
+        :prefer_compressed =&gt; false
+      },
+      :prototype =&gt; {
+        :version =&gt; &quot;1.6.0.2&quot;,
+        :uncompressed_url =&gt; &quot;http://ajax.googleapis.com/ajax/libs/prototype/{version}/prototype.js&quot;
+      },
+      :mootools =&gt; {
+        :version =&gt; &quot;1.11&quot;,
+        :compressed_url =&gt; &quot;http://ajax.googleapis.com/ajax/libs/mootools/{version}/mootools-yui-compressed.js&quot;,
+        :uncompressed_url =&gt; &quot;http://ajax.googleapis.com/ajax/libs/mootools/{version}/mootools.js&quot;,
+        :prefer_compressed =&gt; false
+      },
+      :dojo =&gt; {
+        :version =&gt; &quot;1.1.1&quot;,
+        :compressed_url =&gt; &quot;http://ajax.googleapis.com/ajax/libs/dojo/{version}/dojo/dojo.xd.js&quot;,
+        :uncompressed_url =&gt; &quot;http://ajax.googleapis.com/ajax/libs/dojo/{version}/dojo/dojo.xd.js.uncompressed.js&quot;,
+        :prefer_compressed =&gt; false
+      }
+    }
+    
+    # scriptaculous libraries
+    %w{builder effects dragdrop controls slider sound}.each do |lib|
+      self.google_ajax_libs[lib.to_sym] = {
+        :version =&gt; &quot;1.8.1&quot;,
+        :uncompressed_url =&gt; &quot;http://ajax.googleapis.com/ajax/libs/scriptaculous/{version}/#{lib}.js&quot;
+      }
+    end
+  end
 end
\ No newline at end of file</diff>
      <filename>lib/javascript_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,9 @@
 require 'test/unit'
+require 'rubygems'
+require 'activesupport'
 require 'javascript_helper.rb'
 
+
 class JavascriptHelperTest &lt; Test::Unit::TestCase
   include JavascriptHelper
   
@@ -19,6 +22,18 @@ class JavascriptHelperTest &lt; Test::Unit::TestCase
     assert (javascript_tags =~ /taggies\.js/)
   end
   
+  def test_google_libs_when_true
+    JavascriptHelper::JavascriptHelperConfig.use_google_ajax_libs = true
+    js(:prototype)
+    assert (javascript_tags =~ /googleapis/)
+  end
+  
+  def test_no_google_libs_when_false
+    JavascriptHelper::JavascriptHelperConfig.use_google_ajax_libs = false
+    js(:prototype)
+    assert (javascript_tags !~ /googleapis/)
+  end
+  
   def js_dependencies
     {
       :needsmorefoobar =&gt; [:morefoobar]</diff>
      <filename>test/javascript_helper_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3b53c4477a87d60ce32d0bb8d2fe86209cea8f23</id>
    </parent>
  </parents>
  <author>
    <name>Arya Asemanfar</name>
    <email>arya.asemanfar@gmail.com</email>
  </author>
  <url>http://github.com/arya/js_dependency_manager/commit/9181261fec296b0eee8433db687b6004a3258af6</url>
  <id>9181261fec296b0eee8433db687b6004a3258af6</id>
  <committed-date>2008-05-29T14:56:15-07:00</committed-date>
  <authored-date>2008-05-29T14:12:47-07:00</authored-date>
  <message>* support google ajax libraries
* added builder, sound, and slider to default list</message>
  <tree>6c9377f79e5f073a832c4835b56ca65b52493258</tree>
  <committer>
    <name>Arya Asemanfar</name>
    <email>arya.asemanfar@gmail.com</email>
  </committer>
</commit>
