@@ -2,7 +2,7 @@ Drupal.voteUpDownAutoAttach = function() { var vdb = []; - $('span.vote-up-inact, span.vote-down-inact, span.vote-up-act, span.vote-down-act').each(function () { + $('span.vote-up-inact, span.vote-down-inact, span.vote-up-act, span.vote-down-act, span.vote-up-inact-comment, span.vote-down-inact-comment, span.vote-up-act-comment, span.vote-down-act-comment').each(function () { // Read in the path to the PHP handler uri = $(this).attr('title'); // Remove the title, so no tooltip will display @@ -30,6 +30,8 @@ this.id = $(elt).attr('id'); this.dir1 = this.id.indexOf('vote_up') > -1 ? 'up' : 'down'; this.dir2 = this.dir1 == 'up' ? 'down' : 'up'; + this.dir3 = this.id.indexOf('comment') > -1 ? '-comment': ''; + this.dir4 = this.id.indexOf('comment') > -1 ? 'comment_': ''; $(elt).click(function() { // Ajax GET request for vote data $.ajax({ @@ -38,14 +40,14 @@ success: function (data) { // extract the cid so we can change other elements for the same cid var cid = db.id.match(/[0-9]+$/); - var pid = 'vote_points_' + cid; + var pid = 'vote_points_' + db.dir4 + cid; //update the voting arrows - $('#' + db.id + '.vote-' + db.dir1 + '-inact') - .removeClass('vote-' + db.dir1 + '-inact') - .addClass('vote-' + db.dir1 + '-act'); - $('#' + 'vote_' + db.dir2 + '_' + cid) - .removeClass('vote-' + db.dir2 + '-act') - .addClass('vote-' + db.dir2 + '-inact'); + $('#' + db.id + '.vote-' + db.dir1 + '-inact' + db.dir3) + .removeClass('vote-' + db.dir1 + '-inact' + db.dir3) + .addClass('vote-' + db.dir1 + '-act' + db.dir3); + $('#' + 'vote_' + db.dir2 + '_' + db.dir4 + cid) + .removeClass('vote-' + db.dir2 + '-act' + db.dir3) + .addClass('vote-' + db.dir2 + '-inact' + db.dir3); // update the points $('#' + pid).html(data); },