Mercurial > public > sg101
comparison 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 |
comparison
equal
deleted
inserted
replaced
0:900ba3c7b765 | 1:dbd703f7d63a |
---|---|
1 $(document).ready(function() { | |
2 $('#comment-form-post').click(function () { | |
3 $(this).attr('disabled', 'disabled').val('Posting Comment...'); | |
4 $.post('/comments/post/', { | |
5 comment : $('#id_comment').val(), | |
6 content_type : $('#id_content_type').val(), | |
7 object_pk : $('#id_object_pk').val() | |
8 }, | |
9 function (data, textStatus) { | |
10 $('#id_comment').val(''); | |
11 $('#comment-list').append(data); | |
12 var lastLi = $('#comment-list > li:last'); | |
13 lastLi.hide(); | |
14 lastLi.fadeIn(3000); | |
15 $('#comment-form-post').removeAttr('disabled').val('Post Comment'); | |
16 var count = $('#comment-count'); | |
17 if (count.length) { | |
18 count.html(parseInt(count.html()) + 1); | |
19 } | |
20 }, | |
21 'html'); | |
22 return false; | |
23 }); | |
24 $('a.comment-flag').click(function () { | |
25 var id = this.id; | |
26 if (id.match(/fc-(\d+)/)) { | |
27 id = RegExp.$1; | |
28 if (confirm('Only flag a comment if you feel it is spam, abuse, violates site rules, ' + | |
29 'or is not appropriate. ' + | |
30 'A moderator will be notified and will review the comment. ' + | |
31 'Are you sure you want to flag this comment?')) { | |
32 $.post('/comments/flag/', { id : id }, function(response) { | |
33 alert(response); | |
34 }, 'text'); | |
35 } | |
36 } | |
37 return false; | |
38 }); | |
39 $('#id_comment').markItUp(mySettings); | |
40 }); |