Sha256: 33c1dc90eeb5a66df11d71ad593ee3cbfe510c5af8b4930bccbf4c49b7153cf4
Contents?: true
Size: 1.27 KB
Versions: 7
Compression:
Stored size: 1.27 KB
Contents
var History = window.History; var ajaxed = true; $.ajaxSetup({ dataType: "html" }); function ajax_complete_defaults(data){ $("#main").removeClass('ajax-loader'); $("#main").html(data); $('title').html($("#content_for_title").html()); $("meta[name='description']").attr("content",$("#content_for_page_description").html()); $("meta[name='keywords']").attr("content",$("#content_for_keywords").html()); $('#sidebar').html($("#content_for_sidebar").html()); $('#gallery').html($("#content_for_gallery").html()); $('#slideshow').html($("#content_for_slideshow").html()); bind_functions("#main"); } $(document).ready(function (){ $("a[data-remote]").live('ajax:before', function() { $("#main").addClass('ajax-loader'); }); $("a[data-remote]").live('ajax:complete', function(status, xhr) { ajaxed = true; History.pushState(null,'',$(this).attr('href')); ajax_complete_defaults(xhr.responseText); }); $(window).bind('statechange',function(){ if (ajaxed === false ) { var url = History.getState().url.replace(History.getRootUrl(),''); $.ajax({ url: url, success: [function(data) {History.pushState(null,'',url)},function(data) {ajax_complete_defaults(data);}] }); } else { ajaxed = false; } }); });
Version data entries
7 entries across 7 versions & 1 rubygems