2 header("Content-Type: text/javascript");
3 include("../../../appg/settings.php");
4 include("../../../appg/init_vanilla.php");
8 function AddDiscussionVote (AjaxURL
, DiscussionID
, Vote
, CurrentTotalVotes
, PostBackKey
) {
10 $
.post(AjaxURL
, {'DiscussionID': DiscussionID
, 'Vote': Vote
, 'CurrentTotalVotes': CurrentTotalVotes
, 'PostBackKey': PostBackKey
},
12 if (data
== 'Complete') {
13 $
("li#Discussion_"+DiscussionID+
" li.DiscussionVoteCount span:first-child").fadeTo('slow','0.1');
14 $
("li#Discussion_"+DiscussionID+
" li.DiscussionVoteCount span:first-child").text(CurrentTotalVotes + Vote
);
16 $
("li#Discussion_"+DiscussionID+
" li.DiscussionAddVote").html('<span class="VotedPositive"><input class="VotePositive" type="button" disabled="disabled"/><input class="VoteNegative" type="button" disabled="disabled"/></span>');
17 $
("li#Discussion_"+DiscussionID
).addClass("VotedPositive");
18 } else if (Vote
< 0) {
19 $
("li#Discussion_"+DiscussionID+
" li.DiscussionAddVote").html('<span class="VotedNegative"><input class="VotePositive" type="button" disabled="disabled"/><input class="VoteNegative" type="button" disabled="disabled"/></span>');
20 $
("li#Discussion_"+DiscussionID
).addClass("VotedNegative");
24 alert('Adding vote to discussion did not work');
26 $
("li#Discussion_"+DiscussionID+
" li.DiscussionVoteCount span:first-child").fadeTo('slow','1');
32 function AddCommentVote (AjaxURL
, CommentID
, Vote
, CurrentTotalVotes
, PostBackKey
) {
34 $
.post(AjaxURL
, {'CommentID': CommentID
, 'Vote': Vote
, 'CurrentTotalVotes': CurrentTotalVotes
, 'PostBackKey': PostBackKey
},
36 if (data
== 'Complete') {
37 $
("li#Comment_"+CommentID+
" span.CommentVoteCount").fadeTo('slow','0.1');
38 $
("li#Comment_"+CommentID+
" span.CommentVoteCount").text(CurrentTotalVotes + Vote
);
40 $
("li#Comment_"+CommentID+
" span.AddCommentVote").html('<span class="VotedPositive"><input class="VotePositive" type="button" disabled="disabled"/><input class="VoteNegative" type="button" disabled="disabled"/></span>');
42 } else if (Vote
< 0) {
43 $
("li#Comment_"+CommentID+
" .CommentBody").slideUp('slow');
44 $
("li#Comment_"+CommentID+
" span.AddCommentVote").html('<span class="VotedNegative"><input class="VotePositive" type="button" disabled="disabled"/><input class="VoteNegative" type="button" disabled="disabled"/></span>');
45 $
("li#Comment_"+CommentID+
" span.CommentVoteCount").addClass('VotedNegative');
46 $
("li#Comment_"+CommentID
).addClass('VotedNegative');
50 alert('Adding vote to comment did not work');
52 $
("li#Comment_"+CommentID+
" span.CommentVoteCount").fadeTo('slow','1');
57 function ShowComment (CommentID
) {
58 $
("li#Comment_"+CommentID+
" .CommentBody").slideToggle('slow');
61 $
(document
).ready(function() {
62 $
("li ul.VotedNegative").each(function() {
63 $
(this
).parent().addClass('VotedNegative');
65 $
("li span.VotedNegative").each(function() {
66 $
(this
).parent().parent().parent().addClass('VotedNegative');
67 $
("li.VotedNegative .CommentBody").hide();