2008-11-16 07:14:12 +00:00
|
|
|
$("document").ready(function() {
|
2009-10-04 00:27:22 -06:00
|
|
|
$("#g-admin-comment-button").click(function(event) {
|
2009-08-28 13:44:01 -07:00
|
|
|
event.preventDefault();
|
2009-10-04 00:27:22 -06:00
|
|
|
if (!$("#g-comment-form").length) {
|
2009-09-13 14:19:04 -07:00
|
|
|
$.get($(this).attr("href"),
|
|
|
|
|
{},
|
|
|
|
|
function(data) {
|
2009-10-04 00:27:22 -06:00
|
|
|
$("#g-comment-detail").append(data);
|
2009-09-13 14:19:04 -07:00
|
|
|
ajaxify_comment_form();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
2009-10-04 00:27:22 -06:00
|
|
|
$("#g-no-comments").click(function(event) {
|
2009-09-22 07:59:26 -07:00
|
|
|
event.preventDefault();
|
2009-10-04 00:27:22 -06:00
|
|
|
if (!$("#g-comment-form").length) {
|
2009-09-22 07:59:26 -07:00
|
|
|
$.get($(this).attr("href"),
|
|
|
|
|
{},
|
|
|
|
|
function(data) {
|
2009-10-04 00:27:22 -06:00
|
|
|
$("#g-comment-detail").append(data);
|
2009-09-22 07:59:26 -07:00
|
|
|
ajaxify_comment_form();
|
|
|
|
|
});
|
2009-10-04 00:27:22 -06:00
|
|
|
$("#g-no-comments-yet").remove();
|
2009-09-22 07:59:26 -07:00
|
|
|
}
|
|
|
|
|
});
|
2008-11-16 07:14:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function ajaxify_comment_form() {
|
2009-10-04 00:27:22 -06:00
|
|
|
$("#g-comments form").ajaxForm({
|
2008-12-25 01:34:17 +00:00
|
|
|
dataType: "json",
|
2008-12-25 00:47:40 +00:00
|
|
|
success: function(data) {
|
2009-11-25 08:05:21 -08:00
|
|
|
if (data.result == "success") {
|
|
|
|
|
$("#g-comments #g-comment-detail ul").append(data.view);
|
|
|
|
|
$("#g-comments #g-comment-detail ul li:last").effect("highlight", {color: "#cfc"}, 8000);
|
|
|
|
|
$("#g-comment-form").hide(2000).remove();
|
|
|
|
|
$("#g-no-comments-yet").hide(2000);
|
|
|
|
|
} else {
|
|
|
|
|
if (data.form) {
|
|
|
|
|
$("#g-comments form").replaceWith(data.form);
|
|
|
|
|
ajaxify_comment_form();
|
|
|
|
|
}
|
2008-11-16 07:14:12 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2009-02-12 07:07:11 +00:00
|
|
|
}
|