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.6
diff -u -r1.6 ajax_vote_up_down.js
--- ajax_vote_up_down.js	19 Nov 2007 07:32:27 -0000	1.6
+++ ajax_vote_up_down.js	17 Apr 2008 23:57:14 -0000
@@ -35,20 +35,28 @@
   // Extract the cid so we can change other elements for the same cid
   this.cid = db.id.match(/[0-9]+$/);
   $(elt).click(function() {
+    // Don't register a vote if the user is repeating a previous vote.
+    if ($('#vote_' + db.dir1 + '_' + db.type + '_' + db.cid + '.vote-' + db.dir1 + '-act').size()) {
+      return;
+    }
+    // Update the content right away.
+    var currentData = $('#vote_points_' + db.type + '_' + db.cid).html();
+    // Parse positive or negative existing point count.
+    var count = parseInt(currentData.match(/-{0,1}[0-9]+/));
+    // If the user has already voted, the vote count will change by two
+    // (reversing the previous vote).
+    var rate = ($('#vote_up_' + db.type + '_' + db.cid + '.vote-up-act').size() || $('#vote_down_' + db.type + '_' + db.cid + '.vote-down-act').size()) ? 2 : 1;
+    var increment = (db.dir1 == 'up' ? 1 : -1) * rate;
+    var newCount = count + increment;
+    // Read in the appropriate label.
+    var str = (newCount == 1) ? Drupal.settings.vote_up_down.singularLabel : Drupal.settings.vote_up_down.pluralLabel;
+    Drupal.voteUpDownResult(db, str.replace('!count', newCount));
     // Ajax GET request for vote data
     $.ajax({
       type: "GET",
       url: db.uri,
-      success: function (data) {
-        //update the voting arrows
-        $('#' + db.id + '.vote-' + db.dir1 + '-inact')
-          .removeClass('vote-' + db.dir1 + '-inact')
-          .addClass('vote-' + db.dir1 + '-act');
-        $('#vote_' + db.dir2 + '_' + db.type + '_' + db.cid)
-          .removeClass('vote-' + db.dir2 + '-act')
-          .addClass('vote-' + db.dir2 + '-inact');
-        // update the points
-        $('#vote_points_' + db.type + '_' + db.cid).html(data);
+      success: function(data) {
+        Drupal.voteUpDownResult(db, data);
       },
       error: function (xmlhttp) {
         alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ db.uri);
@@ -57,6 +65,18 @@
   });
 }
 
+Drupal.voteUpDownResult = function (db, data) {
+  //update the voting arrows
+  $('#' + db.id + '.vote-' + db.dir1 + '-inact')
+    .removeClass('vote-' + db.dir1 + '-inact')
+    .addClass('vote-' + db.dir1 + '-act');
+  $('#vote_' + db.dir2 + '_' + db.type + '_' + db.cid)
+    .removeClass('vote-' + db.dir2 + '-act')
+    .addClass('vote-' + db.dir2 + '-inact');
+  // update the points
+  $('#vote_points_' + db.type + '_' + db.cid).html(data);
+};
+
 // Global killswitch
 if (Drupal.jsEnabled) {
   $(document).ready(Drupal.voteUpDownAutoAttach);
Index: vote_up_down.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vote_up_down/vote_up_down.module,v
retrieving revision 1.20
diff -u -r1.20 vote_up_down.module
--- vote_up_down.module	19 Nov 2007 07:32:27 -0000	1.20
+++ vote_up_down.module	17 Apr 2008 23:54:59 -0000
@@ -200,6 +200,7 @@
 
     drupal_add_css(drupal_get_path('module', 'vote_up_down') .'/vote_up_down.css');
     drupal_add_js(drupal_get_path('module', 'vote_up_down') .'/ajax_vote_up_down.js');
+    drupal_add_js(array('vote_up_down' => array('singularLabel' => t('!count point'), 'pluralLabel' => t('!count points'))), 'setting');
   }
 
   return $items;

