diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2008-11-27 06:14:32 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2008-11-27 06:14:32 +0000 |
commit | 27e64f1dc6cc43b40592337eed360bdf7e3d7a59 (patch) | |
tree | f127c76bff448c546a30753b466cf909bb42ca7d /modules/comment/js/comment.js | |
parent | 7e5f59bcb7682896657dd11a530dc25412ef3cdc (diff) |
Move javascript from default theme to appropriate modules
Diffstat (limited to 'modules/comment/js/comment.js')
-rw-r--r-- | modules/comment/js/comment.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/comment/js/comment.js b/modules/comment/js/comment.js new file mode 100644 index 00000000..259b4826 --- /dev/null +++ b/modules/comment/js/comment.js @@ -0,0 +1,19 @@ +$("document").ready(function() { + ajaxify_comment_form(); +}); + +function ajaxify_comment_form() { + $("#gComments form").ajaxForm({ + complete: function(xhr, statusText) { + $("#gComments form").replaceWith(xhr.responseText); + if (xhr.status == 201) { + $.get(xhr.getResponseHeader("Location"), function(data, textStatus) { + $("#gComments .gBlockContent ul:first").append("<li>"+data+"</li>"); + $("#gComments .gBlockContent ul:first li:last").hide().slideDown(); + }); + $("#gComments form").clearForm(); + } + ajaxify_comment_form(); + } + }); +} |