Mercurial > public > sg101
diff media/js/comments.js @ 1:dbd703f7d63a
Initial import of sg101 stuff from private repository.
author | gremmie |
---|---|
date | Mon, 06 Apr 2009 02:43:12 +0000 |
parents | |
children | 10d6182b9f6e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/media/js/comments.js Mon Apr 06 02:43:12 2009 +0000 @@ -0,0 +1,40 @@ +$(document).ready(function() { + $('#comment-form-post').click(function () { + $(this).attr('disabled', 'disabled').val('Posting Comment...'); + $.post('/comments/post/', { + comment : $('#id_comment').val(), + content_type : $('#id_content_type').val(), + object_pk : $('#id_object_pk').val() + }, + function (data, textStatus) { + $('#id_comment').val(''); + $('#comment-list').append(data); + var lastLi = $('#comment-list > li:last'); + lastLi.hide(); + lastLi.fadeIn(3000); + $('#comment-form-post').removeAttr('disabled').val('Post Comment'); + var count = $('#comment-count'); + if (count.length) { + count.html(parseInt(count.html()) + 1); + } + }, + 'html'); + return false; + }); + $('a.comment-flag').click(function () { + var id = this.id; + if (id.match(/fc-(\d+)/)) { + id = RegExp.$1; + if (confirm('Only flag a comment if you feel it is spam, abuse, violates site rules, ' + + 'or is not appropriate. ' + + 'A moderator will be notified and will review the comment. ' + + 'Are you sure you want to flag this comment?')) { + $.post('/comments/flag/', { id : id }, function(response) { + alert(response); + }, 'text'); + } + } + return false; + }); + $('#id_comment').markItUp(mySettings); +});