Fix for Code

  1.   /**
  2.    * The jQuery.sharethis() function will process through the queue and create
  3.    * the elements.
  4.    */
  5.   jQuery.shareThis = function() {
  6.     // Loop through the process queue.
  7.     jQuery.each(jQuery.sharethisQueue, function(i, objects) {
  8.       jQuery.each(objects, function(i, object) {
  9.         // Retrieve the element, while deactivating the default click effect.
  10.         var element = jQuery(object);
  11.  
  12.         // Setup the object properties and JavaScript elements to be passed in.
  13.         var objectProperties = {
  14.           url: element.attr('href'),
  15.           title: element.attr('title')
  16.         };
  17.  
  18.         // If I do console.log(objectProperties); here, these are both populated correctly.
  19.  
  20.         // Create and insert the button.
  21.         var share = SHARETHIS.addEntry(objectProperties, {button: false});
  22.  
  23.         // For strange reason we need a wrapping span around the link
  24.         // with the attribute "id" = sharethis_[somenumber], why? don´t as me (anon), ask sharethis crew.
  25.         var a = i + 1;
  26.         var wrapper = jQuery('<span></span>').attr('id', 'sharethis_'+a);
  27.  
  28.         element.wrap(wrapper).replaceWith(share.button);
  29.       });
  30.     });
  31.     // Clear the process queue.
  32.     jQuery.sharethis = [];
  33.   };
  34. })(jQuery);

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.