orbit-basic/app/assets/javascripts/application.js

40 lines
1.2 KiB
JavaScript

// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
$(function () {
$('#panel_sidebar a, #panel_main a.nav').live('click',
function () {
$.getScript(this.href);
history.pushState(null, document.title, this.href);
return false;
}
);
$('#panel_main a.reload').live('click',
function () {
$.getScript(this.href);
history.replaceState(null, document.title, this.href);
return false;
}
);
$('.form').live('submit', function () {
$.post(this.action, $(this).serialize(), null, 'script');
return false;
});
$(window).bind("popstate", function () {
$.getScript(location.href);
});
});