Skip to content
Browse files

Made addthis load async with jquery

  • Loading branch information...
1 parent ae256f3 commit 3b30698b94fbf27f9d5335f8f47daec0076bd4f8 @carmi committed
Showing with 16 additions and 6 deletions.
  1. +5 −5 layouts/base.html
  2. +11 −1 layouts/post.haml
View
10 layouts/base.html
@@ -19,17 +19,17 @@
%meta{:name => "description", :content => "#{@item[:summary]}"}
%body
- = yield
-
- = render 'analytics'
+ // Load MediaTemple (Jquery) CDN's Jquery
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ = yield
// Javascript
- // Load MediaTemple (Jquery) CDN's Jquery
- <script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
%script{:src => hashed_url('/static/js/combined.js'), :type => "text/javascript"}
+ = render 'analytics'
+
%script{:type => "text/javascript"}
jQuery(document).ready(function() {
jQuery("time.timeago").timeago();
View
12 layouts/post.haml
@@ -9,7 +9,17 @@
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
-<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4eda10a35fb88ae2"></script>
+\ <script type="text/javascript">
+\ // prevent jQuery from appending cache busting string to the end of the URL
+\ var cache = jQuery.ajaxSettings.cache;
+\ jQuery.ajaxSettings.cache = true;
+\
+\ jQuery.getScript('http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4eda10a35fb88ae2&domready=1');
+\
+\ // Restore jQuery caching setting
+\ jQuery.ajaxSettings.cache = cache;
+\ </script>
+
<!-- AddThis Button END -->
- if @item[:comments_enabled]

0 comments on commit 3b30698

Please sign in to comment.
Something went wrong with that request. Please try again.