Created
May 18, 2010 10:07
-
-
Save anonymous/404836 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your application-specific JavaScript functions and classes here | |
// This file is automatically included by javascript_include_tag :defaults | |
$(document).ready(function() { | |
$("#comment_form").submit(function() { | |
$.post(this.action, $(this).serialize(), null, "script"); | |
return false; | |
}) | |
}) | |
document.observe("dom:loaded", function() { | |
// the element in which we will observe all clicks and capture | |
// ones originating from pagination links | |
var container = $(document.body) | |
if (container) { | |
var img = new Image | |
img.src = '/images/spinner.gif' | |
function createSpinner() { | |
return new Element('img', { src: img.src, 'class': 'spinner' }) | |
} | |
container.observe('click', function(e) { | |
var el = e.element() | |
if (el.match('.pagination a')) { | |
el.up('.pagination.ajax').insert(createSpinner()) | |
new Ajax.Request(el.href, { method: 'get' }) | |
e.stop() | |
} | |
}) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment