New option to create a button with out a dropdown 6.x-2.3
authorVesa Palmu
Sat, 6 Sep 2008 09:26:04 +0000 (09:26 +0000)
committerVesa Palmu
Sat, 6 Sep 2008 09:26:04 +0000 (09:26 +0000)
addthis.admin.inc
addthis.module

index d98082d..b400699 100644 (file)
@@ -69,6 +69,12 @@ function addthis_admin_settings() {
     '#collapsible'  => TRUE,
     '#collapsed'    => TRUE,
   );
+  $form['addthis_widget_settings']['addthis_dropdown_disabled'] = array(
+    '#type'          => 'checkbox',
+    '#title'         => t('Disable dropdown'),
+    '#default_value' => variable_get('addthis_dropdown_disabled', '0'),
+    '#description'   => t('You can disable the dropdown for selecting where to share your link and use a pop-up window instead. This can be useful if the button is for example located next to a flash object.'),
+  );
   $form['addthis_widget_settings']['addthis_logo'] = array(
     '#type'          => 'textfield',
     '#title'         => t('Logo url'),
index 0ecb1f4..42bafd4 100644 (file)
@@ -97,18 +97,31 @@ function _addthis_create_button($node=NULL, $teaser = FALSE) {
       ), 'inline');
   }
 
-  return ( sprintf('
-    <div class="addthis"><a href="http://www.addthis.com/bookmark.php"
-      onmouseover="return addthis_open(this, \'\', \'%s\', \'%s\')"
-      onmouseout="addthis_close()"
-      onclick="return addthis_sendto()"><img src="%s" width="%d" height="%d" %s /></a></div>
-    <script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script>
-    ',
-    $teaser ? url('node/'.$node->nid, array('absolute' => 1) ) : '[URL]',
-    $teaser ? addslashes($node->title) : '[TITLE]',
-    variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif'),
-    variable_get('addthis_image_width', '125'),
-    variable_get('addthis_image_height', '16'),
-    variable_get('addthis_image_attributes', 'alt=""')
-  ));
+  if (variable_get('addthis_dropdown_disabled', '0')) {
+    return ( sprintf('
+      <div class="addthis"><a href="http://www.addthis.com/bookmark.php"
+        onclick="addthis_url   = location.href; addthis_title = document.title; return addthis_click(this);">
+      <img src="%s" width="%d" height="%d" %s /></a></div>
+      ',
+      variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif'),
+      variable_get('addthis_image_width', '125'),
+      variable_get('addthis_image_height', '16'),
+      variable_get('addthis_image_attributes', 'alt=""')
+    ));
+  } else {
+    return ( sprintf('
+      <div class="addthis"><a href="http://www.addthis.com/bookmark.php"
+        onmouseover="return addthis_open(this, \'\', \'%s\', \'%s\')"
+        onmouseout="addthis_close()"
+        onclick="return addthis_sendto()"><img src="%s" width="%d" height="%d" %s /></a></div>
+      <script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script>
+      ',
+      $teaser ? url('node/'.$node->nid, array('absolute' => 1) ) : '[URL]',
+      $teaser ? addslashes($node->title) : '[TITLE]',
+      variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif'),
+      variable_get('addthis_image_width', '125'),
+      variable_get('addthis_image_height', '16'),
+      variable_get('addthis_image_attributes', 'alt=""')
+    ));
+  }
 }