summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addthis.admin.inc6
-rw-r--r--addthis.module41
2 files changed, 33 insertions, 14 deletions
diff --git a/addthis.admin.inc b/addthis.admin.inc
index d98082d..b400699 100644
--- a/addthis.admin.inc
+++ b/addthis.admin.inc
@@ -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'),
diff --git a/addthis.module b/addthis.module
index 0ecb1f4..42bafd4 100644
--- a/addthis.module
+++ b/addthis.module
@@ -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=""')
+ ));
+ }
}