Index: sharethis.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sharethis/Attic/sharethis.js,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 sharethis.js
--- sharethis.js	3 Apr 2009 22:05:20 -0000	1.1.2.3
+++ sharethis.js	13 Apr 2009 14:40:14 -0000
@@ -4,46 +4,9 @@
  * Drupal ShareThis behaviors.
  */
 Drupal.behaviors.shareThis = function() {
-  // Check the kill-switch.
-  if (Drupal.settings.shareThisEnabled != true) {
-    // See if there are any actual elements to apply the ShareThis to.
-    if (Drupal.settings.shareThisUrl) {
-      // Process ShareThis after the API is loaded.
-      jQuery.ajax({
-        type: "GET",
-        url: Drupal.settings.shareThisUrl,
-        dataType: "script",
-        cache: true,
-        success: function() {
-          // Prepare the ShareThis API.
-          SHARETHIS.toolbar = true;
-          SHARETHIS.onReady();
+  // Retrieve the ShareThis URL code, if desired.
+  var code = Drupal.settings.sharethisUrl || null;
 
-          // Say that the ShareThis API is now available and recall the behaviors.
-          Drupal.settings.shareThisEnabled = true;
-          Drupal.behaviors.shareThis();
-        }
-      });
-    }
-  }
-  else {
-    // Process each of the ShareThis links.
-    $('.sharethis-sharethis:not(.sharethis-processed)').each(function(index, element) {
-      // Obtain the element and construct the options.
-      element = $(element);
-      var options = {
-        'url': element.attr('href'),
-        'title': element.attr('title')
-      };
-
-      // Create the entry and attach it to the link.
-      var share = SHARETHIS.addEntry(options);
-      share.attachButton(element.get(0));
-
-      // State that the object was processed and deactivate the default click event.
-      element.addClass('sharethis-processed').click(function() {
-        return false;
-      });
-    });
-  }
+  // Process each of the ShareThis links.
+  $('.sharethis-sharethis:not(.sharethis-processed)').addClass('sharethis-processed').sharethis(code);
 };
Index: sharethis.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sharethis/Attic/sharethis.module,v
retrieving revision 1.1.2.8
diff -u -r1.1.2.8 sharethis.module
--- sharethis.module	18 Mar 2009 16:01:36 -0000	1.1.2.8
+++ sharethis.module	13 Apr 2009 14:40:15 -0000
@@ -39,48 +39,12 @@
     'page arguments' => array('sharethis_admin_settings'),
     'access arguments' => array('administer share'),
     'type' => MENU_NORMAL_ITEM,
+    'file' => 'sharethis.admin.inc',
   );
   return $items;
 }
 
 /**
- * Menu callback; Settings administration.
- */
-function sharethis_admin_settings() {
-  $form['sharethis_sharethis_this_node_types'] = array(
-    '#type' => 'checkboxes',
-    '#title' => t('Node types'),
-    '#description' => t('Choose which node types to display the ShareThis button on.'),
-    '#default_value' => variable_get('sharethis_sharethis_this_node_types', array()),
-    '#options' => node_get_types('names'),
-  );
-  $form['sharethis_teaser'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Display in teaser view'),
-    '#description' => t('If enabled, the ShareThis links will appear in node teasers. If disabled, they will only appear on the full node page.'),
-    '#default_value' => variable_get('sharethis_teaser', 1),
-  );
-  $form['sharethis_sharethis_this_where'] = array(
-    '#type' => 'select',
-    '#title' => t('Where to display'),
-    '#description' => t('Select where you would like the ShareThis link to appear.'),
-    '#default_value' => variable_get('sharethis_sharethis_this_where', 'links'),
-    '#options'=> array(
-      'links' => t('Links'),
-      'nodes' => t('Nodes'),
-    ),
-  );
-  $form['sharethis_sharethis_weight'] = array(
-    '#type' => 'weight',
-    '#delta' => 10,
-    '#description' => t('Only applies when node type display is selected.'),
-    '#title' => t('Weight'),
-    '#default_value' => variable_get('sharethis_sharethis_weight', 0),
-  );
-  return system_settings_form($form);
-}
-
-/**
  * Implementation of hook_nodeapi().
  */
 function sharethis_nodeapi(&$node, $op, $teaser, $page) {
@@ -112,11 +76,18 @@
     if (!$teaser || variable_get('sharethis_teaser', 1)) {
       if (variable_get('sharethis_sharethis_this_where', 'links') == 'links') {
         if (in_array($node->type, variable_get('sharethis_sharethis_this_node_types', array()), TRUE)) {
+          // Make sure the ShareThis JavaScript is made available.
+          sharethis_add_js();
+
           // Create the ShareThis element.
-          $sharethis = theme('sharethis', $node->title, url('node/'. $node->nid, array('absolute' => TRUE)));
-          $links['sharethis_sharethis_this'] = array(
-            'title' => $sharethis,
-            'html' => TRUE,
+          $links['sharethis_sharethis'] = array(
+            'title' => t('ShareThis'),
+            'href' => url('node/'. $node->nid, array('absolute' => TRUE)),
+            'attributes' => array(
+              'class' => 'sharethis-sharethis', // This is the class that is processed.
+              'title' => check_plain($node->title),
+              'rel' => 'nofollow',
+            ),
           );
           return $links;
         }
@@ -132,9 +103,19 @@
 	// Be sure to add the ShareThis header code only once.
   static $sharethis_added = FALSE;
   if ($sharethis_added === FALSE) {
-  	// Register the Drupal ShareThis behaviors and add the ShareThis URL.
-    drupal_add_js(drupal_get_path('module', 'sharethis') . '/sharethis.js');
-    drupal_add_js(array('shareThisUrl' => 'http://w.sharethis.com/button/sharethis.js#button=false'), 'setting');
+  	// Adds the ShareThis jQuery plugin as well as the related Drupal JavaScript behavior and CSS.
+  	$path = drupal_get_path('module', 'sharethis');
+    drupal_add_js($path . '/sharethis/jquery.sharethis.js');
+    drupal_add_js($path . '/sharethis.js');
+    drupal_add_css($path . '/sharethis.css');
+
+    // Add the ShareThis code if desired.
+    $code = variable_get('sharethis_code', '');
+    if (!empty($code)) {
+      $code = str_replace('<script type="text/javascript" src="', '', $code);
+      $code = str_replace('"></script>', '', $code);
+      drupal_add_js(array('sharethisUrl' => $code), 'setting');
+    }
 
     // Flag that the JavaScript has been registered.
     $sharethis_added = TRUE;
@@ -177,8 +158,9 @@
   return l(t('ShareThis'), $url, array(
     'absolute' => TRUE,
     'attributes' => array(
-      'class' => 'sharethis-sharethis stbutton stico_default',
+      'class' => 'sharethis-sharethis',
       'title' => $title,
+      'rel' => 'nofollow',
     ),
   ));
 }
Index: sharethis/jquery.sharethis.js
===================================================================
RCS file: sharethis/jquery.sharethis.js
diff -N sharethis/jquery.sharethis.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sharethis/jquery.sharethis.js	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,94 @@
+/**
+ * jQuery ShareThis
+ * 
+ * A jQuery Plugin to provide easy use of the ShareThis web
+ * service.
+ *
+ * $Id$
+ *
+ * Copyright (c) 2009 Rob Loach (http://robloach.net) Dual licensed under the
+ * MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * Built on top of the jQuery library http://jquery.com
+ */
+
+/**
+ * The ShareThis jQuery plugin.
+ *
+ * Usage:
+ * <a href="http://example.com" title="Example" class="sharethis">ShareThis</a>
+ * $('a.sharethis').sharethis();
+ *
+ * The URL and the title will be taken from the HREF and the TITLE attributes.
+ */
+(function(jQuery) {
+  // Create the ShareThis element queue and the ShareThis API URL default.
+  jQuery.sharethisQueue = [];
+  jQuery.sharethisUrl = "http://w.sharethis.com/button/sharethis.js#";
+
+  // The $().sharethis() function.
+  jQuery.fn.sharethis = function(sharethisUrl) {
+    // Add the elements to the queue.
+    jQuery.sharethisQueue = jQuery.sharethisQueue.concat(this);
+
+    // Set a kill switch so that the API isn't loaded twice.
+    if (jQuery.fn.sharethis.loaded || true) {
+      jQuery.fn.sharethis.loaded = false;
+
+      // Use the provided URL, or the default one.
+      jQuery.sharethisUrl = sharethisUrl || jQuery.sharethisUrl;
+
+      // Make the AJAX call to get the ShareThis API.
+      jQuery.ajax( {
+        type :'GET',
+        url : jQuery.sharethisUrl + '&amp;button=false',
+        dataType :'script',
+        cache :true,
+        success : function() {
+          // Prepare the ShareThis API and state that it's ready.
+          SHARETHIS.toolbar = true;
+          SHARETHIS.onReady();
+          jQuery.fn.sharethis.loadedShareThis = true;
+
+          // Process the element queue once the ShareThis API is loaded.
+          jQuery.shareThis();
+        }
+      });
+    }
+    // If the library has been loaded, then just process the elements.
+    else if (jQuery.fn.sharethis.loadedShareThis || false) {
+      jQuery.shareThis();
+    }
+    return this;
+  };
+
+  /**
+   * The jQuery.sharethis() function will process through the queue
+   * and create the elements.
+   */
+  jQuery.shareThis = function() {
+    // Loop through the process queue.
+    jQuery.each(jQuery.sharethisQueue, function(i, objects) {
+      jQuery.each(objects, function(i, object) {
+        // Construct the options from the element.
+        var element = jQuery(object);
+        var options = {
+          'url' :element.attr('href'),
+          'title' :element.attr('title'),
+          icon: 'http://static.ak.fbcdn.net/favicon.ico'
+        };
+
+        // Create the entry and attach it to the link.
+        var share = SHARETHIS.addEntry(options, {button:false});
+        share.attachButton(element.get(0));
+
+        // Deactivate the default click event.
+        element.click( function() {
+          return false;
+        });
+      });
+    });
+    // Clear the process queue.
+    jQuery.sharethis = [];
+  }
+})(jQuery);
Index: sharethis.admin.inc
===================================================================
RCS file: sharethis.admin.inc
diff -N sharethis.admin.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sharethis.admin.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,50 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Provides the administration settings for ShareThis.
+ */
+
+/**
+ * Menu callback; Settings administration.
+ */
+function sharethis_admin_settings() {
+  $form['sharethis_code'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Code'),
+    '#default_value' => variable_get('sharethis_code', ''),
+    '#description' => t('The <a href="@code">Get the Button code</a> provided by ShareThis. If this is not given, the default one will be used.', array('@code' => 'http://sharethis.com/publishers/getbutton/')),
+  );
+  $form['sharethis_sharethis_this_node_types'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Node types'),
+    '#description' => t('Choose which node types to display the ShareThis button on.'),
+    '#default_value' => variable_get('sharethis_sharethis_this_node_types', array()),
+    '#options' => node_get_types('names'),
+  );
+  $form['sharethis_teaser'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Display in teaser view'),
+    '#description' => t('If enabled, the ShareThis links will appear in node teasers. If disabled, they will only appear on the full node page.'),
+    '#default_value' => variable_get('sharethis_teaser', 1),
+  );
+  $form['sharethis_sharethis_this_where'] = array(
+    '#type' => 'select',
+    '#title' => t('Where to display'),
+    '#description' => t('Select where you would like the ShareThis link to appear.'),
+    '#default_value' => variable_get('sharethis_sharethis_this_where', 'links'),
+    '#options'=> array(
+      'links' => t('Links'),
+      'nodes' => t('Nodes'),
+    ),
+  );
+  $form['sharethis_sharethis_weight'] = array(
+    '#type' => 'weight',
+    '#delta' => 10,
+    '#description' => t('Only applies when node type display is selected.'),
+    '#title' => t('Weight'),
+    '#default_value' => variable_get('sharethis_sharethis_weight', 0),
+  );
+  return system_settings_form($form);
+}
Index: sharethis.css
===================================================================
RCS file: sharethis.css
diff -N sharethis.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sharethis.css	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,7 @@
+/* $Id$ */
+
+a.sharethis-sharethis {
+  padding-left: 20px;
+  padding-bottom: 4px;
+  background: transparent url("sharethis/sharethis.png") no-repeat top left;
+}
Index: sharethis/jquery.sharethis.html
===================================================================
RCS file: sharethis/jquery.sharethis.html
diff -N sharethis/jquery.sharethis.html
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sharethis/jquery.sharethis.html	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+  <title>jQuery ShareThis Plugin</title>
+
+  <!--
+    Reference jQuery from the Google CDN.
+  -->
+  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
+
+  <!--
+    Reference the jQuery ShareThis plugin.
+  -->
+  <script src="jquery.sharethis.js" type="text/javascript"></script>
+
+  <!--
+   Some styling for the ShareThis icon.
+  -->
+  <style type="text/css">
+    a.sharethis { text-decoration: none;}
+    img { border: 0px; }
+  </style>
+</head>
+<body>
+  <h1>jQuery ShareThis Plugin</h1>
+  <p><a href="http://sharethis.com" class="sharethis">ShareThis</a> is a web service that provides an easy way of sharing data. The jQuery ShareThis plugin uses jQuery to stick the ShareThis widget on any element. Using this also means that the ShareThis API will be loaded after the whole page has been rendered, making the page seem to load faster.</p>
+
+  <!--
+    Reference the jQuery ShareThis plugin.
+  -->
+  <p><a href="http://drupal.org/project/sharethis" class="sharethis" title="The Drupal ShareThis Module"><img src="sharethis.png" /> ShareThis</a></p>
+
+  <h2>Usage</h2>
+  <pre>$('a.sharethis').sharethis();</pre>
+  <p>Calling the jQuery sharethis() function will create a ShareThis widget on the given object. It will use the href and title tags to create the widget.</p>
+
+  <!--
+    Create the ShareThis widget.
+    It uses the HREF and TITLE from the link to create the widget.
+  -->
+  <script type="text/javascript">
+    $('a.sharethis').sharethis();
+  </script>
+
+  <h2>Advanced</h2>
+  <p>Note that you can pass the ShareThis API URL from <a href="http://sharethis.com/publishers/getbutton/">ShareThis's Get the Button</a> for the sharethis() call, and the given settings will be set.</p>
+  <pre>$('a.sharethis').sharethis('http://w.sharethis.com/button/sharethis.js#headerTitle=ShareThis%20Widget');</pre>
+
+</body>
+</html>
