Index: ajax_vote_up_down.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/vote_up_down/ajax_vote_up_down.js,v retrieving revision 1.5 diff -u -p -r1.5 ajax_vote_up_down.js --- ajax_vote_up_down.js 24 Nov 2006 13:18:35 -0000 1.5 +++ ajax_vote_up_down.js 13 Dec 2007 08:11:32 -0000 @@ -2,11 +2,12 @@ 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 - $(this).removeAttr('title'); + var uri = $(this).attr('title'); + // Get title from a tag. + var atitle = $(this).children('a').attr('title'); + $(this).attr('title', atitle); // remove href link $(this).html(''); // Create an object with this uri. Because @@ -30,6 +31,8 @@ Drupal.VDB = function(elt, uri, id) { 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 +41,14 @@ Drupal.VDB = function(elt, uri, id) { 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); },