annotate media/js/comments.js @ 11:cc8eb028def1

Update jquery-ui and theme version that is hosted on google. In preparation for having jquery on every page (?), make it so that the autocomplete plug is using the 'global' jquery, and not the one that came with it. It seems to work okay with jquery 1.3.2.
author Brian Neal <bgneal@gmail.com>
date Tue, 14 Apr 2009 02:35:35 +0000
parents dbd703f7d63a
children 10d6182b9f6e
rev   line source
gremmie@1 1 $(document).ready(function() {
gremmie@1 2 $('#comment-form-post').click(function () {
gremmie@1 3 $(this).attr('disabled', 'disabled').val('Posting Comment...');
gremmie@1 4 $.post('/comments/post/', {
gremmie@1 5 comment : $('#id_comment').val(),
gremmie@1 6 content_type : $('#id_content_type').val(),
gremmie@1 7 object_pk : $('#id_object_pk').val()
gremmie@1 8 },
gremmie@1 9 function (data, textStatus) {
gremmie@1 10 $('#id_comment').val('');
gremmie@1 11 $('#comment-list').append(data);
gremmie@1 12 var lastLi = $('#comment-list > li:last');
gremmie@1 13 lastLi.hide();
gremmie@1 14 lastLi.fadeIn(3000);
gremmie@1 15 $('#comment-form-post').removeAttr('disabled').val('Post Comment');
gremmie@1 16 var count = $('#comment-count');
gremmie@1 17 if (count.length) {
gremmie@1 18 count.html(parseInt(count.html()) + 1);
gremmie@1 19 }
gremmie@1 20 },
gremmie@1 21 'html');
gremmie@1 22 return false;
gremmie@1 23 });
gremmie@1 24 $('a.comment-flag').click(function () {
gremmie@1 25 var id = this.id;
gremmie@1 26 if (id.match(/fc-(\d+)/)) {
gremmie@1 27 id = RegExp.$1;
gremmie@1 28 if (confirm('Only flag a comment if you feel it is spam, abuse, violates site rules, ' +
gremmie@1 29 'or is not appropriate. ' +
gremmie@1 30 'A moderator will be notified and will review the comment. ' +
gremmie@1 31 'Are you sure you want to flag this comment?')) {
gremmie@1 32 $.post('/comments/flag/', { id : id }, function(response) {
gremmie@1 33 alert(response);
gremmie@1 34 }, 'text');
gremmie@1 35 }
gremmie@1 36 }
gremmie@1 37 return false;
gremmie@1 38 });
gremmie@1 39 $('#id_comment').markItUp(mySettings);
gremmie@1 40 });