WordPress Share Buttons Plugin – AddThis - Version 3.5

Version Description

  • Drag and drop customization of buttons
  • Better preview of buttons
  • Bug fixes
Download this release

Release Info

Developer srijith.v
Plugin Icon 128x128 WordPress Share Buttons Plugin – AddThis
Version 3.5
Comparing to
See all releases

Code changes from version 3.1 to 3.5

addthis_settings_functions.php CHANGED
@@ -174,15 +174,8 @@ function _addthis_swap_first_two_elements (&$array, $key)
174
  <td id="<?php echo $name ?>" colspan="2">
175
  <fieldset>
176
  <legend>&nbsp;<strong><?php _e("$legend Sharing Tool", 'addthis_trans_domain') ?></strong> &nbsp;</legend>
177
-
178
  <?php
179
- $sharing_checked = $option == 'none' ? '' : 'checked="checked"';
180
- echo "<div class='enable-sharing-tool'><input type='checkbox' {$sharing_checked} value='{$option}' id='enable_{$name}' name='addthis_settings[enable_{$name}]' />
181
- <label for='enable_{$name}'>";
182
- echo _e('Enable the following sharing tool at the ', 'addthis_trans_domain' );
183
- echo '<strong>';
184
- echo _e($legend, 'addthis_trans_domain');
185
- echo '</strong> of posts:</label></div>';
186
 
187
  $imgLocationBase = apply_filters( 'at_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
188
  $imgLocationBase = apply_filters( 'addthis_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
@@ -197,10 +190,27 @@ function _addthis_swap_first_two_elements (&$array, $key)
197
  continue;
198
  echo "<div class='$name"."_option select_row'><span class='radio'><input $checked type='radio' value='".$k."' id='{$k}_{$name}' name='addthis_settings[$name]' /></span><label for='{$k}_{$name}'> <img alt='".$k."' src='". $imgLocationBase . $v['img'] ."' align='left' /></label><div class='clear'></div></div>";
199
  }
200
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  $class = 'hidden';
202
  $checked = '';
203
- if ($option == 'custom' || ($option == 'none' && 'custom' == $addthis_default_options[$name] ) ){
204
  $checked = 'checked="checked"';
205
  $class = '';
206
 
@@ -223,31 +233,73 @@ function _addthis_swap_first_two_elements (&$array, $key)
223
 
224
  }
225
  echo "</select><br/><span class='description'>Enter the number of automatically user-personalized items you want displayed</span></li>";
226
- $custom_more = ( $custom_more ) ? 'checked="checked"' : '';
227
 
228
  echo "<li><input $custom_more type='checkbox' class='at_do_custom' name='addthis_settings[$name"."_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic logo that offers sharing to over 330 destinations</span></li>";
229
  echo "</ul></div>";
 
230
  }
231
-
232
- $checked = '';
233
- if ($option == 'custom_string' || $option == 'none' && 'custom_strin' == $addthis_default_options[$name] )
234
- {
235
- $checked = 'checked="checked"';
236
- }
237
-
238
- echo "<div class='$name"."_option select_row'><span class='radio mt4'><input $checked type='radio' value='custom_string' name='addthis_settings[$name]' id='$name"."_custom_string' /></span> <label for='{$name}_custom_string'>Custom button</label><div class='clear'></div></div>";
239
- _e( sprintf("<div style='max-width: 748px;margin-left:20px' class='%s_custom_string_input'> This text box allows you to enter any AddThis markup that you wish. To see examples of what you can do, visit <a href='https://www.addthis.com/get/sharing'>AddThis.com Sharing Tools</a> and select any sharing tool. You can also check out our <a href='http://support.addthis.com/customer/portal/articles/381263-addthis-client-api#rendering-decoration'>Client API</a>. For any help you may need, please visit <a href='http://support.addthis.com'>AddThis Support</a></div>", $name ),'addthis_trans_domain');
240
- echo "<textarea style='max-width:748px;margin-left:20px' rows='5' cols='120' name='addthis_settings[$name"."_custom_string]' class='$name"."_custom_string_input' />".esc_textarea($custom_string)."</textarea>";
241
-
242
- echo '</div>';
243
  ?>
244
-
245
- </fieldset>
246
- </td>
247
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
 
249
  <?php
250
- }
251
-
252
-
253
- ?>
174
  <td id="<?php echo $name ?>" colspan="2">
175
  <fieldset>
176
  <legend>&nbsp;<strong><?php _e("$legend Sharing Tool", 'addthis_trans_domain') ?></strong> &nbsp;</legend>
177
+ <div style="float: left; width: 395px;">
178
  <?php
 
 
 
 
 
 
 
179
 
180
  $imgLocationBase = apply_filters( 'at_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
181
  $imgLocationBase = apply_filters( 'addthis_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
190
  continue;
191
  echo "<div class='$name"."_option select_row'><span class='radio'><input $checked type='radio' value='".$k."' id='{$k}_{$name}' name='addthis_settings[$name]' /></span><label for='{$k}_{$name}'> <img alt='".$k."' src='". $imgLocationBase . $v['img'] ."' align='left' /></label><div class='clear'></div></div>";
192
  }
193
+ $ischecked = '';
194
+ if ($option == 'disable' ){
195
+ $ischecked = 'checked="checked"';
196
+ }
197
+ echo "<div class='$name"."_option select_row'><span class='radio'><input type='radio' $ischecked value='disable' id='disable_{$name}' name='addthis_settings[$name]' /></span><label for='disable_{$name}'>Do not show a sharing tool at the <strong>$legend</strong> of posts</label></div>";
198
+
199
+ if ($options[$name.'_custom_string'] != "") {
200
+ $checked = '';
201
+ if ($option == 'custom_string' || $option == 'none' && 'custom_strin' == $addthis_default_options[$name] )
202
+ {
203
+ $checked = 'checked="checked"';
204
+ }
205
+
206
+ echo "<div class='$name"."_option select_row'><span class='radio mt4'><input $checked type='radio' value='custom_string' name='addthis_settings[$name]' id='$name"."_custom_string' /></span> <label for='{$name}_custom_string'>Custom button</label><div class='clear'></div></div>";
207
+ _e( sprintf("<div style='max-width: 555px;margin-left:20px' class='%s_custom_string_input'> This text box allows you to enter any AddThis markup that you wish. To see examples of what you can do, visit <a href='https://www.addthis.com/get/sharing'>AddThis.com Sharing Tools</a> and select any sharing tool. You can also check out our <a href='http://support.addthis.com/customer/portal/articles/381263-addthis-client-api#rendering-decoration'>Client API</a>. For any help you may need, please visit <a href='http://support.addthis.com'>AddThis Support</a></div>", $name ),'addthis_trans_domain');
208
+ echo "<textarea style='max-width:555px;margin-left:20px' rows='5' cols='100' name='addthis_settings[$name"."_custom_string]' class='$name"."_custom_string_input' />".esc_textarea($custom_string)."</textarea>";
209
+ }
210
+
211
  $class = 'hidden';
212
  $checked = '';
213
+ if ($option == 'custom' || ($option == 'none' && 'custom' == $addthis_default_options[$name] ) ) {
214
  $checked = 'checked="checked"';
215
  $class = '';
216
 
233
 
234
  }
235
  echo "</select><br/><span class='description'>Enter the number of automatically user-personalized items you want displayed</span></li>";
236
+ $custom_more = ( $custom_more ) ? 'checked="checked"' : '';
237
 
238
  echo "<li><input $custom_more type='checkbox' class='at_do_custom' name='addthis_settings[$name"."_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic logo that offers sharing to over 330 destinations</span></li>";
239
  echo "</ul></div>";
240
+
241
  }
242
+ echo '</div>';
 
 
 
 
 
 
 
 
 
 
 
243
  ?>
244
+ </div>
245
+ <div class="<?php echo $name;?>_button_set select_row" style="float: left; width: 480px;">
246
+ <div id="<?php echo $name;?>_custom_btns">
247
+ <?php //if ($name == "above") { ?>
248
+ <span class="<?php echo $name;?>-smart-sharing-container">
249
+ <p id="customizedMessage" class="mb40 personalizedMessage customize-message-section customize-your-buttons" style="display:none;">
250
+ Your buttons are currently customized. <a href="#" class="<?php echo $name;?>-customize-sharing-link customize-your-buttons">Show customization.</a>
251
+ </p>
252
+ <p id="personalizedMessage" class="mb40 personalizedMessage customize-message-section customize-your-buttons">
253
+ AddThis boosts sharing by automatically showing the right buttons to each user based on their location and activity across the web. <a href="#" class="<?php echo $name;?>-customize-sharing-link customize-your-buttons">Disable and select your own buttons.</a>
254
+ </p>
255
+ <p class="mb40 smart-sharing-link customize-message-section">Your buttons are currently customized. <a href="#" class="<?php echo $name;?>-customize-sharing-link smart-sharing-link">Let AddThis choose instead and boost sharing</a>
256
+ <span class="row-right" data-content="Smartest sharing buttons on the web. Automated to show each user the services that they use most based on their location and activity across the web." data-original-title="Smart Sharing."> (<a href="#">?</a>)</span>
257
+ </p>
258
+ <span class="smart-sharing-inner-container">
259
+ <p class="hide">
260
+ <label>
261
+ <input type="radio" checked="checked" name="<?php echo $name;?>-sharing" id="<?php echo $name;?>-enable-smart-sharing" value="<?php echo $name;?>-enable-smart-sharing"/> Use Smart Buttons <strong>(Recommended)</strong>
262
+ </label>
263
+ <label>
264
+ <input type="radio" name="<?php echo $name;?>-sharing" id="<?php echo $name;?>-disable-smart-sharing"> Customize your buttons
265
+ </label>
266
+ </p>
267
+ <div class="customize-buttons">
268
+ <div class="sharing-buttons">
269
+ <h4 class="sortable-heading">Button Options</h4>
270
+ <input type="text" class="sharing-buttons-search" placeholder="Find a service" maxlength="20" size="30" style="width: 230px; height: 41px; margin: 0;">
271
+ <ul class="sortable"></ul>
272
+ </div>
273
+ <div class="selected-services">
274
+ <h4 class="sortable-heading">Selected Buttons</h4>
275
+ <ul class="sortable" data-type="addthisButtons"></ul>
276
+ </div>
277
+ </div>
278
+ <div class="vertical-drag">
279
+ <i class="icon-arrow-up"></i>
280
+ <i class="icon-arrow-down"></i>
281
+ <p>Drag up or down to reorder services</p>
282
+ </div>
283
+ <div class="horizontal-drag">
284
+ <i class="icon-arrow-right"></i>
285
+ <p>Drag across to add service</p>
286
+ </div>
287
+ <a href="#" class="restore-default-options" style="float: left; padding-left: 100px;">Restore default options</a>
288
+ <?php $list = $name.'_chosen_list'; ?>
289
+ <input type="hidden" id="<?php echo $name?>-chosen-list" name="addthis_settings[<?php echo $name;?>_chosen_list]" value="<?php echo $options[$list];?>"/>
290
+ </span>
291
+ </span>
292
+ <script type="text/javascript">
293
+ window.page = 'sharing-buttons';
294
+ //$('.follow-tooltip').popover({ trigger: "hover" });
295
+ </script>
296
+ <!-- <div id="atcode"></div> -->
297
+ <?php //} ?>
298
+ </div>
299
+ </div>
300
+ </fieldset>
301
+ </td>
302
+ </tr>
303
 
304
  <?php
305
+ }
 
 
 
addthis_social_widget.php CHANGED
@@ -23,7 +23,7 @@
23
  * Plugin Name: AddThis Social Bookmarking Widget
24
  * Plugin URI: http://www.addthis.com
25
  * Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
26
- * Version: 3.1
27
  *
28
  * Author: The AddThis Team
29
  * Author URI: http://www.addthis.com/blog
@@ -46,12 +46,13 @@ function addthis_early(){
46
 
47
 
48
  define( 'addthis_style_default' , 'fb_tw_p1_sc');
49
- define( 'ADDTHIS_PLUGIN_VERSION' , '3.1');
50
- define( 'ADDTHIS_PRODUCT_VERSION' , 'wpp-3.1');
51
  define( 'ADDTHIS_ATVERSION', '300');
52
  define( 'ADDTHIS_ATVERSION_MANUAL_UPDATE', -1);
53
  define( 'ADDTHIS_ATVERSION_AUTO_UPDATE', 0);
54
  define( 'ADDTHIS_ATVERSION_REVERTED', 1);
 
55
 
56
  $addthis_settings = array();
57
  $addthis_settings['isdropdown'] = 'true';
@@ -62,6 +63,7 @@ $addthis_settings['username'] = '';
62
  $addthis_settings['fallback_username'] = '';
63
  $addthis_settings['style'] = 'share';
64
  $addthis_settings['atversion'] = ADDTHIS_ATVERSION;
 
65
 
66
  $addthis_languages = array(''=>'Automatic','af'=>'Afrikaaner', 'ar'=>'Arabic', 'zh'=>'Chinese', 'cs'=>'Czech', 'da'=>'Danish', 'nl'=>'Dutch', 'en'=>'English', 'fa'=>'Farsi', 'fi'=>'Finnish', 'fr'=>'French', 'ga'=>'Gaelic', 'de'=>'German', 'el'=>'Greek', 'he'=>'Hebrew', 'hi'=>'Hindi', 'it'=>'Italian', 'ja'=>'Japanese', 'ko'=>'Korean', 'lv'=>'Latvian', 'lt'=>'Lithuanian', 'no'=>'Norwegian', 'pl'=>'Polish', 'pt'=>'Portugese', 'ro'=>'Romanian', 'ru'=>'Russian', 'sk'=>'Slovakian', 'sl'=>'Slovenian', 'es'=>'Spanish', 'sv'=>'Swedish', 'th'=>'Thai', 'ur'=>'Urdu', 'cy'=>'Welsh', 'vi'=>'Vietnamese');
67
 
@@ -75,6 +77,7 @@ $addthis_styles = array(
75
  'bookmark-small' => array('img'=>'sm-bookmark-en.gif', 'w'=>83, 'h'=>16),
76
  'plus' => array('img'=>'sm-plus.gif', 'w'=>16, 'h'=>16)
77
  );
 
78
  $addthis_options = get_option('addthis_settings');
79
  $atversion = is_array($addthis_options) && array_key_exists('atversion_reverted', $addthis_options) && $addthis_options['atversion_reverted'] == 1 ? $addthis_options['atversion'] : ADDTHIS_ATVERSION;
80
 
@@ -185,7 +188,14 @@ if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters(
185
 
186
  if ($showonarchives = get_option('addthis_showonarchives'))
187
  $addthis_new_options['addthis_showonarchives'] = $showonarchives;
188
-
 
 
 
 
 
 
 
189
  if (get_option('addthis_showonposts') != true)
190
  $addthis_new_options['below'] = 'none';
191
  elseif (get_option('addthis_sidebar_only') == true)
@@ -232,6 +242,8 @@ if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters(
232
  delete_option('addthis_showonpages');
233
  delete_option('addthis_showoncats');
234
  delete_option('addthis_showonarchives');
 
 
235
  delete_option('addthis_style');
236
  delete_option('addthis_header_background');
237
  delete_option('addthis_header_color');
@@ -369,14 +381,36 @@ function addthis_custom_toolbox($options, $url, $title)
369
 
370
  $button = '<div class="'.$outerClasses.'" '.$identifier.' >';
371
 
372
- if (isset($options['services']) )
373
- {
 
 
 
 
 
 
 
 
374
  $services = explode(',', $options['services']);
375
  foreach ($services as $service)
376
  {
377
  $service = trim($service);
378
- if ($service == 'more')
379
- $button .= '<a class="addthis_button_compact"></a>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
  else
381
  $button .= '<a class="addthis_button_'.strtolower($service).'"></a>';
382
  }
@@ -450,7 +484,7 @@ function addthis_admin_notices(){
450
  elseif ( ( ! isset($options['username']) || $options['username'] == false) && ! get_user_meta($user_id, 'addthis_nag_username_ignore'))
451
  {
452
  echo '<div class="updated addthis_setup_nag"><p>';
453
- printf( __('Sign up for AddThis and add your username/password to recieve analytics about how people are sharing your content.<br /> <a href="%1$s">Enter username and password</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%2$s" target="_blank">Sign Up</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%3$s">Ignore this notice</a>'),
454
  admin_url('options-general.php?page=' . basename(__FILE__) ),
455
  'https://www.addthis.com/register?profile=wpp',
456
  '?addthis_nag_username_ignore=0');
@@ -856,6 +890,7 @@ global $addthis_styles, $addthis_new_styles;
856
 
857
  $styles = array_merge($addthis_styles, $addthis_new_styles);
858
 
 
859
 
860
  $options = array();
861
 
@@ -882,13 +917,12 @@ if ( isset($data['wpfooter']))
882
  $options['wpfooter'] = (bool) $data['wpfooter'];
883
 
884
 
885
- if (! isset($data['enable_above']) ){
886
- $options['above'] = 'none';
887
- }
888
- elseif ( isset ($data['show_above']) )
889
  $options['above'] = 'none';
890
  elseif ( isset($styles[$data['above']]) )
891
  $options['above'] = $data['above'];
 
 
892
  elseif ($data['above'] == 'none')
893
  {
894
  $options['above'] = 'none';
@@ -919,13 +953,12 @@ elseif ($data['above'] == 'custom_string')
919
 
920
  }
921
 
922
- if ( ! isset($data['enable_below'] )){
923
- $options['below'] = 'none';
924
- }
925
- elseif ( isset ($data['show_below']) )
926
  $options['below'] = 'none';
927
  elseif ( isset($styles[$data['below']]) )
928
  $options['below'] = $data['below'];
 
 
929
  elseif ($data['below'] == 'none')
930
  {
931
  $options['below'] = 'none';
@@ -953,12 +986,11 @@ elseif ($data['below'] == 'custom_string')
953
  $options['below_custom_string'] = addthis_kses($data['below_custom_string'], $below_custom_styles);
954
  }
955
 
956
-
957
  if (isset($data['addthis_copytrackingremove']) && $data['addthis_copytrackingremove'] == true)
958
  unset($data['addthis_copytracking1']);
959
 
960
  // All the checkbox fields
961
- foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats', 'addthis_showonexcerpts', 'addthis_addressbar','addthis_508','addthis_copytracking2' ) as $field)
962
  {
963
  if ( isset($data[$field]) && $data[$field] == true)
964
  $options[$field] = true;
@@ -1033,6 +1065,21 @@ if (isset ($data['addthis_share_json']) && strlen($data['addthis_share_json']) !
1033
  $options['addthis_share_json'] = sanitize_text_field($data['addthis_share_json']);
1034
  }
1035
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1036
 
1037
  return $options;
1038
 
@@ -1063,8 +1110,12 @@ function addthis_add_content_filters()
1063
  if ( ! empty( $options) ){
1064
  if ( isset($options['addthis_showonexcerpts']) && $options['addthis_showonexcerpts'] == true )
1065
  add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt', 11);
 
 
 
 
 
1066
 
1067
- add_filter('the_content', 'addthis_display_social_widget', 15);
1068
  }
1069
  }
1070
 
@@ -1324,7 +1375,6 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
1324
  else
1325
  $options = get_option('addthis_settings');
1326
 
1327
-
1328
  if ( is_home() || is_front_page() ) {
1329
  if (isset($options['addthis_showonhome']) && $options['addthis_showonhome'] == true ) {
1330
  if (isset($options['addthis_showonexcerpts']) && $options['addthis_showonexcerpts'] == true ) {
@@ -1359,7 +1409,7 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
1359
  elseif ( is_category() )
1360
  $display = (isset($options['addthis_showoncats']) && $options['addthis_showoncats'] == true ) ? true : false;
1361
  // Pages
1362
- elseif ( is_page() )
1363
  $display = (isset($options['addthis_showonpages']) && $options['addthis_showonpages'] == true) ? true: false;
1364
  // Single pages (true by default and design)
1365
  elseif ( is_single() )
@@ -1385,11 +1435,11 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
1385
  $below = '';
1386
 
1387
  // Still here? Well let's add some social goodness
1388
- if ( isset( $options['above'] ) && $options['above'] != 'none' && $display )
1389
  {
1390
  if (isset ($styles[$options['above']]))
1391
  {
1392
- $above = apply_filters('addthis_above_content', $styles[$options['above']]['src']);
1393
  }
1394
  elseif ($options['above'] == 'custom')
1395
  {
@@ -1399,20 +1449,34 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
1399
  if ($options['above_do_custom_preferred'])
1400
  $aboveOptions['preferred'] = $options['above_custom_preferred'];
1401
  $aboveOptions['more'] = $options['above_custom_more'];
 
1402
  $above = apply_filters('addthis_above_content', addthis_custom_toolbox($aboveOptions, $url, $title) );
1403
  }
1404
- elseif( $options['above'] == 'custom_string')
1405
  {
1406
  $custom = preg_replace( '/<\s*div\s*/', '<div %s ', $options['above_custom_string'] );
1407
  $above = apply_filters('addthis_above_content', $custom);
1408
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1409
  }
1410
  elseif ($display)
1411
  $above = apply_filters('addthis_above_content','' );
1412
  else
1413
  $above = '';
1414
 
1415
- if ( isset( $options['below'] ) && $options['below'] != 'none' && $display && ! $below_excerpt )
1416
  {
1417
  if (isset ($styles[$options['below']]))
1418
  {
@@ -1424,13 +1488,27 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
1424
  $belowOptions['services'] = $options['below_custom_services'];
1425
  $belowOptions['preferred'] = $options['below_custom_preferred'];
1426
  $belowOptions['more'] = $options['below_custom_more'];
 
1427
  $below = apply_filters('addthis_below_content', addthis_custom_toolbox($belowOptions, $url, $title) );
1428
  }
1429
- elseif( $options['below'] == 'custom_string')
1430
  {
1431
  $custom = preg_replace( '/<\s*div\s*/', '<div %s ', $options['below_custom_string'] );
1432
  $below = apply_filters('addthis_below_content', $custom);
1433
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1434
  }
1435
  elseif ($below_excerpt && $display && $options['below'] != 'none' )
1436
  {
@@ -1444,7 +1522,6 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
1444
  $below = '';
1445
 
1446
 
1447
-
1448
  if ($display)
1449
  {
1450
  if ( isset($above) )
@@ -1569,6 +1646,10 @@ function addthis_output_script($return = false, $justConfig = false )
1569
  $addthis_share['shorteners']['bitly']['login'] = esc_js($options['addthis_bitly_login']);
1570
  $addthis_share['shorteners']['bitly']['apiKey'] = esc_js($options['addthis_bitly_key']);
1571
  }
 
 
 
 
1572
 
1573
  if ($justConfig)
1574
  {
@@ -1824,12 +1905,25 @@ EOF;
1824
 
1825
  function addthis_options_page_scripts()
1826
  {
1827
- $script = (addthis_get_wp_version() >= 3.2 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) ? 'options-page.32.js' : 'options-page.js';
1828
 
1829
  $script_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/'.$script ;
1830
  $script_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/'.$script ;
 
 
1831
  wp_enqueue_script( 'addthis_options_page_script', $script_location , array('jquery-ui-tabs', 'thickbox' ));
1832
- wp_localize_script( 'addthis_options_page_script', 'addthis_option_params', array('wp_ajax_url'=> admin_url('admin-ajax.php'), 'addthis_validate_action' => 'validate_addthis_api_credentials') );
 
 
 
 
 
 
 
 
 
 
 
1833
 
1834
  }
1835
 
@@ -1839,6 +1933,10 @@ function addthis_options_page_style()
1839
  $style_location = apply_filters( 'addthis_files_uri' , plugins_url('', basename(dirname(__FILE__)) ) ) . '/addthis/css/options-page.css' ;
1840
  wp_enqueue_style( 'addthis_options_page_style', $style_location);
1841
  wp_enqueue_style( 'thickbox' );
 
 
 
 
1842
  }
1843
 
1844
  function addthis_admin_menu()
@@ -1862,6 +1960,8 @@ function addthis_admin_menu()
1862
  'addthis_showonpages' => true,
1863
  'addthis_showonarchives' => true,
1864
  'addthis_showoncats' => true,
 
 
1865
  'addthis_addressbar' => false,
1866
  'addthis_copytracking1' => false,
1867
  'addthis_copytracking2' => false,
@@ -1876,12 +1976,12 @@ function addthis_admin_menu()
1876
  'above_custom_services' => '',
1877
  'above_custom_preferred' => '',
1878
  'above_custom_more' => '',
1879
- 'above_custom_string' => '',
1880
  'below_custom_size' => '',
1881
  'below_custom_services' => '',
1882
  'below_custom_preferred' => '',
1883
  'below_custom_more' => '',
1884
- 'below_custom_string' => '',
1885
  'addthis_twitter_template' => '',
1886
  'addthis_508' => '',
1887
  'data_ga_property' => '',
@@ -1961,6 +2061,7 @@ function addthis_plugin_options_php4() {
1961
  <div class='clear'>&nbsp;</div>
1962
 
1963
  <div id="tabs-1">
 
1964
  <?php echo $version_notification_content = _addthis_version_notification($atversion_update_status, $atversion);?>
1965
  <input type="hidden" value="<?php echo $atversion?>" name="addthis_settings[atversion]" id="addthis_atversion_hidden" />
1966
  <input type="hidden" value="<?php echo $atversion_update_status?>" name="addthis_settings[atversion_update_status]" id="addthis_atversion_update_status" />
@@ -2006,8 +2107,37 @@ function addthis_plugin_options_php4() {
2006
  </table>
2007
  <div class='clear'>&nbsp;</div>
2008
  <br/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2009
  </div>
2010
-
2011
  <div id="tabs-2">
2012
  <?php echo $version_notification_content?>
2013
  <table class="form-table">
@@ -2034,6 +2164,16 @@ function addthis_plugin_options_php4() {
2034
  <th scope="row"><?php _e("excerpts:", 'addthis_trans_domain' ); ?></th>
2035
  <td><input type="checkbox" name="addthis_settings[addthis_showonexcerpts]" value="true" <?php echo ( $addthis_showonexcerpts == true ? 'checked="checked"' : ''); ?>/></td>
2036
  </tr>
 
 
 
 
 
 
 
 
 
 
2037
  <tr>
2038
  <th><h2>Have AddThis track &hellip;</h2></th>
2039
  </tr>
@@ -2269,6 +2409,89 @@ if (! function_exists('get_first_twitter_username'))
2269
  }
2270
  }
2271
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2272
  require_once('addthis_post_metabox.php');
2273
 
2274
- ?>
23
  * Plugin Name: AddThis Social Bookmarking Widget
24
  * Plugin URI: http://www.addthis.com
25
  * Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
26
+ * Version: 3.5
27
  *
28
  * Author: The AddThis Team
29
  * Author URI: http://www.addthis.com/blog
46
 
47
 
48
  define( 'addthis_style_default' , 'fb_tw_p1_sc');
49
+ define( 'ADDTHIS_PLUGIN_VERSION' , '3.5');
50
+ define( 'ADDTHIS_PRODUCT_VERSION' , 'wpp-3.5');
51
  define( 'ADDTHIS_ATVERSION', '300');
52
  define( 'ADDTHIS_ATVERSION_MANUAL_UPDATE', -1);
53
  define( 'ADDTHIS_ATVERSION_AUTO_UPDATE', 0);
54
  define( 'ADDTHIS_ATVERSION_REVERTED', 1);
55
+ define( 'ENABLE_ADDITIONAL_PLACEMENT_OPTION', 0);
56
 
57
  $addthis_settings = array();
58
  $addthis_settings['isdropdown'] = 'true';
63
  $addthis_settings['fallback_username'] = '';
64
  $addthis_settings['style'] = 'share';
65
  $addthis_settings['atversion'] = ADDTHIS_ATVERSION;
66
+ $addthis_settings['placement'] = ENABLE_ADDITIONAL_PLACEMENT_OPTION;
67
 
68
  $addthis_languages = array(''=>'Automatic','af'=>'Afrikaaner', 'ar'=>'Arabic', 'zh'=>'Chinese', 'cs'=>'Czech', 'da'=>'Danish', 'nl'=>'Dutch', 'en'=>'English', 'fa'=>'Farsi', 'fi'=>'Finnish', 'fr'=>'French', 'ga'=>'Gaelic', 'de'=>'German', 'el'=>'Greek', 'he'=>'Hebrew', 'hi'=>'Hindi', 'it'=>'Italian', 'ja'=>'Japanese', 'ko'=>'Korean', 'lv'=>'Latvian', 'lt'=>'Lithuanian', 'no'=>'Norwegian', 'pl'=>'Polish', 'pt'=>'Portugese', 'ro'=>'Romanian', 'ru'=>'Russian', 'sk'=>'Slovakian', 'sl'=>'Slovenian', 'es'=>'Spanish', 'sv'=>'Swedish', 'th'=>'Thai', 'ur'=>'Urdu', 'cy'=>'Welsh', 'vi'=>'Vietnamese');
69
 
77
  'bookmark-small' => array('img'=>'sm-bookmark-en.gif', 'w'=>83, 'h'=>16),
78
  'plus' => array('img'=>'sm-plus.gif', 'w'=>16, 'h'=>16)
79
  );
80
+
81
  $addthis_options = get_option('addthis_settings');
82
  $atversion = is_array($addthis_options) && array_key_exists('atversion_reverted', $addthis_options) && $addthis_options['atversion_reverted'] == 1 ? $addthis_options['atversion'] : ADDTHIS_ATVERSION;
83
 
188
 
189
  if ($showonarchives = get_option('addthis_showonarchives'))
190
  $addthis_new_options['addthis_showonarchives'] = $showonarchives;
191
+
192
+ if ($aftertitle = get_option('addthis_aftertitle'))
193
+ $addthis_new_options['addthis_aftertitle'] = $aftertitle;
194
+
195
+ if ($beforecomments = get_option('addthis_beforecomments'))
196
+ $addthis_new_options['addthis_beforecomments'] = $beforecomments;
197
+
198
+
199
  if (get_option('addthis_showonposts') != true)
200
  $addthis_new_options['below'] = 'none';
201
  elseif (get_option('addthis_sidebar_only') == true)
242
  delete_option('addthis_showonpages');
243
  delete_option('addthis_showoncats');
244
  delete_option('addthis_showonarchives');
245
+ delete_option('addthis_aftertitle');
246
+ delete_option('addthis_beforecomments');
247
  delete_option('addthis_style');
248
  delete_option('addthis_header_background');
249
  delete_option('addthis_header_color');
381
 
382
  $button = '<div class="'.$outerClasses.'" '.$identifier.' >';
383
 
384
+ if (isset($options['addthis_options']) && $options['addthis_options'] != "") {
385
+ $addthis_options = split(',', $options['addthis_options']);
386
+ foreach ($addthis_options as $option) {
387
+ $option = trim($option);
388
+ if ($option != 'more') {
389
+ $button .= '<a class="addthis_button_'.$option.'"></a>';
390
+ }
391
+ }
392
+ }
393
+ else if (isset($options['services']) ) {
394
  $services = explode(',', $options['services']);
395
  foreach ($services as $service)
396
  {
397
  $service = trim($service);
398
+ if ($service == 'more' || $service == 'compact') {
399
+ if (isset($options['type']) && $options['type'] != 'fb_tw_p1_sc') {
400
+ $button .= '<a class="addthis_button_compact"></a>';
401
+ }
402
+ }
403
+ else if ($service == 'counter') {
404
+ if (isset($options['type']) && $options['type'] == 'fb_tw_p1_sc') {
405
+ $button .= '<a class="addthis_counter addthis_pill_style"></a>';
406
+ }
407
+ else {
408
+ $button .= '<a class="addthis_counter addthis_bubble_style"></a>';
409
+ }
410
+ }
411
+ else if ($service == 'google_plusone') {
412
+ $button .= '<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>';
413
+ }
414
  else
415
  $button .= '<a class="addthis_button_'.strtolower($service).'"></a>';
416
  }
484
  elseif ( ( ! isset($options['username']) || $options['username'] == false) && ! get_user_meta($user_id, 'addthis_nag_username_ignore'))
485
  {
486
  echo '<div class="updated addthis_setup_nag"><p>';
487
+ printf( __('Sign up for AddThis and add your username/password to receive analytics about how people are sharing your content.<br /> <a href="%1$s">Enter username and password</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%2$s" target="_blank">Sign Up</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="%3$s">Ignore this notice</a>'),
488
  admin_url('options-general.php?page=' . basename(__FILE__) ),
489
  'https://www.addthis.com/register?profile=wpp',
490
  '?addthis_nag_username_ignore=0');
890
 
891
  $styles = array_merge($addthis_styles, $addthis_new_styles);
892
 
893
+ $below_custom_styles = $above_custom_styles = '';
894
 
895
  $options = array();
896
 
917
  $options['wpfooter'] = (bool) $data['wpfooter'];
918
 
919
 
920
+ if ( isset ($data['show_above']) )
 
 
 
921
  $options['above'] = 'none';
922
  elseif ( isset($styles[$data['above']]) )
923
  $options['above'] = $data['above'];
924
+ elseif ($data['above'] == 'disable')
925
+ $options['above'] = $data['above'];
926
  elseif ($data['above'] == 'none')
927
  {
928
  $options['above'] = 'none';
953
 
954
  }
955
 
956
+ if ( isset ($data['show_below']) )
 
 
 
957
  $options['below'] = 'none';
958
  elseif ( isset($styles[$data['below']]) )
959
  $options['below'] = $data['below'];
960
+ elseif ($data['below'] == 'disable')
961
+ $options['below'] = $data['below'];
962
  elseif ($data['below'] == 'none')
963
  {
964
  $options['below'] = 'none';
986
  $options['below_custom_string'] = addthis_kses($data['below_custom_string'], $below_custom_styles);
987
  }
988
 
 
989
  if (isset($data['addthis_copytrackingremove']) && $data['addthis_copytrackingremove'] == true)
990
  unset($data['addthis_copytracking1']);
991
 
992
  // All the checkbox fields
993
+ foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats', 'addthis_showonexcerpts', 'addthis_aftertitle' , 'addthis_beforecomments', 'addthis_addressbar','addthis_508','addthis_copytracking2' ) as $field)
994
  {
995
  if ( isset($data[$field]) && $data[$field] == true)
996
  $options[$field] = true;
1065
  $options['addthis_share_json'] = sanitize_text_field($data['addthis_share_json']);
1066
  }
1067
 
1068
+ if (isset ($data['above_chosen_list']) && strlen($data['above_chosen_list']) != 0)
1069
+ {
1070
+ $options['above_chosen_list'] = sanitize_text_field($data['above_chosen_list']);
1071
+ }
1072
+ else {
1073
+ $options['above_chosen_list'] = "";
1074
+ }
1075
+
1076
+ if (isset ($data['below_chosen_list']) && strlen($data['below_chosen_list']) != 0)
1077
+ {
1078
+ $options['below_chosen_list'] = sanitize_text_field($data['below_chosen_list']);
1079
+ }
1080
+ else {
1081
+ $options['below_chosen_list'] = "";
1082
+ }
1083
 
1084
  return $options;
1085
 
1110
  if ( ! empty( $options) ){
1111
  if ( isset($options['addthis_showonexcerpts']) && $options['addthis_showonexcerpts'] == true )
1112
  add_filter('get_the_excerpt', 'addthis_display_social_widget_excerpt', 11);
1113
+
1114
+ if ( isset($options['addthis_aftertitle']) && $options['addthis_aftertitle'] == true)
1115
+ add_filter('the_title', 'addthis_display_after_title', 11);
1116
+
1117
+ add_filter('the_content', 'addthis_display_social_widget', 15);
1118
 
 
1119
  }
1120
  }
1121
 
1375
  else
1376
  $options = get_option('addthis_settings');
1377
 
 
1378
  if ( is_home() || is_front_page() ) {
1379
  if (isset($options['addthis_showonhome']) && $options['addthis_showonhome'] == true ) {
1380
  if (isset($options['addthis_showonexcerpts']) && $options['addthis_showonexcerpts'] == true ) {
1409
  elseif ( is_category() )
1410
  $display = (isset($options['addthis_showoncats']) && $options['addthis_showoncats'] == true ) ? true : false;
1411
  // Pages
1412
+ elseif ( is_page($post->ID) )
1413
  $display = (isset($options['addthis_showonpages']) && $options['addthis_showonpages'] == true) ? true: false;
1414
  // Single pages (true by default and design)
1415
  elseif ( is_single() )
1435
  $below = '';
1436
 
1437
  // Still here? Well let's add some social goodness
1438
+ if ( isset( $options['above'] ) && $options['above'] != 'none' && $options['above'] != 'disable' && $display )
1439
  {
1440
  if (isset ($styles[$options['above']]))
1441
  {
1442
+ $above = apply_filters('addthis_above_content', $styles[$options['above']]['src']);
1443
  }
1444
  elseif ($options['above'] == 'custom')
1445
  {
1449
  if ($options['above_do_custom_preferred'])
1450
  $aboveOptions['preferred'] = $options['above_custom_preferred'];
1451
  $aboveOptions['more'] = $options['above_custom_more'];
1452
+ $aboveOptions['addthis_options'] = $options['addthis_options'];
1453
  $above = apply_filters('addthis_above_content', addthis_custom_toolbox($aboveOptions, $url, $title) );
1454
  }
1455
+ elseif( $options['above'] == 'custom_string')
1456
  {
1457
  $custom = preg_replace( '/<\s*div\s*/', '<div %s ', $options['above_custom_string'] );
1458
  $above = apply_filters('addthis_above_content', $custom);
1459
  }
1460
+
1461
+ if (isset ($options['above_chosen_list']) && strlen($options['above_chosen_list']) != 0) {
1462
+ if (isset ($options['above']) && $options['above'] == 'large_toolbox') {
1463
+ $aboveOptions['size'] = '32';
1464
+ }
1465
+ elseif (isset ($options['above']) && $options['above'] == 'small_toolbox') {
1466
+ $aboveOptions['size'] = '16';
1467
+ }
1468
+ $aboveOptions['type'] = $options['above'];
1469
+ $aboveOptions['services'] = $options['above_chosen_list'];
1470
+ $aboveOptions['addthis_options'] = $options['addthis_options'];
1471
+ $above = apply_filters('addthis_above_content', addthis_custom_toolbox($aboveOptions, $url, $title) );
1472
+ }
1473
  }
1474
  elseif ($display)
1475
  $above = apply_filters('addthis_above_content','' );
1476
  else
1477
  $above = '';
1478
 
1479
+ if ( isset( $options['below'] ) && $options['below'] != 'none' && $options['below'] != 'disable' && $display && ! $below_excerpt )
1480
  {
1481
  if (isset ($styles[$options['below']]))
1482
  {
1488
  $belowOptions['services'] = $options['below_custom_services'];
1489
  $belowOptions['preferred'] = $options['below_custom_preferred'];
1490
  $belowOptions['more'] = $options['below_custom_more'];
1491
+ $belowOptions['addthis_options'] = $options['addthis_options'];
1492
  $below = apply_filters('addthis_below_content', addthis_custom_toolbox($belowOptions, $url, $title) );
1493
  }
1494
+ elseif( $options['below'] == 'custom_string')
1495
  {
1496
  $custom = preg_replace( '/<\s*div\s*/', '<div %s ', $options['below_custom_string'] );
1497
  $below = apply_filters('addthis_below_content', $custom);
1498
  }
1499
+
1500
+ if (isset ($options['below_chosen_list']) && strlen($options['below_chosen_list']) != 0) {
1501
+ if (isset ($options['below']) && $options['below'] == 'large_toolbox') {
1502
+ $belowOptions['size'] = '32';
1503
+ }
1504
+ elseif (isset ($options['below']) && $options['below'] == 'small_toolbox') {
1505
+ $belowOptions['size'] = '16';
1506
+ }
1507
+ $belowOptions['type'] = $options['below'];
1508
+ $belowOptions['services'] = $options['below_chosen_list'];
1509
+ $belowOptions['addthis_options'] = $options['addthis_options'];
1510
+ $below = apply_filters('addthis_above_content', addthis_custom_toolbox($belowOptions, $url, $title) );
1511
+ }
1512
  }
1513
  elseif ($below_excerpt && $display && $options['below'] != 'none' )
1514
  {
1522
  $below = '';
1523
 
1524
 
 
1525
  if ($display)
1526
  {
1527
  if ( isset($above) )
1646
  $addthis_share['shorteners']['bitly']['login'] = esc_js($options['addthis_bitly_login']);
1647
  $addthis_share['shorteners']['bitly']['apiKey'] = esc_js($options['addthis_bitly_key']);
1648
  }
1649
+ else {
1650
+ $addthis_share['url_transforms']['shorten']['twitter'] = 'bitly';
1651
+ $addthis_share['shorteners']['bitly'] = '';
1652
+ }
1653
 
1654
  if ($justConfig)
1655
  {
1905
 
1906
  function addthis_options_page_scripts()
1907
  {
1908
+ $script = (addthis_get_wp_version() >= 3.2 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) ? 'options-page.32.js' : 'options-page.js';
1909
 
1910
  $script_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/'.$script ;
1911
  $script_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/'.$script ;
1912
+ $imgLocationBase = apply_filters( 'at_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
1913
+ $imgLocationBase = apply_filters( 'addthis_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
1914
  wp_enqueue_script( 'addthis_options_page_script', $script_location , array('jquery-ui-tabs', 'thickbox' ));
1915
+ wp_enqueue_script( 'addthis_core', 'https://cache.addthiscdn.com/site/core/js/core-1.1.1.js');
1916
+ wp_enqueue_script( 'addthis_lr', 'https://cache.addthiscdn.com/www/20130509092329/js/lr.js');
1917
+ wp_enqueue_script('addthis_qtip_script', 'https://cache.addthiscdn.com/lib/jquery/plugins/qtip-1.0.0-rc2/jquery.qtip.min.js');
1918
+ wp_enqueue_script('addthis_ui_script', 'https://cache.addthiscdn.com/www/20130424124136/js/shared/jqueryui.sortable.js');
1919
+ wp_enqueue_script( 'addthis_selectbox', 'https://cache.addthiscdn.com/www/20130509092329/js/shared/jquery.selectBoxIt.min.js');
1920
+ wp_enqueue_script( '', 'https://cache.addthiscdn.com/www/20130509092329/js/shared/jquery.messagebox.js');
1921
+ wp_enqueue_script( '', 'https://cache.addthiscdn.com/www/20130509092329/js/shared/jquery.atjax.js');
1922
+ wp_enqueue_script( 'addthis_lodash_script', 'https://cache.addthiscdn.com/www/20130424124136/js/shared/lodash-0.10.0.js');
1923
+ wp_enqueue_script('addthis_services_script', plugins_url( '', basename(dirname(__FILE__)) ) . '/addthis/js/gtc-sharing-personalize.js');
1924
+ wp_enqueue_script('addthis_service_script', plugins_url( '', basename(dirname(__FILE__)) ) . '/addthis/js/gtc.cover.js');
1925
+ wp_localize_script( 'addthis_options_page_script', 'addthis_option_params', array('wp_ajax_url'=> admin_url('admin-ajax.php'), 'addthis_validate_action' => 'validate_addthis_api_credentials', 'img_base' => $imgLocationBase) );
1926
+ wp_localize_script( 'addthis_services_script', 'addthis_params', array('img_base' => $imgLocationBase) );
1927
 
1928
  }
1929
 
1933
  $style_location = apply_filters( 'addthis_files_uri' , plugins_url('', basename(dirname(__FILE__)) ) ) . '/addthis/css/options-page.css' ;
1934
  wp_enqueue_style( 'addthis_options_page_style', $style_location);
1935
  wp_enqueue_style( 'thickbox' );
1936
+ wp_enqueue_style( 'addthis_services_style', plugins_url( '', basename(dirname(__FILE__)) ) . '/addthis/css/gtc.sharing-personalize.css' );
1937
+ wp_enqueue_style('addthis_bootstrap_style', 'https://cache.addthiscdn.com/www/20130424124136/style/shared/bootstrap.css');
1938
+ wp_enqueue_style( 'addthis_widget', 'https://ct1.addthis.com/static/r07/widget114.css');
1939
+ wp_enqueue_style( 'addthis_widget_big', 'https://ct1.addthis.com/static/r07/widgetbig056.css');
1940
  }
1941
 
1942
  function addthis_admin_menu()
1960
  'addthis_showonpages' => true,
1961
  'addthis_showonarchives' => true,
1962
  'addthis_showoncats' => true,
1963
+ 'addthis_aftertitle' => false,
1964
+ 'addthis_beforecomments' => false,
1965
  'addthis_addressbar' => false,
1966
  'addthis_copytracking1' => false,
1967
  'addthis_copytracking2' => false,
1976
  'above_custom_services' => '',
1977
  'above_custom_preferred' => '',
1978
  'above_custom_more' => '',
1979
+ 'above_custom_string' => '',
1980
  'below_custom_size' => '',
1981
  'below_custom_services' => '',
1982
  'below_custom_preferred' => '',
1983
  'below_custom_more' => '',
1984
+ 'below_custom_string' => '',
1985
  'addthis_twitter_template' => '',
1986
  'addthis_508' => '',
1987
  'data_ga_property' => '',
2061
  <div class='clear'>&nbsp;</div>
2062
 
2063
  <div id="tabs-1">
2064
+ <div style="float: left;width: 620px; margin-right: 10px;">
2065
  <?php echo $version_notification_content = _addthis_version_notification($atversion_update_status, $atversion);?>
2066
  <input type="hidden" value="<?php echo $atversion?>" name="addthis_settings[atversion]" id="addthis_atversion_hidden" />
2067
  <input type="hidden" value="<?php echo $atversion_update_status?>" name="addthis_settings[atversion_update_status]" id="addthis_atversion_update_status" />
2107
  </table>
2108
  <div class='clear'>&nbsp;</div>
2109
  <br/>
2110
+ </div>
2111
+
2112
+ <div style="display:block; float:left; width:470px;">
2113
+ <div id="preview_floater">
2114
+ <table class="form-table">
2115
+ <tbody>
2116
+ <tr>
2117
+ <td id="below" colspan="2">
2118
+ <fieldset>
2119
+ <legend id="previewHeader">&nbsp;<strong>Preview</strong> &nbsp;</legend>
2120
+ <div id="previewBox" class="previewbox">
2121
+ <div id="addthis_share_demo" class="addthis_tshare_demo" >
2122
+ <div class="addthis-share-list">
2123
+ <h3 style="margin-top:0;">Another Post with Everything in it</h3>
2124
+ <div id="above_previewContainer" style="float: left; width: 100%;"></div>
2125
+ <p style="float: left; width: 100%;">Published by <a href="#">admin</a> on September 17, 2008 | <a href="#">2 Responses</a> | <a href="#">Edit</a></p>
2126
+ <div id="preview_post"><p style="float: left; width: 100%;">Lorem dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p></div>
2127
+ <div id="below_previewContainer" style="float: left; width: 100%;"></div>
2128
+ <p style="float:left;">Posted in <a href="#">Child Category I</a>, <a href="#">Parent Category I</a>, <a href="#">Parent Category II</a></p>
2129
+ </div>
2130
+ </div>
2131
+ </div>
2132
+ </fieldset>
2133
+ </td>
2134
+ </tr>
2135
+ </tbody>
2136
+ </table>
2137
+ </div>
2138
+ </div>
2139
  </div>
2140
+
2141
  <div id="tabs-2">
2142
  <?php echo $version_notification_content?>
2143
  <table class="form-table">
2164
  <th scope="row"><?php _e("excerpts:", 'addthis_trans_domain' ); ?></th>
2165
  <td><input type="checkbox" name="addthis_settings[addthis_showonexcerpts]" value="true" <?php echo ( $addthis_showonexcerpts == true ? 'checked="checked"' : ''); ?>/></td>
2166
  </tr>
2167
+ <?php if($addthis_settings['placement'] != "0") { ?>
2168
+ <tr>
2169
+ <th scope="row"><?php _e("after title:", 'addthis_trans_domain' ); ?></th>
2170
+ <td><input type="checkbox" name="addthis_settings[addthis_aftertitle]" value="true" <?php echo ( $addthis_aftertitle == true ? 'checked="checked"' : ''); ?>/></td>
2171
+ </tr>
2172
+ <tr>
2173
+ <th scope="row"><?php _e("before comments:", 'addthis_trans_domain' ); ?></th>
2174
+ <td><input type="checkbox" name="addthis_settings[addthis_beforecomments]" value="true" <?php echo ( $addthis_beforecomments == true ? 'checked="checked"' : ''); ?>/></td>
2175
+ </tr>
2176
+ <?php } ?>
2177
  <tr>
2178
  <th><h2>Have AddThis track &hellip;</h2></th>
2179
  </tr>
2409
  }
2410
  }
2411
 
2412
+ /*
2413
+ * hook for after title
2414
+ */
2415
+ function addthis_display_after_title($title, $filtered = true) {
2416
+ global $addthis_styles, $addthis_new_styles, $post;
2417
+ $styles = array_merge($addthis_styles, $addthis_new_styles);
2418
+
2419
+
2420
+ if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
2421
+ $preview = true;
2422
+ else
2423
+ $options = get_option('addthis_settings');
2424
+
2425
+ $custom_fields = get_post_custom($post->ID);
2426
+ if (isset ($custom_fields['addthis_exclude']) && $custom_fields['addthis_exclude'][0] == 'true')
2427
+ $display = false;
2428
+ else
2429
+ $display = true;
2430
+
2431
+ $display = apply_filters('addthis_post_exclude', $display);
2432
+
2433
+ remove_filter('wp_trim_excerpt', 'addthis_remove_tag', 9, 2);
2434
+ remove_filter('get_the_excerpt', 'addthis_late_widget');
2435
+
2436
+ $url = get_permalink();
2437
+
2438
+ $url_above = "addthis:url='$url' ";
2439
+ $url_above .= "addthis:title='". esc_attr( $title) ." '";
2440
+ $above = '';
2441
+
2442
+ if ( isset( $options['above'] ) && $options['above'] != 'none' && $options['above'] != 'disable' && $display )
2443
+ {
2444
+ if (isset ($styles[$options['above']]))
2445
+ {
2446
+ $above = apply_filters('addthis_above_content', $styles[$options['above']]['src']);
2447
+ }
2448
+ elseif ($options['above'] == 'custom')
2449
+ {
2450
+ $aboveOptions['size'] = $options['above_custom_size'];
2451
+ if ($options['above_do_custom_services'])
2452
+ $aboveOptions['services'] = $options['above_custom_services'];
2453
+ if ($options['above_do_custom_preferred'])
2454
+ $aboveOptions['preferred'] = $options['above_custom_preferred'];
2455
+ $aboveOptions['more'] = $options['above_custom_more'];
2456
+ $aboveOptions['addthis_options'] = $options['addthis_options'];
2457
+ $above = apply_filters('addthis_above_content', addthis_custom_toolbox($aboveOptions, $url, $title) );
2458
+ }
2459
+
2460
+ if (isset ($options['above_chosen_list']) && strlen($options['above_chosen_list']) != 0) {
2461
+ if (isset ($options['above']) && $options['above'] == 'large_toolbox') {
2462
+ $aboveOptions['size'] = '32';
2463
+ }
2464
+ elseif (isset ($options['above']) && $options['above'] == 'small_toolbox') {
2465
+ $aboveOptions['size'] = '16';
2466
+ }
2467
+ $aboveOptions['type'] = $options['above'];
2468
+ $aboveOptions['services'] = $options['above_chosen_list'];
2469
+ $aboveOptions['addthis_options'] = $options['addthis_options'];
2470
+ $above = apply_filters('addthis_above_content', addthis_custom_toolbox($aboveOptions, $url, $title) );
2471
+ }
2472
+ }
2473
+ elseif ($display)
2474
+ $above = apply_filters('addthis_above_content','' );
2475
+ else
2476
+ $above = '';
2477
+
2478
+ if ($display)
2479
+ {
2480
+ if ( isset($above) )
2481
+ {
2482
+ if (in_the_loop() && $title == $post->post_title) {
2483
+ if ($options['above'] == 'custom')
2484
+ $title .= $above;
2485
+ else
2486
+ $title .= sprintf($above, $url_above);
2487
+ }
2488
+ }
2489
+ if ($filtered == true)
2490
+ add_filter('wp_trim_excerpt', 'addthis_remove_tag', 11, 2);
2491
+ }
2492
+
2493
+ return $title;
2494
+ }
2495
+
2496
  require_once('addthis_post_metabox.php');
2497
 
 
css/gtc.sharing-personalize.css ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .above-smart-sharing-container, .below-smart-sharing-container {
2
+ display: inline-block;
3
+ width: 550px;
4
+ }
5
+ .above-smart-sharing-container label:hover, .below-smart-sharing-container label:hover {
6
+ cursor: pointer;
7
+ }
8
+ .customize-buttons {
9
+ max-width: 540px;
10
+ }
11
+ #selected-services {
12
+ float: right;
13
+ }
14
+ #sharing-buttons {
15
+ float: left;
16
+ margin-left: 5px;
17
+ }
18
+ .customize-buttons {
19
+ display: none;
20
+ }
21
+ .sortable-heading {
22
+ color: #484848;
23
+ padding: 5px 0 0 0;
24
+ }
25
+ .sortable {
26
+ width: 230px;
27
+ -webkit-user-select: none;
28
+ -moz-user-select: none;
29
+ -ms-user-select: none;
30
+ user-select: none;
31
+ border: 1px solid #CCC;
32
+ border-radius: 6px;
33
+ overflow: auto;
34
+ }
35
+
36
+ .sharing-buttons {
37
+ float: left;
38
+ width: 250px;
39
+ padding-right: 45px;
40
+ }
41
+
42
+ .selected-services {
43
+ float: left;
44
+ }
45
+
46
+ .sortable.grid {
47
+ overflow: hidden;
48
+ }
49
+
50
+ .sortable li {
51
+ list-style: none;
52
+ border-bottom: 1px solid #CCC;
53
+ margin: 0;
54
+ padding: 0 5px;
55
+ height: 50px;
56
+ line-height: 50px;
57
+ text-align: left;
58
+ background-repeat: no-repeat;
59
+ background-position: 15px 18px;
60
+ background-size: 16px;
61
+ position: relative;
62
+ }
63
+
64
+ .sortable li .close {
65
+ line-height: 45px;
66
+ font-weight: bold;
67
+ font-size: 18px;
68
+ display: none;
69
+ position: absolute;
70
+ float: none;
71
+ right: 0;
72
+ padding-right: 10px;
73
+ }
74
+
75
+ .sortable li.enabled:hover {
76
+ background: #F6F6F6;
77
+ cursor: move;
78
+ background-repeat: no-repeat;
79
+ background-position: 15px 18px;
80
+ background-size: 16px;
81
+ }
82
+
83
+ .sortable li.disabled:hover {
84
+ cursor: default;
85
+ }
86
+
87
+ .sortable li .at300bs {
88
+ cursor: move !important;
89
+ margin-top:17px;
90
+ }
91
+
92
+ .sortable.grid li {
93
+ line-height: 80px;
94
+ float: left;
95
+ width: 80px;
96
+ height: 80px;
97
+ text-align: center;
98
+ }
99
+
100
+ .handle {
101
+ cursor: move;
102
+ }
103
+
104
+ .sortable.connected {
105
+ width: 200px;
106
+ min-height: 100px;
107
+ float: left;
108
+ }
109
+
110
+ li.disabled {
111
+ opacity: 0.5;
112
+ }
113
+
114
+ li.highlight {
115
+ background: #FEE25F;
116
+ }
117
+
118
+ li.sortable-placeholder {
119
+ border: 1px dashed #CCC;
120
+ background: none;
121
+ }
122
+
123
+ #atcode {
124
+ clear: both;
125
+ }
126
+
127
+ .sharing-buttons .sortable {
128
+ height: 205px;
129
+ overflow: auto;
130
+ margin-top: 20px;
131
+ float: left;
132
+ }
133
+
134
+ .selected-services .sortable {
135
+ height: 255px;
136
+ max-height: 260px;
137
+ }
138
+
139
+ .sharing-buttons-search {
140
+ width: 220px;
141
+ padding: 5px !important;
142
+ height: 30px;
143
+ font-size: 15px;
144
+ background: url(http://s7.addthis.com/static/t00/bkg-search-lg.gif);
145
+ background-repeat: no-repeat;
146
+ background-position:190px 10px;
147
+ }
148
+
149
+ .restore-default-options {
150
+ float: right;
151
+ display: none;
152
+ text-decoration: none;
153
+ color: #0098F8;
154
+ line-height: 20px;
155
+ }
156
+
157
+ .previewbox {
158
+ overflow: auto;
159
+ }
160
+
161
+ .no-preview-available {
162
+ width: 300px;
163
+ font-size: 16px;
164
+ font-weight: lighter;
165
+ font-style: italic;
166
+ }
167
+
168
+ .add-buttons-msg {
169
+ font-size: 16px;
170
+ font-style: italic;
171
+ display: table-cell;
172
+ vertical-align: middle;
173
+ text-align: center;
174
+ height: 255px;
175
+ }
176
+
177
+ .ui-tooltip {
178
+ font-size: 12px !important;
179
+ line-height: 1.4 !important;
180
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
181
+ max-width: 250px;
182
+ background: #FFFFFF;
183
+ border: 4px solid #ddd;
184
+ border-radius: 6px 6px 6px 6px;
185
+ padding: 7px;
186
+ }
187
+
188
+ .selected-services .ui-tooltip {
189
+ max-width: 40px !important;
190
+ }
191
+ .vertical-drag, .horizontal-drag {
192
+ position: absolute;
193
+ max-width: 60px;
194
+ display: none;
195
+ left: 255px;
196
+ z-index: 0;
197
+ line-height: 23px;
198
+ bottom: 75px;
199
+ }
200
+
201
+ .smart-sharing-link {
202
+ display: none;
203
+ }
204
+
205
+ .customize-checkbox-paragraph {
206
+ margin: 10px 0;
207
+ }
208
+
209
+ .disabled {
210
+ -moz-opacity: 0.60;
211
+ opacity:.60;
212
+ filter: alpha(opacity=60);
213
+ }
214
+
215
+ .smart-radio-buttons {
216
+ float: left;
217
+ clear: both;
218
+ padding: 5px 0;
219
+ }
220
+
221
+ .smart-radio-container {
222
+ padding: 10px 0;
223
+ margin: 0;
224
+ display: inline-block;
225
+ }
226
+
227
+ .ui-tooltip {
228
+ max-width:200px!important;
229
+ }
230
+
231
+ .ui-tooltip {
232
+ padding: 8px;
233
+ position: absolute;
234
+ z-index: 9999;
235
+ max-width: 300px;
236
+ -webkit-box-shadow: 0 0 5px #aaa;
237
+ box-shadow: 0 0 5px #aaa;
238
+ }
239
+ body .ui-tooltip {
240
+ border-width: 2px;
241
+ }
css/options-page.css CHANGED
@@ -6,11 +6,14 @@ h3.page-title {
6
  padding-bottom: 0;
7
  width: 100%;
8
  height:63px;
 
9
  }
10
  ul.nav-tab-wrapper {
11
  height: 57px;
12
  border-bottom: 1px solid #ccc;
13
  margin-bottom: 0;
 
 
14
  }
15
  ul.nav-tab-wrapper li:first-child {
16
  margin-left: 10px;
@@ -105,9 +108,20 @@ li.ui-tabs-active{
105
  .form-table tr th h2{
106
  width: 240px;
107
  }
108
-
109
-
110
-
 
 
 
 
 
 
 
 
 
 
 
111
  .more-info{
112
  float: left;
113
  width: 200px;
@@ -123,7 +137,7 @@ clear: both;
123
  .ui-tabs-panel{
124
  }
125
  .wrap{
126
- width: 800px;
127
  }
128
  span.code_name{
129
  width: 140px;
@@ -140,9 +154,6 @@ float: right;
140
  .form-table .hidden{
141
  display: none;
142
  }
143
- .form-table .hide{
144
- display: none;
145
- }
146
  h2.placeholder{
147
  font-size: 1px;
148
  padding: 1px;
@@ -201,4 +212,109 @@ width: 36px;
201
  }
202
  #wpbody-content {
203
  font-family: Arial;
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  padding-bottom: 0;
7
  width: 100%;
8
  height:63px;
9
+ float: left;
10
  }
11
  ul.nav-tab-wrapper {
12
  height: 57px;
13
  border-bottom: 1px solid #ccc;
14
  margin-bottom: 0;
15
+ float: left;
16
+ width: 92%;
17
  }
18
  ul.nav-tab-wrapper li:first-child {
19
  margin-left: 10px;
108
  .form-table tr th h2{
109
  width: 240px;
110
  }
111
+ .org {
112
+ color: #FE6D4C !important;
113
+ }
114
+ .helv {
115
+ font-family: "Open Sans",Helvetica,arial,sans-serif;
116
+ font-style: normal;
117
+ font-weight: 300;
118
+ letter-spacing: -0.05em;
119
+ margin: 0px;
120
+ }
121
+ h3.helv {
122
+ font-size: 24px;
123
+ padding: 10px;
124
+ }
125
  .more-info{
126
  float: left;
127
  width: 200px;
137
  .ui-tabs-panel{
138
  }
139
  .wrap{
140
+ width: 100%;
141
  }
142
  span.code_name{
143
  width: 140px;
154
  .form-table .hidden{
155
  display: none;
156
  }
 
 
 
157
  h2.placeholder{
158
  font-size: 1px;
159
  padding: 1px;
212
  }
213
  #wpbody-content {
214
  font-family: Arial;
215
+
216
+ }
217
+ table.preview_box {
218
+ margin-top: 15px;
219
+ width: 550px;
220
+ float: left;
221
+ }
222
+ .sharing-buttons-search {
223
+ float: left;
224
+ width: 100%;
225
+ margin-top: 10px;
226
+ border: 1px solid #CCC;
227
+ border-radius: 5px;
228
  }
229
+ .btn-search-rslt {
230
+ float: left;
231
+ width: 96%;
232
+ border-bottom: 1px solid #CCC;
233
+ height: 22px;
234
+ padding: 3px;
235
+ }
236
+ .service-name {
237
+ font-size: 13px;
238
+ }
239
+ .at300bs {
240
+ background: url(//ct1.addthis.com/static/r07/widget056.gif) no-repeat left;
241
+ overflow: hidden;
242
+ display: block;
243
+ background-position: 0 0;
244
+ height: 16px;
245
+ width: 16px;
246
+ line-height: 16px!important;
247
+ float: left;
248
+ }
249
+ .at300bs:hover {
250
+ opacity: .8;
251
+ }
252
+ .disabled-service {
253
+ opacity: .5;
254
+ cursor: default !important;
255
+ }
256
+ .personalizedMessage {
257
+ line-height: 20px;
258
+ }
259
+ .simple #personalizedMessage { left:627px; }
260
+ /*sortable*/
261
+ .connectedSortable {
262
+ height: 170px;
263
+ overflow: auto;
264
+ margin: 0;
265
+ padding: 10px 0 0 0;
266
+ }
267
+ .connectedSortable .ui-state-default, .connectedSortable .ui-state-highlight {
268
+ border-bottom: 1px solid #CCC;
269
+ padding-left: 10px;
270
+ height: 32px;
271
+ float: left;
272
+ width: 95%;
273
+ margin-bottom: 0;
274
+ padding-top: 10px;
275
+ cursor: move;
276
+ }
277
+ #above_sortable2, #below_sortable2 {
278
+ height: 215px;
279
+ }
280
+ .addthis_counter.addthis_bubble_style {
281
+ background: url(../../addthis/img/counters.gif) no-repeat!important;
282
+ }
283
+ .addthis_counter.addthis_bubble_style {
284
+ display: block;
285
+ margin: 0 0 0 -2px;
286
+ text-align: center;
287
+ font-weight: bold;
288
+ font-family: arial,helvetica,sans-serif;
289
+ color: #000;
290
+ background-repeat: no-repeat;
291
+ background-position: 0 -64px!important;
292
+ padding: 0 0 0 4px;
293
+ height: 16px;
294
+ width: 32px!important;
295
+ }
296
+ .addthis_32x32_style .addthis_counter.addthis_bubble_style {
297
+ height: 32px;
298
+ width: 60px!important;
299
+ background-position: 0 -32px!important;
300
+ }
301
+
302
+ div#preview_floater {
303
+
304
+ }
305
+ .stick {
306
+ position:fixed;
307
+ top:50px;
308
+ width:500px;
309
+ }
310
+ .above_button_set, .below_button_set {
311
+ position:relative;
312
+ }
313
+ .popover {
314
+ width: 375px;
315
+ line-height: 20px;
316
+ }
317
+ .customize-message-section {
318
+ font-size: 11px;
319
+ text-decoration: none;
320
+ }
css/output.css CHANGED
@@ -1,5 +1,5 @@
1
- .entry-content .addthis_toolbox, .entry-content .addthis_button {
2
- margin:0 0 10px 0;
3
  }
4
  .addthis_button_tweet {
5
  min-width: 83px;
@@ -7,4 +7,4 @@
7
  }
8
  .atwidget iframe {
9
  max-width:none;
10
- }
1
+ .entry-content .addthis_toolbox, .entry-content .addthis_button, .entry-header .addthis_toolbox, .entry-header .addthis_button {
2
+ margin:10px 0 10px 0;
3
  }
4
  .addthis_button_tweet {
5
  min-width: 83px;
7
  }
8
  .atwidget iframe {
9
  max-width:none;
10
+ }
img/addthis_pill_style.png ADDED
Binary file
img/compact.png ADDED
Binary file
img/counters.gif ADDED
Binary file
img/facebook_like.png ADDED
Binary file
img/google_plusone.png ADDED
Binary file
img/hyves_respect.png ADDED
Binary file
img/linkedin_counter.png ADDED
Binary file
img/pinterest_pinit.png ADDED
Binary file
img/tweet.png ADDED
Binary file
img/widget056.gif ADDED
Binary file
includes/addthis_addjs.php CHANGED
@@ -50,8 +50,9 @@ Class AddThis_addjs{
50
  $this->_options = $options;
51
 
52
  // Version of AddThis code to use
53
- $this->atversion = array_key_exists('atversion_update_status', $options) && $options['atversion_update_status'] == ADDTHIS_ATVERSION_REVERTED ? $options['atversion'] : ADDTHIS_ATVERSION;
54
-
 
55
  // set the cuid
56
  $base = get_option('home');
57
  $cuid = hash_hmac('md5', $base, 'addthis');
50
  $this->_options = $options;
51
 
52
  // Version of AddThis code to use
53
+ if (is_array($options)) {
54
+ $this->atversion = array_key_exists('atversion_update_status', $options) && $options['atversion_update_status'] == ADDTHIS_ATVERSION_REVERTED ? $options['atversion'] : ADDTHIS_ATVERSION;
55
+ }
56
  // set the cuid
57
  $base = get_option('home');
58
  $cuid = hash_hmac('md5', $base, 'addthis');
js/gtc-sharing-personalize.js ADDED
@@ -0,0 +1,1623 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($, window, document, undefined) {
2
+
3
+ var aboveshareNamespace = window.addthisnamespaces && window.addthisnamespaces['aboveshare'] ? addthisnamespaces['aboveshare']: 'addthis-share-above';
4
+ var belowshareNamespace = window.addthisnamespaces && window.addthisnamespaces['belowshare'] ? addthisnamespaces['belowshare']: 'addthis-share-below';
5
+
6
+ /* Event Tracking */
7
+ function trackPageView(p) {
8
+ if (typeof gaPageTracker != "undefined") gaPageTracker._trackPageview(p);
9
+ }
10
+
11
+ // jQuery ready event
12
+ $(function() {
13
+
14
+ $('.above-smart-sharing-container .restore-default-options').hide();
15
+ $('.below-smart-sharing-container .restore-default-options').hide();
16
+ $('#below').tooltip({ position: { my: "left+15 center", at: "right center" } });
17
+ $('.sortable .disabled').tooltip({ position: { my: "left+15 center", at: "right center" } });
18
+ $('.sortable .close').tooltip({ position: { my: "left+10 center", at: "right center" } });
19
+ setTimeout(function() {
20
+
21
+ window.customServicesAPI.events().fetchServices();
22
+
23
+ }, 0);
24
+
25
+ });
26
+
27
+ // API for the custom service UI
28
+ window.customServicesAPI = {
29
+
30
+ 'loadDeferred': $.Deferred(),
31
+
32
+ 'scriptIncluded': false,
33
+
34
+ 'sorted': false,
35
+
36
+ 'servicesEndpoint': 'https://cache.addthiscdn.com/services/v1/sharing.en.ssl.jsonp?jsonpcallback=loadServices',
37
+
38
+ 'loadJS': function(file) {
39
+
40
+ var self = this,
41
+ script = document.createElement('script');
42
+
43
+ script.src = file;
44
+
45
+ document.body.appendChild(script);
46
+
47
+ return self.loadDeferred;
48
+
49
+ },
50
+
51
+ // defaults button list
52
+ 'defaults': [
53
+ 'facebook_like',
54
+ 'tweet',
55
+ /*'email',*/
56
+ 'pinterest_pinit',
57
+ 'google_plusone',
58
+ /*'linkedin_counter',*/
59
+ 'compact'
60
+ ],
61
+
62
+ 'totalServices': [],
63
+
64
+ 'thirdPartyButtons': {
65
+
66
+ // Exclude list that will exclude certain services from showing up
67
+ 'exclude': {
68
+ 'horizontal': [
69
+ 'stumbleupon_badge'
70
+ ],
71
+ 'vertical': [
72
+ 'pinterest_pinit',
73
+ 'hyves_respect',
74
+ 'stumbleupon_badge'
75
+ ]
76
+ },
77
+
78
+ 'services': function() {
79
+
80
+ var self = this;
81
+
82
+ return [
83
+
84
+ {
85
+ 'service': 'facebook_like',
86
+ 'name': 'Facebook',
87
+ 'linkedService': 'facebook',
88
+ 'icon': 'facebook',
89
+ 'attrs': {
90
+ 'horizontal': 'fb:like:layout="button_count"',
91
+ 'vertical': 'fb:like:layout="box_count"'
92
+ }
93
+ },
94
+
95
+ {
96
+ 'service': 'tweet',
97
+ 'name': 'Twitter',
98
+ 'linkedService': 'twitter',
99
+ 'icon': 'twitter',
100
+ 'attrs': {
101
+ 'horizontal': '',
102
+ 'vertical': 'tw:count="vertical"'
103
+ }
104
+ },
105
+
106
+ {
107
+ 'service': 'pinterest_pinit',
108
+ 'name': 'Pinterest',
109
+ 'linkedService': 'pinterest_share',
110
+ 'icon': 'pinterest_share',
111
+ 'attrs': {
112
+ 'horizontal': '',
113
+ 'vertical': ''
114
+ }
115
+ },
116
+
117
+ {
118
+ 'service': 'google_plusone',
119
+ 'name': 'Google +1',
120
+ 'linkedService': 'google_plusone_share',
121
+ 'icon': 'google_plusone',
122
+ 'attrs': {
123
+ 'horizontal': 'g:plusone:size="medium"',
124
+ 'vertical': 'g:plusone:size="tall"'
125
+ }
126
+ },
127
+
128
+ {
129
+ 'service': 'hyves_respect',
130
+ 'name': 'Hyves',
131
+ 'linkedService': 'hyves',
132
+ 'icon': 'hyves',
133
+ 'attrs': {
134
+ 'horizontal': '',
135
+ 'vertical': ''
136
+ }
137
+ },
138
+
139
+ {
140
+ 'service': 'linkedin_counter',
141
+ 'name': 'LinkedIn',
142
+ 'linkedService': 'linkedin',
143
+ 'icon': 'linkedin',
144
+ 'attrs': {
145
+ 'horizontal': '',
146
+ 'vertical': 'li:counter="top"'
147
+ }
148
+ },
149
+
150
+ {
151
+ 'service': 'stumbleupon_badge',
152
+ 'name': 'Stumbleupon',
153
+ 'linkedService': 'stumbleupon',
154
+ 'icon': 'stumbleupon',
155
+ 'attrs': {
156
+ 'horizontal': '',
157
+ 'vertical': ''
158
+ }
159
+ },
160
+
161
+ {
162
+ 'service': 'compact',
163
+ 'name': 'More',
164
+ 'linkedService': 'compact',
165
+ 'icon': 'compact',
166
+ 'attrs': {
167
+ 'horizontal': '',
168
+ 'vertical': ''
169
+ }
170
+ }
171
+
172
+ ];
173
+
174
+ }
175
+
176
+ },
177
+
178
+ 'addthisButtons': {
179
+
180
+ // Exclude list that will exclude certain services from showing up
181
+ 'exclude': [
182
+ 'facebook_like',
183
+ 'pinterest'
184
+ ],
185
+
186
+ // All AddThis supported services get pulled in dynamically from a jsonp endpoint
187
+ 'services': []
188
+
189
+ },
190
+
191
+ 'fetchServices': function() {
192
+
193
+ var self = this,
194
+ def = $.Deferred();
195
+
196
+ if(self.scriptIncluded) {
197
+ def.resolve(self.addthisButtons.services);
198
+ return def;
199
+ }
200
+
201
+ else {
202
+
203
+ self.loadJS(self.servicesEndpoint).done(function(services) {
204
+
205
+ self.scriptIncluded = true;
206
+
207
+ def.resolve(services);
208
+
209
+ });
210
+
211
+ }
212
+
213
+ return def;
214
+
215
+ },
216
+
217
+ 'abovepopulateSharingServices': function(restoreDefaults, pageload) {
218
+
219
+ var self = this,
220
+ def = $.Deferred(),
221
+ defaults,
222
+ services,
223
+ currentType,
224
+ addthisMappedDefaults,
225
+ thirdPartyMappedDefaults,
226
+ addthisServices,
227
+ thirdPartyServices,
228
+ abovesharingSortable = $('.above-smart-sharing-container .sharing-buttons .sortable'),
229
+ aboveselectedSortable = $('.above-smart-sharing-container .selected-services .sortable');
230
+
231
+ self.fetchServices().done(function(services) {
232
+
233
+ if(!services.length) {
234
+
235
+ def.resolve();
236
+
237
+ }
238
+
239
+ else {
240
+
241
+ self.getaboveSavedOrder(function(obj) {
242
+
243
+ defaults = restoreDefaults ? self.defaults: obj.rememberedDefaults;
244
+
245
+ abovecurrentType = $('input[name="addthis_settings[above]"]:checked');
246
+
247
+ if(!abovecurrentType.length) {
248
+ abovecurrentType = $('input[name="addthis_settings[above]"]:visible').first();
249
+ }
250
+
251
+ if(abovecurrentType.length) {
252
+
253
+ if(abovecurrentType.attr('id') == 'large_toolbox_above') {
254
+ style = "horizontal";
255
+ abovecurrentType = "addthisButtons";
256
+ }
257
+ else if(abovecurrentType.attr('id') == 'fb_tw_p1_sc_above') {
258
+ style = "horizontal";
259
+ abovecurrentType = "thirdPartyButtons";
260
+ }
261
+ else if(abovecurrentType.attr('id') == 'small_toolbox_above') {
262
+ style = "horizontal";
263
+ abovecurrentType = "addthisButtons";
264
+ }
265
+ else if(abovecurrentType.attr('id') == 'button_above') {
266
+ style = "";
267
+ abovecurrentType = "image";
268
+ }
269
+
270
+
271
+
272
+ addthisMappedDefaults = _.map(defaults, function(value) {
273
+ var service = _.where(self.thirdPartyButtons.services(), { 'service': value });
274
+ if(service.length) {
275
+ return service[0].linkedService;
276
+ }
277
+ else {
278
+ return value;
279
+ }
280
+ });
281
+ thirdPartyMappedDefaults = _.map(defaults, function(value) {
282
+ var service = _.where(self.thirdPartyButtons.services(), { 'linkedService': value });
283
+ if(service.length) {
284
+ return service[0].service;
285
+ }
286
+ else {
287
+ return value;
288
+ }
289
+ });
290
+
291
+ defaults = abovecurrentType === 'addthisButtons' ? addthisMappedDefaults: thirdPartyMappedDefaults;
292
+
293
+ addthisServices = self.sort({ defaults: addthisMappedDefaults, services: self.totalServices });
294
+
295
+ thirdPartyServices = self.sort({ defaults: thirdPartyMappedDefaults, services: self.totalServices });
296
+
297
+ if(abovecurrentType === 'addthisButtons') {
298
+ self.populateList({ elem: abovesharingSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'sharing-buttons', buttonType: 'addthisButtons' });
299
+
300
+ self.populateList({ elem: aboveselectedSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'selected-services', buttonType: 'addthisButtons' });
301
+
302
+ }
303
+
304
+ if(abovecurrentType === 'thirdPartyButtons' && style === 'horizontal') {
305
+ self.populateList({ elem: abovesharingSortable, services: thirdPartyServices, exclude: self.thirdPartyButtons.exclude['horizontal'], defaults: thirdPartyMappedDefaults, type: 'sharing-buttons', style: 'horizontal', buttonType: 'thirdPartyButtons' });
306
+
307
+ self.populateList({ elem: aboveselectedSortable, services: thirdPartyServices, exclude: self.thirdPartyButtons.exclude['horizontal'], defaults: thirdPartyMappedDefaults, type: 'selected-services', style: 'horizontal', buttonType: 'thirdPartyButtons' });
308
+
309
+ }
310
+
311
+ $('body').trigger('populatedList');
312
+ def.resolve();
313
+
314
+ }
315
+
316
+ else {
317
+ $('body').trigger('populatedList');
318
+ def.resolve();
319
+ }
320
+ });
321
+
322
+ }
323
+
324
+ });
325
+
326
+ return def;
327
+
328
+ },
329
+
330
+ 'belowpopulateSharingServices': function(restoreDefaults, pageload) {
331
+
332
+ var self = this,
333
+ def = $.Deferred(),
334
+ defaults,
335
+ services,
336
+ currentType,
337
+ addthisMappedDefaults,
338
+ thirdPartyMappedDefaults,
339
+ addthisServices,
340
+ thirdPartyServices,
341
+ belowsharingSortable = $('.below-smart-sharing-container .sharing-buttons .sortable'),
342
+ belowselectedSortable = $('.below-smart-sharing-container .selected-services .sortable');
343
+
344
+ self.fetchServices().done(function(services) {
345
+
346
+ if(!services.length) {
347
+
348
+ def.resolve();
349
+
350
+ }
351
+
352
+ else {
353
+
354
+ self.getbelowSavedOrder(function(obj) {
355
+
356
+ defaults = restoreDefaults ? self.defaults: obj.rememberedDefaults;
357
+
358
+
359
+ belowcurrentType = $('input[name="addthis_settings[below]"]:checked');
360
+
361
+ if(!belowcurrentType.length) {
362
+ belowcurrentType = $('input[name="addthis_settings[above]"]:visible').first();
363
+ }
364
+
365
+ if(belowcurrentType.length) {
366
+
367
+ if(belowcurrentType.attr('id') == 'large_toolbox_below') {
368
+ style = "horizontal";
369
+ belowcurrentType = "addthisButtons";
370
+ }
371
+ else if(belowcurrentType.attr('id') == 'fb_tw_p1_sc_below') {
372
+ style = "horizontal";
373
+ belowcurrentType = "thirdPartyButtons";
374
+ }
375
+ else if(belowcurrentType.attr('id') == 'small_toolbox_below') {
376
+ style = "horizontal";
377
+ belowcurrentType = "addthisButtons";
378
+ }
379
+ else if(belowcurrentType.attr('id') == 'button_below') {
380
+ style = "";
381
+ belowcurrentType = "image";
382
+ }
383
+
384
+ addthisMappedDefaults = _.map(defaults, function(value) {
385
+ var service = _.where(self.thirdPartyButtons.services(), { 'service': value });
386
+ if(service.length) {
387
+ return service[0].linkedService;
388
+ }
389
+ else {
390
+ return value;
391
+ }
392
+ });
393
+ thirdPartyMappedDefaults = _.map(defaults, function(value) {
394
+ var service = _.where(self.thirdPartyButtons.services(), { 'linkedService': value });
395
+ if(service.length) {
396
+ return service[0].service;
397
+ }
398
+ else {
399
+ return value;
400
+ }
401
+ });
402
+
403
+ defaults = belowcurrentType === 'addthisButtons' ? addthisMappedDefaults: thirdPartyMappedDefaults;
404
+
405
+ addthisServices = self.sort({ defaults: addthisMappedDefaults, services: self.totalServices });
406
+
407
+ thirdPartyServices = self.sort({ defaults: thirdPartyMappedDefaults, services: self.totalServices });
408
+
409
+ if(belowcurrentType === 'addthisButtons') {
410
+ self.populateList({ elem: belowsharingSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'sharing-buttons', buttonType: 'addthisButtons' });
411
+
412
+ self.populateList({ elem: belowselectedSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'selected-services', buttonType: 'addthisButtons' });
413
+ }
414
+
415
+ if(belowcurrentType === 'thirdPartyButtons' && style === 'horizontal') {
416
+ self.populateList({ elem: belowsharingSortable, services: thirdPartyServices, exclude: self.thirdPartyButtons.exclude['horizontal'], defaults: thirdPartyMappedDefaults, type: 'sharing-buttons', style: 'horizontal', buttonType: 'thirdPartyButtons' });
417
+
418
+ self.populateList({ elem: belowselectedSortable, services: thirdPartyServices, exclude: self.thirdPartyButtons.exclude['horizontal'], defaults: thirdPartyMappedDefaults, type: 'selected-services', style: 'horizontal', buttonType: 'thirdPartyButtons' });
419
+
420
+ }
421
+
422
+ }
423
+ else {
424
+ $('body').trigger('populatedList');
425
+ def.resolve();
426
+ }
427
+
428
+ });
429
+
430
+ }
431
+
432
+ });
433
+
434
+ return def;
435
+
436
+ },
437
+
438
+ 'sort': function(obj) {
439
+ var self = this,
440
+ copiedItem,
441
+ whereInArray,
442
+ currentService,
443
+ defaults = obj.defaults,
444
+ services = $.merge([], obj.services);
445
+
446
+ // Sorts the addthis button list in the correct order
447
+ $.each(services, function(iterator, value) {
448
+ currentService = value.service;
449
+ whereInArray = $.inArray(currentService, defaults);
450
+ if(whereInArray !== -1) {
451
+ copiedItem = services[whereInArray];
452
+ services[whereInArray] = value;
453
+ services[iterator] = copiedItem;
454
+ }
455
+
456
+ });
457
+
458
+ return services;
459
+
460
+ },
461
+
462
+ 'populateList': function(obj) {
463
+
464
+ var self = this,
465
+ list = obj.elem,
466
+ listHtml = '',
467
+ service,
468
+ type = obj['type'],
469
+ services = obj.services,
470
+ iconService = '',
471
+ defaults = obj.defaults,
472
+ attrs,
473
+ name,
474
+ style = obj['style'],
475
+ duplicates = [],
476
+ buttonType = obj.buttonType;
477
+ buttonServices = buttonType === 'addthisButtons' ? self.addthisButtons.services: self.thirdPartyButtons.services(),
478
+ excludeList = obj.exclude,
479
+ thirdPartyDisabled = (function() {
480
+ var arr, disabledArr = [], serviceObj;
481
+ if(buttonType === 'addthisButtons' || type === 'selected-services') {
482
+ return disabledArr;
483
+ }
484
+ else {
485
+ arr = _.filter(self.thirdPartyButtons.exclude[style], function(value) {
486
+ return $.inArray(value, defaults) === -1;
487
+ }), disabledArr = [], serviceObj = {};
488
+ _.each(arr, function(value) {
489
+ serviceObj = _.where(self.thirdPartyButtons.services(), { service: value });
490
+ if(serviceObj.length) {
491
+ disabledArr.push(serviceObj[0]);
492
+ }
493
+ });
494
+ }
495
+ return disabledArr;
496
+ }()),
497
+ disabledServices = (buttonType === 'addthisButtons' || type === 'selected-services') ? []: $.merge($.merge([], self.disabledServices), thirdPartyDisabled),
498
+ selectedDefaults = [],
499
+ isDuplicate = false,
500
+ isDefault = false,
501
+ isExcluded = false,
502
+ containsService = false;
503
+
504
+ for(var key in services) {
505
+
506
+ if(services.hasOwnProperty(key)) {
507
+
508
+ value = services[key];
509
+ service = (value.service) || key;
510
+ name = value.name;
511
+ iconService = value.icon;
512
+ isDuplicate = $.inArray(service, duplicates) !== -1,
513
+ isDefault = $.inArray(service, defaults) !== -1,
514
+ isExcluded = $.inArray(service, excludeList) !== -1;
515
+ containsService = _.where(buttonServices , { 'service': service }).length;
516
+
517
+ if(!isDuplicate) {
518
+
519
+ if(type === "selected-services") {
520
+
521
+ if(defaults && isDefault) {
522
+
523
+ selectedDefaults.push(service);
524
+
525
+ if(!containsService || isExcluded) {
526
+ listHtml += "<li class='disabled service' data-service='" + service + "' title='The " + name + " button is not supported in this style'><span class='at300bs at15nc at15t_" + iconService + " at16t_" + iconService + "' style='display:inline-block;padding-right:10px;vertical-align:middle;margin-left:10px;'></span><span class='service-name'>" + name + "</span><button type='button' title='Remove' class='close'>x</button></li>";
527
+ }
528
+
529
+ else {
530
+ listHtml += "<li class='enabled service' data-service='" + service + "'><span class='at300bs at15nc at15t_" + iconService + " at16t_" + iconService + "' style='display:inline-block;padding-right:10px;vertical-align:middle;margin-left:10px;'></span><span class='service-name'>" + name + "</span><button type='button' title='Remove' class='close'>x</button></li>";
531
+ }
532
+
533
+ }
534
+
535
+ }
536
+
537
+ else {
538
+
539
+ if(defaults && !isDefault && !isExcluded) {
540
+
541
+ if(containsService) {
542
+
543
+ listHtml += "<li class='enabled service' data-service='" + service + "'><span class='at300bs at15nc at15t_" + iconService + " at16t_" + iconService + "' style='display:inline-block;padding-right:10px;vertical-align:middle;margin-left:10px;'></span><span class='service-name'>" + name + "</span><button type='button' title='Remove' class='close'>x</button></li>";
544
+ }
545
+ }
546
+
547
+ }
548
+
549
+ duplicates.push(service);
550
+
551
+ }
552
+
553
+ }
554
+
555
+ }
556
+
557
+ if(disabledServices.length) {
558
+ $.each(disabledServices, function(iterator, disabledService) {
559
+ var service = disabledService.service,
560
+ iconService = disabledService.icon,
561
+ name = disabledService['name'];
562
+ listHtml += "<li class='disabled service' data-service='" + service + "' title='The " + name + " button is not supported in this style'><span class='at300bs at15nc at15t_" + iconService + " at16t_" + iconService + "' style='display:inline-block;padding-right:10px;vertical-align:middle;margin-left:10px;'></span><span class='service-name'>" + name + "</span><button type='button' title='Remove' class='close'>×</button></li>";
563
+ });
564
+ }
565
+
566
+ if(!defaults.length && type === 'selected-services') {
567
+ listHtml = '<p class="add-buttons-msg">Add buttons by dragging them in this box.</p>';
568
+ list.css('border-style', 'dashed');
569
+ }
570
+ else if(defaults.length && type === 'selected-services') {
571
+ list.css('border-style', 'solid');
572
+ }
573
+
574
+ list.html(listHtml).data('selectedDefaults', selectedDefaults);
575
+
576
+ return self;
577
+
578
+ },
579
+
580
+ 'getaboveSavedOrder': function(callback) {
581
+
582
+ var self = this;
583
+
584
+ if(window.commonMethods && window.commonMethods.localStorageSettings) {
585
+
586
+ commonMethods.localStorageSettings({ namespace: aboveshareNamespace, method: 'get' }, function(obj) {
587
+
588
+ callback.call(self, obj || { rememberedDefaults: self.defaults });
589
+
590
+ });
591
+
592
+ }
593
+
594
+ else {
595
+
596
+ callback.call(self, {});
597
+
598
+ }
599
+
600
+ return self;
601
+
602
+ },
603
+
604
+ 'getbelowSavedOrder': function(callback) {
605
+
606
+ var self = this;
607
+
608
+ if(window.commonMethods && window.commonMethods.localStorageSettings) {
609
+
610
+ commonMethods.localStorageSettings({ namespace: belowshareNamespace, method: 'get' }, function(obj) {
611
+
612
+ callback.call(self, obj || { rememberedDefaults: self.defaults });
613
+
614
+ });
615
+
616
+ }
617
+
618
+ else {
619
+
620
+ callback.call(self, {});
621
+
622
+ }
623
+
624
+ return self;
625
+
626
+ },
627
+
628
+ 'abovesaveOrder': function(obj) {
629
+
630
+ var self = this,
631
+ defaults = [],
632
+ dynamicObj = {},
633
+ size = obj['size'],
634
+ type = obj['type'],
635
+ style = obj['style'],
636
+ updatedItem = obj['item'],
637
+
638
+ currentService,
639
+ elem = obj.elem,
640
+ serviceItems = elem.find('li'),
641
+ enabled = elem.find('li.enabled'),
642
+ disabled = elem.find('li.disabled'),
643
+ enabledDefaults = [],
644
+ removed = true;
645
+
646
+ serviceItems.each(function(iterator) {
647
+ currentService = $(this).attr('data-service');
648
+ defaults.push(currentService);
649
+ if(currentService === updatedItem) {
650
+ removed = false;
651
+ }
652
+ if($(this).hasClass('enabled')) {
653
+ enabledDefaults.push(currentService);
654
+ }
655
+ });
656
+
657
+ if(updatedItem) {
658
+ if(removed) {
659
+ trackPageView('/tracker/gtc/' + (window.page || '') + '/event/removed_' + updatedItem);
660
+ }
661
+ else {
662
+ trackPageView('/tracker/gtc/' + (window.page || '') + '/event/select_add_' + updatedItem);
663
+ }
664
+ }
665
+
666
+ if(window.commonMethods && window.commonMethods.localStorageSettings) {
667
+ dynamicObj['rememberedDefaults'] = defaults;
668
+ commonMethods.localStorageSettings({ namespace: aboveshareNamespace, method: 'set', data: dynamicObj });
669
+ setTimeout(function() {
670
+
671
+ self.aboveupdatePreview({ size: size, services: enabledDefaults, type: type, style: style, location: location });
672
+
673
+ }, 1000);
674
+
675
+ }
676
+
677
+ return self;
678
+
679
+ },
680
+
681
+ 'belowsaveOrder': function(obj) {
682
+
683
+ var self = this,
684
+ defaults = [],
685
+ dynamicObj = {},
686
+ size = obj['size'],
687
+ type = obj['type'],
688
+ style = obj['style'],
689
+ updatedItem = obj['item'],
690
+
691
+ currentService,
692
+ elem = obj.elem,
693
+ serviceItems = elem.find('li'),
694
+ enabled = elem.find('li.enabled'),
695
+ disabled = elem.find('li.disabled'),
696
+ enabledDefaults = [],
697
+ removed = true;
698
+
699
+ serviceItems.each(function(iterator) {
700
+ currentService = $(this).attr('data-service');
701
+ defaults.push(currentService);
702
+ if(currentService === updatedItem) {
703
+ removed = false;
704
+ }
705
+ if($(this).hasClass('enabled')) {
706
+ enabledDefaults.push(currentService);
707
+ }
708
+ });
709
+
710
+ if(updatedItem) {
711
+ if(removed) {
712
+ trackPageView('/tracker/gtc/' + (window.page || '') + '/event/removed_' + updatedItem);
713
+ }
714
+ else {
715
+ trackPageView('/tracker/gtc/' + (window.page || '') + '/event/select_add_' + updatedItem);
716
+ }
717
+ }
718
+
719
+ if(window.commonMethods && window.commonMethods.localStorageSettings) {
720
+ dynamicObj['rememberedDefaults'] = defaults;
721
+ commonMethods.localStorageSettings({ namespace: belowshareNamespace, method: 'set', data: dynamicObj });
722
+ setTimeout(function() {
723
+
724
+ self.belowupdatePreview({ size: size, services: enabledDefaults, type: type, style: style, location: location });
725
+
726
+ }, 1000);
727
+
728
+ }
729
+
730
+ return self;
731
+
732
+ },
733
+
734
+ 'aboveupdatePreview': function(obj) {
735
+
736
+ var self = this,
737
+ size = obj['size'],
738
+ style = obj['style'],
739
+ services = obj.services,
740
+ type = obj['type'],
741
+ buttons = '';
742
+ if (size == "large") {
743
+ buttons += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
744
+ $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
745
+ $(this).find('li').each(function(){
746
+ if($(this).hasClass('enabled')) {
747
+ buttons += '<span class="at300bs at15nc at15t_'+$(this).attr('data-service')+' at16t_'+$(this).attr('data-service')+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
748
+ if($(this).attr('data-service') == 'compact') {
749
+ buttons += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block;float: left;" href="#" tabindex="0"></a>';
750
+ }
751
+ }
752
+ });
753
+ });
754
+ buttons += '</div>';
755
+ }
756
+ else if (size == "small") {
757
+ $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
758
+ $(this).find('li').each(function(){
759
+ if($(this).hasClass('enabled')) {
760
+ buttons += '<span class="at300bs at15nc at15t_'+$(this).attr('data-service')+' at16t_'+$(this).attr('data-service')+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
761
+ if($(this).attr('data-service') == 'compact') {
762
+ buttons += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block;float: left;" href="#" tabindex="0"></a>';
763
+ }
764
+ }
765
+ });
766
+ });
767
+ }
768
+ else {
769
+ $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
770
+ $(this).find('li').each(function(){
771
+ if($(this).hasClass('enabled')) {
772
+ if($(this).attr('data-service') == 'compact') {
773
+ buttons += '<img src="'+addthis_params.img_base+'addthis_pill_style.png">';
774
+ }
775
+ else {
776
+ buttons += '<img src="'+addthis_params.img_base+$(this).attr('data-service')+'.png">';
777
+ }
778
+ }
779
+ });
780
+ });
781
+ }
782
+
783
+ $('#above_previewContainer').html(buttons);
784
+ },
785
+
786
+
787
+ 'belowupdatePreview': function(obj) {
788
+
789
+ var self = this,
790
+ size = obj['size'],
791
+ style = obj['style'],
792
+ services = obj.services,
793
+ type = obj['type'],
794
+ buttons = '';
795
+ if (size == "large") {
796
+ buttons += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
797
+ $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
798
+ $(this).find('li').each(function(){
799
+ if($(this).hasClass('enabled')) {
800
+ buttons += '<span class="at300bs at15nc at15t_'+$(this).attr('data-service')+' at16t_'+$(this).attr('data-service')+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
801
+ if($(this).attr('data-service') == 'compact') {
802
+ buttons += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
803
+ }
804
+ }
805
+ });
806
+ });
807
+ buttons += '</div>';
808
+ }
809
+ else if (size == "small") {
810
+ $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
811
+ $(this).find('li').each(function(){
812
+ if($(this).hasClass('enabled')) {
813
+ buttons += '<span class="at300bs at15nc at15t_'+$(this).attr('data-service')+' at16t_'+$(this).attr('data-service')+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
814
+ if($(this).attr('data-service') == 'compact') {
815
+ buttons += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
816
+ }
817
+ }
818
+ });
819
+ });
820
+ }
821
+ else {
822
+ $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
823
+ $(this).find('li').each(function(){
824
+ if($(this).hasClass('enabled')) {
825
+ if($(this).attr('data-service') == 'compact') {
826
+ buttons += '<img src="'+addthis_params.img_base+'addthis_pill_style.png">';
827
+ }
828
+ else {
829
+ buttons += '<img src="'+addthis_params.img_base+$(this).attr('data-service')+'.png">';
830
+ }
831
+ }
832
+ });
833
+ });
834
+ }
835
+ $('#below_previewContainer').html(buttons);
836
+ },
837
+
838
+ 'events': function() {
839
+
840
+ var self = this,
841
+ aboveEnableSmartSharing = $('#above-enable-smart-sharing'),
842
+ aboveDisableSmartSharing = $('#above-disable-smart-sharing'),
843
+ belowEnableSmartSharing = $('#below-enable-smart-sharing'),
844
+ belowDisableSmartSharing = $('#below-disable-smart-sharing'),
845
+
846
+ sortableContainer,
847
+ aboveradioInputs = $('input[name="addthis_settings[above]"]'),
848
+ belowradioInputs = $('input[name="addthis_settings[below]"]'),
849
+ abovecurrentRadioInput,
850
+ belowcurrentRadioInput,
851
+ abovecurrentType,
852
+ belowcurrentType,
853
+ abovecurrentStyle,
854
+ belowcurrentStyle,
855
+ excludeList,
856
+ whereInputs = $('input[name=where]'),
857
+ aboveSmartSharingContainer = $('.above-smart-sharing-container'),
858
+ aboveSmartSharingInnerContainer = $('.above-smart-sharing-container .smart-sharing-inner-container'),
859
+ aboveCustomizeButtons = $('.above-smart-sharing-container .customize-buttons'),
860
+ aboveButtons = $('.above-smart-sharing-container .customize-buttons'),
861
+ belowSmartSharingContainer = $('.below-smart-sharing-container'),
862
+ belowSmartSharingInnerContainer = $('.below-smart-sharing-container .smart-sharing-inner-container'),
863
+ belowCustomizeButtons = $('.below-smart-sharing-container .customize-buttons'),
864
+ belowButtons = $('.below-smart-sharing-container .customize-buttons'),
865
+ defaults,
866
+ buttontype,
867
+ buttonsize,
868
+ buttonstyle,
869
+ sortableLists = $('.sortable'),
870
+ sortableListItems = sortableLists.find('li'),
871
+ sortableSelectedListItems = $('.selected-services').find('li'),
872
+ sortableListItemsCloseIcons = sortableSelectedListItems.find('.close'),
873
+ aboveRestoreDefaultOptions = $('.above-smart-sharing-container .restore-default-options'),
874
+ belowRestoreDefaultOptions = $('.below-smart-sharing-container .restore-default-options'),
875
+ previewBox = $('#previewBox'),
876
+ aboverestoreToDefault = _.debounce(function() {
877
+ // Updates the personalization UI
878
+ self.abovepopulateSharingServices(true);
879
+ $('.above-smart-sharing-container .selected-services .sortable:visible').trigger('sortupdate');
880
+ commonMethods.localStorageSettings({ method: "remove", namespace: aboveshareNamespace });
881
+ }, 1000, true),
882
+ belowrestoreToDefault = _.debounce(function() {
883
+ // Updates the personalization UI
884
+ self.belowpopulateSharingServices(true);
885
+ $('.below-smart-sharing-container .selected-services .sortable:visible').trigger('sortupdate');
886
+ commonMethods.localStorageSettings({ method: "remove", namespace: belowshareNamespace });
887
+ }, 1000, true),
888
+ aboveEnableCustomization = _.debounce(function() {
889
+ trackPageView('/tracker/gtc/' + (window.page || '') + '/event/enable_customization');
890
+ }, 1000, true),
891
+ belowEnableCustomization = _.debounce(function() {
892
+ trackPageView('/tracker/gtc/' + (window.page || '') + '/event/enable_customization');
893
+ }, 1000, true),
894
+ disableCustomization = _.debounce(function() {
895
+ trackPageView('/tracker/gtc/' + (window.page || '') + '/event/disable_customization');
896
+ }, 1000, true);
897
+
898
+ //to show options upon save
899
+ if($('#above-chosen-list').val() != "") {
900
+ $('.above-smart-sharing-container #customizedMessage').show();
901
+ $('.above-smart-sharing-container #personalizedMessage').hide();
902
+ // $('.above-smart-sharing-container .customize-your-buttons').html('Your buttons are currently customized. <a href="#" class="above-customize-sharing-link customize-your-buttons">Show customization</a>.');
903
+ }
904
+
905
+ if($('#below-chosen-list').val() != "") {
906
+ $('.below-smart-sharing-container #customizedMessage').show();
907
+ $('.below-smart-sharing-container #personalizedMessage').hide();
908
+ // $('.below-smart-sharing-container .customize-your-buttons').html('Your buttons are currently customized. <a href="#" class="below-customize-sharing-link customize-your-buttons">Show customization</a>.');
909
+ }
910
+
911
+ aboveDisableSmartSharing.add(aboveradioInputs).not('#button_above').bind('click', function() {
912
+
913
+ abovecurrentRadioInput = $('input[name="addthis_settings[above]"]:checked');
914
+ if(!abovecurrentRadioInput.length) {
915
+ abovecurrentRadioInput = $('input[name="addthis_settings[above]"]').first();
916
+ }
917
+
918
+ if(abovecurrentRadioInput.attr('id') == 'large_toolbox_above') {
919
+ abovecurrentStyle = "horizontal";
920
+ abovecurrentType = "addthisButtons";
921
+ }
922
+ else if(abovecurrentRadioInput.attr('id') == 'fb_tw_p1_sc_above') {
923
+ abovecurrentStyle = "horizontal";
924
+ abovecurrentType = "thirdPartyButtons";
925
+ }
926
+ else if(abovecurrentRadioInput.attr('id') == 'small_toolbox_above') {
927
+ abovecurrentStyle = "horizontal";
928
+ abovecurrentType = "addthisButtons";
929
+ }
930
+ else if(abovecurrentRadioInput.attr('id') == 'button_above') {
931
+ abovecurrentStyle = "";
932
+ abovecurrentType = "image";
933
+ }
934
+
935
+ if(aboveDisableSmartSharing.is(':checked')) {
936
+
937
+ if(abovecurrentType === 'addthisButtons' || abovecurrentType === 'thirdPartyButtons') {
938
+ aboveButtons.show();
939
+ }
940
+ else {
941
+ aboveButtons.hide();
942
+ }
943
+
944
+
945
+ aboveradioInputs.addClass('disabled-smart-sharing');
946
+
947
+ setTimeout(function() {
948
+
949
+ // Updates the personalization UI
950
+ self.abovepopulateSharingServices();
951
+
952
+ $('.above-smart-sharing-container .selected-services .sortable:visible').trigger('sortupdate');
953
+
954
+ }, 0);
955
+
956
+ aboveRestoreDefaultOptions.show();
957
+
958
+ $('.sharing-buttons-search').val('');
959
+
960
+ }
961
+
962
+ if(abovecurrentStyle === 'horizontal' && $('#above_previewContainer').width() < 380) {
963
+ $('#above_previewContainer').css({ 'width': '380px' });
964
+ }
965
+
966
+ aboveSmartSharingInnerContainer.show();
967
+ $('.above-customize-sharing-link, .customize-sharing-checkbox').show();
968
+
969
+ });
970
+
971
+ belowDisableSmartSharing.add(belowradioInputs).not('#button_below').bind('click', function() {
972
+
973
+ belowcurrentRadioInput = $('input[name="addthis_settings[below]"]:checked');
974
+ if(!belowcurrentRadioInput.length) {
975
+ belowcurrentRadioInput = $('input[name="addthis_settings[below]"]').first();
976
+ }
977
+
978
+ if(belowcurrentRadioInput.attr('id') == 'large_toolbox_below') {
979
+ belowcurrentStyle = "horizontal";
980
+ belowcurrentType = "addthisButtons";
981
+ }
982
+ else if(belowcurrentRadioInput.attr('id') == 'fb_tw_p1_sc_below') {
983
+ belowcurrentStyle = "horizontal";
984
+ belowcurrentType = "thirdPartyButtons";
985
+ }
986
+ else if(belowcurrentRadioInput.attr('id') == 'small_toolbox_below') {
987
+ belowcurrentStyle = "horizontal";
988
+ belowcurrentType = "addthisButtons";
989
+ }
990
+ else if(belowcurrentRadioInput.attr('id') == 'button_below') {
991
+ belowcurrentStyle = "";
992
+ belowcurrentType = "image";
993
+ }
994
+
995
+ if(belowDisableSmartSharing.is(':checked')) {
996
+
997
+ if(belowcurrentType === 'addthisButtons' || belowcurrentType === 'thirdPartyButtons') {
998
+ belowButtons.show();
999
+ }
1000
+ else {
1001
+ belowButtons.hide();
1002
+ }
1003
+
1004
+
1005
+ belowradioInputs.addClass('disabled-smart-sharing');
1006
+
1007
+ setTimeout(function() {
1008
+
1009
+ // Updates the personalization UI
1010
+ self.belowpopulateSharingServices();
1011
+
1012
+ $('.below-smart-sharing-container .selected-services .sortable:visible').trigger('sortupdate');
1013
+
1014
+ }, 0);
1015
+
1016
+ belowRestoreDefaultOptions.show();
1017
+
1018
+ $('.sharing-buttons-search').val('');
1019
+
1020
+ }
1021
+
1022
+ if(belowcurrentStyle === 'horizontal' && $('#below_previewContainer').width() < 380) {
1023
+ $('#below_previewContainer').css({ 'width': '380px' });
1024
+ }
1025
+
1026
+ belowSmartSharingInnerContainer.show();
1027
+ $('.below-customize-sharing-link, .customize-sharing-checkbox').show();
1028
+
1029
+ });
1030
+
1031
+ $('#button_above').click(function() {
1032
+ var self = $(this);
1033
+ $('.previewbox').removeClass('previewboxbg');
1034
+ aboveSmartSharingInnerContainer.hide();
1035
+ $('.above-customize-sharing-link, .customize-sharing-checkbox').hide();
1036
+ $('#above_previewContainer').css({ 'width': '100%', 'margin-right': 'auto' });
1037
+ });
1038
+
1039
+ $('#button_below').click(function() {
1040
+ var self = $(this);
1041
+ $('.previewbox').removeClass('previewboxbg');
1042
+ belowSmartSharingInnerContainer.hide();
1043
+ $('.below-customize-sharing-link, .customize-sharing-checkbox').hide();
1044
+ $('#below_previewContainer').css({ 'width': '100%', 'margin-right': 'auto' });
1045
+ });
1046
+
1047
+ aboveEnableSmartSharing.bind('click', function() {
1048
+ if($('#above-chosen-list').val() != "") {
1049
+ $('.above-smart-sharing-container #customizedMessage').hide();
1050
+ $('#above-chosen-list').val('');
1051
+ }
1052
+ else {
1053
+ $('.above-smart-sharing-container #customizedMessage').hide();
1054
+ }
1055
+
1056
+ currentRadioInput = $('input[name="addthis_settings[above]"]:checked');
1057
+
1058
+ disableCustomization();
1059
+
1060
+ aboveCustomizeButtons.hide();
1061
+
1062
+ aboveRestoreDefaultOptions.hide();
1063
+
1064
+ aboveradioInputs.removeClass('disabled-smart-sharing');
1065
+
1066
+ currentRadioInput.click();
1067
+
1068
+ });
1069
+
1070
+ belowEnableSmartSharing.bind('click', function() {
1071
+
1072
+ if($('#below-chosen-list').val() != "") {
1073
+ $('.below-smart-sharing-container #customizedMessage').hide();
1074
+ $('#below-chosen-list').val('');
1075
+ }
1076
+ else {
1077
+ $('.below-smart-sharing-container #customizedMessage').hide();
1078
+ }
1079
+
1080
+ currentRadioInput = $('input[name="addthis_settings[below]"]:checked');
1081
+
1082
+ disableCustomization();
1083
+
1084
+ belowCustomizeButtons.hide();
1085
+
1086
+ belowRestoreDefaultOptions.hide();
1087
+
1088
+ belowradioInputs.removeClass('disabled-smart-sharing');
1089
+
1090
+ currentRadioInput.click();
1091
+
1092
+ });
1093
+
1094
+ aboveDisableSmartSharing.bind('click', function() {
1095
+
1096
+ aboveEnableCustomization();
1097
+
1098
+ aboveCustomizeButtons.show();
1099
+
1100
+ });
1101
+
1102
+ belowDisableSmartSharing.bind('click', function() {
1103
+
1104
+ belowEnableCustomization();
1105
+
1106
+ belowCustomizeButtons.show();
1107
+
1108
+ });
1109
+
1110
+ aboveDisableSmartSharing.one('click', function() {
1111
+
1112
+ setTimeout(function() {
1113
+
1114
+ // Makes the new list sortable
1115
+ $('.above-smart-sharing-container .sortable').sortable({
1116
+
1117
+ placeholder: "sortable-placeholder",
1118
+
1119
+ revert: true,
1120
+
1121
+ scroll: false,
1122
+
1123
+ cancel: '.add-buttons-msg, .disabled',
1124
+
1125
+ start: function(ev, obj) {
1126
+ if(obj && obj.item) {
1127
+ if(obj.item.parent().parent().hasClass('sharing-buttons')) {
1128
+ obj.item.data('cancel', true);
1129
+ }
1130
+ else {
1131
+ obj.item.removeData('cancel');
1132
+ }
1133
+ }
1134
+ },
1135
+
1136
+ stop: function(ev, obj) {
1137
+ if(obj && obj.item) {
1138
+ if(obj.item.data('cancel') && obj.item.parent().parent().hasClass('sharing-buttons')) {
1139
+ return false;
1140
+ }
1141
+ else {
1142
+ obj.item.removeData('cancel');
1143
+ }
1144
+ }
1145
+ }
1146
+ }).disableSelection().sortable('option', 'connectWith', '.sortable');
1147
+
1148
+ }, 0);
1149
+
1150
+ });
1151
+
1152
+ belowDisableSmartSharing.one('click', function() {
1153
+
1154
+ setTimeout(function() {
1155
+
1156
+ // Makes the new list sortable
1157
+ $('.below-smart-sharing-container .sortable').sortable({
1158
+
1159
+ placeholder: "sortable-placeholder",
1160
+
1161
+ revert: true,
1162
+
1163
+ scroll: false,
1164
+
1165
+ cancel: '.add-buttons-msg, .disabled',
1166
+
1167
+ start: function(ev, obj) {
1168
+ if(obj && obj.item) {
1169
+ if(obj.item.parent().parent().hasClass('sharing-buttons')) {
1170
+ obj.item.data('cancel', true);
1171
+ }
1172
+ else {
1173
+ obj.item.removeData('cancel');
1174
+ }
1175
+ }
1176
+ },
1177
+
1178
+ stop: function(ev, obj) {
1179
+ if(obj && obj.item) {
1180
+ if(obj.item.data('cancel') && obj.item.parent().parent().hasClass('sharing-buttons')) {
1181
+ return false;
1182
+ }
1183
+ else {
1184
+ obj.item.removeData('cancel');
1185
+ }
1186
+ }
1187
+ }
1188
+ }).disableSelection().sortable('option', 'connectWith', '.sortable');
1189
+
1190
+ }, 0);
1191
+
1192
+ });
1193
+
1194
+ $('.above_button_set .selected-services .sortable').bind('sortupdate', function(ev, item) {
1195
+
1196
+ if($.isPlainObject(item)) {
1197
+ item = item.item.attr('data-service');
1198
+ }
1199
+
1200
+ if(!$(this).find('li').length) {
1201
+ $(this).html('<p class="add-buttons-msg">Add buttons by dragging them in this box.</p>');
1202
+ $(this).css('border-style', 'dashed');
1203
+ $('.add-buttons-msg').show();
1204
+ }
1205
+
1206
+ else {
1207
+ $(this).css('border-style', 'solid');
1208
+ }
1209
+
1210
+ var abovesortableList = $('.above-smart-sharing-container .selected-services .sortable:visible');
1211
+
1212
+ if(abovecurrentRadioInput.attr('id') == 'large_toolbox_above') {
1213
+ buttonstyle = "horizontal";
1214
+ buttontype = "addthisButtons";
1215
+ buttonsize = "large";
1216
+ }
1217
+ else if(abovecurrentRadioInput.attr('id') == 'fb_tw_p1_sc_above') {
1218
+ buttonstyle = "horizontal";
1219
+ buttontype = "thirdPartyButtons";
1220
+ buttonsize = "";
1221
+ }
1222
+ else if(abovecurrentRadioInput.attr('id') == 'small_toolbox_above') {
1223
+ buttonstyle = "horizontal";
1224
+ buttontype = "addthisButtons";
1225
+ buttonsize = "small";
1226
+ }
1227
+ else if(abovecurrentRadioInput.attr('id') == 'button_above') {
1228
+ buttonstyle = "";
1229
+ buttontype = "image";
1230
+ buttonsize = "";
1231
+ }
1232
+
1233
+ self.abovesaveOrder({ tool: 'above', type: buttontype, elem: abovesortableList, size: buttonsize, style: buttonstyle, item: item || "" });
1234
+
1235
+ });
1236
+
1237
+ $('.below_button_set .selected-services .sortable').bind('sortupdate', function(ev, item) {
1238
+
1239
+ if($.isPlainObject(item)) {
1240
+ item = item.item.attr('data-service');
1241
+ }
1242
+
1243
+ if(!$(this).find('li').length) {
1244
+ $(this).html('<p class="add-buttons-msg">Add buttons by dragging them in this box.</p>');
1245
+ $(this).css('border-style', 'dashed');
1246
+ $('.add-buttons-msg').show();
1247
+ }
1248
+
1249
+ else {
1250
+ $(this).css('border-style', 'solid');
1251
+ }
1252
+
1253
+ var belowsortableList = $('.below-smart-sharing-container .selected-services .sortable:visible');
1254
+
1255
+ if(belowcurrentRadioInput.attr('id') == 'large_toolbox_below') {
1256
+ buttonstyle = "horizontal";
1257
+ buttontype = "addthisButtons";
1258
+ buttonsize = "large";
1259
+ }
1260
+ else if(belowcurrentRadioInput.attr('id') == 'fb_tw_p1_sc_below') {
1261
+ buttonstyle = "horizontal";
1262
+ buttontype = "thirdPartyButtons";
1263
+ buttonsize = "";
1264
+ }
1265
+ else if(belowcurrentRadioInput.attr('id') == 'small_toolbox_below') {
1266
+ buttonstyle = "horizontal";
1267
+ buttontype = "addthisButtons";
1268
+ buttonsize = "small";
1269
+ }
1270
+ else if(belowcurrentRadioInput.attr('id') == 'button_below') {
1271
+ buttonstyle = "";
1272
+ buttontype = "image";
1273
+ buttonsize = "";
1274
+ }
1275
+
1276
+ self.belowsaveOrder({ tool: 'below', type: buttontype, elem: belowsortableList, size: buttonsize, style: buttonstyle, item: item || "" });
1277
+
1278
+ });
1279
+
1280
+ aboveRestoreDefaultOptions.bind('click', function(ev) {
1281
+
1282
+ ev.preventDefault();
1283
+
1284
+ setTimeout(function() {
1285
+
1286
+ $('.above-smart-sharing-container .sharing-buttons-search').val('');
1287
+
1288
+ aboverestoreToDefault();
1289
+
1290
+ }, 0);
1291
+
1292
+ });
1293
+
1294
+ belowRestoreDefaultOptions.bind('click', function(ev) {
1295
+
1296
+ ev.preventDefault();
1297
+
1298
+ setTimeout(function() {
1299
+
1300
+ $('.below-smart-sharing-container .sharing-buttons-search').val('');
1301
+
1302
+ belowrestoreToDefault();
1303
+
1304
+ }, 0);
1305
+
1306
+ });
1307
+
1308
+ sortableSelectedListItems.live({
1309
+
1310
+ 'mouseenter': function() {
1311
+
1312
+ $(this).find('.close').css('display', 'inline-block');
1313
+
1314
+ },
1315
+
1316
+ 'mouseleave': function() {
1317
+
1318
+ $(this).find('.close').hide();
1319
+
1320
+ },
1321
+
1322
+ 'mouseup': function() {
1323
+
1324
+ $(this).find('.close').hide();
1325
+
1326
+ }
1327
+
1328
+ });
1329
+
1330
+ sortableListItems.live({
1331
+
1332
+ 'mouseup': function() {
1333
+
1334
+ if(!$('.selected-services li:visible').length) {
1335
+
1336
+
1337
+ $('.add-buttons-msg').show();
1338
+
1339
+ }
1340
+
1341
+ },
1342
+
1343
+ 'mousedown': function() {
1344
+
1345
+ $('.add-buttons-msg').hide();
1346
+
1347
+ $('.below-smart-sharing-container .horizontal-drag').hide();
1348
+
1349
+ $('.above-smart-sharing-container .horizontal-drag').hide();
1350
+
1351
+ }
1352
+
1353
+ });
1354
+
1355
+ sortableListItemsCloseIcons.live('click', function() {
1356
+
1357
+ var parent = $(this).parent(),
1358
+ isDisabled = parent.hasClass('disabled');
1359
+ parent.fadeOut().promise().done(function() {
1360
+
1361
+ $('.sharing-buttons .sortable:visible').prepend(parent);
1362
+ parent.find('.close').hide().tooltip().tooltip('close');
1363
+ parent.fadeIn();
1364
+ $('.selected-services .sortable:visible').trigger('sortupdate', parent.attr('data-service'));
1365
+
1366
+ });
1367
+
1368
+ });
1369
+
1370
+ $('.above-smart-sharing-container .sharing-buttons-search').bind('keyup', function(e) {
1371
+
1372
+ var currentVal = $(this).val();
1373
+
1374
+ $('.above-smart-sharing-container .sharing-buttons .sortable').find('li').each(function() {
1375
+ if($(this).text().toLowerCase().search(currentVal.toLowerCase()) === -1) {
1376
+ $(this).hide().attr('data-hidden', 'true');
1377
+ }
1378
+ else {
1379
+ $(this).show().removeAttr('data-hidden');
1380
+ }
1381
+ });
1382
+
1383
+ });
1384
+
1385
+ $('.below-smart-sharing-container .sharing-buttons-search').bind('keyup', function(e) {
1386
+
1387
+ var currentVal = $(this).val();
1388
+
1389
+ $('.below-smart-sharing-container .sharing-buttons .sortable').find('li').each(function() {
1390
+ if($(this).text().toLowerCase().search(currentVal.toLowerCase()) === -1) {
1391
+ $(this).hide().attr('data-hidden', 'true');
1392
+ }
1393
+ else {
1394
+ $(this).show().removeAttr('data-hidden');
1395
+ }
1396
+ });
1397
+
1398
+ });
1399
+
1400
+ $('.sharing-buttons-search').bind('click', function() {
1401
+ trackPageView('/tracker/gtc/' + (window.page || '') + '/event/search_clicked');
1402
+ });
1403
+
1404
+ $('.above-smart-sharing-container .sortable').bind('mousedown', function() {
1405
+ if($('.above-smart-sharing-container .sharing-buttons-search').is(':focus')) {
1406
+ $('.above-smart-sharing-container .sharing-buttons-search').blur();
1407
+ }
1408
+ });
1409
+ $('.below-smart-sharing-container .sortable').bind('mousedown', function() {
1410
+ if($('.below-smart-sharing-container .sharing-buttons-search').is(':focus')) {
1411
+ $('.below-smart-sharing-container .sharing-buttons-search').blur();
1412
+ }
1413
+ });
1414
+
1415
+ $('.above-smart-sharing-container .selected-services .sortable').bind({
1416
+
1417
+ 'mouseover': function() {
1418
+ if($(this).find('li.enabled:visible').length > 1) {
1419
+ $('.above-smart-sharing-container .horizontal-drag').hide();
1420
+ $('.above-smart-sharing-container .vertical-drag').show();
1421
+ }
1422
+ },
1423
+ 'mouseout': function() {
1424
+ $('.above-smart-sharing-container .vertical-drag').hide();
1425
+ }
1426
+
1427
+ });
1428
+
1429
+ $('.below-smart-sharing-container .selected-services .sortable').bind({
1430
+
1431
+ 'mouseover': function() {
1432
+ if($(this).find('li.enabled:visible').length > 1) {
1433
+ $('.below-smart-sharing-container .horizontal-drag').hide();
1434
+ $('.below-smart-sharing-container .vertical-drag').show();
1435
+ }
1436
+ },
1437
+ 'mouseout': function() {
1438
+ $('.below-smart-sharing-container .vertical-drag').hide();
1439
+ }
1440
+
1441
+ });
1442
+
1443
+ $('.above-smart-sharing-container .sharing-buttons .sortable').bind({
1444
+
1445
+ 'mouseover': function() {
1446
+ if($(this).find('li.enabled:visible').length) {
1447
+ $('.above-smart-sharing-container .vertical-drag').hide();
1448
+ $('.above-smart-sharing-container .horizontal-drag').show();
1449
+ }
1450
+ },
1451
+ 'mouseout': function() {
1452
+ $('.above-smart-sharing-container .horizontal-drag').hide();
1453
+ }
1454
+
1455
+ });
1456
+
1457
+ $('.below-smart-sharing-container .sharing-buttons .sortable').bind({
1458
+
1459
+ 'mouseover': function() {
1460
+ if($(this).find('li.enabled:visible').length) {
1461
+ $('.below-smart-sharing-container .vertical-drag').hide();
1462
+ $('.below-smart-sharing-container .horizontal-drag').show();
1463
+ }
1464
+ },
1465
+ 'mouseout': function() {
1466
+ $('.below-smart-sharing-container .horizontal-drag').hide();
1467
+ }
1468
+
1469
+ });
1470
+
1471
+ $('.above-customize-sharing-link').bind('click', function(ev) {
1472
+
1473
+ var aboveSmartSharingLink = $('.above-smart-sharing-container .smart-sharing-link'),
1474
+ customizeButtonLink = $('.above-smart-sharing-container .customize-your-buttons');
1475
+
1476
+ ev.preventDefault();
1477
+
1478
+ if($(this).is(customizeButtonLink)) {
1479
+ customizeButtonLink.hide();
1480
+ aboveSmartSharingLink.show();
1481
+ if(!aboveDisableSmartSharing.is(':checked')) {
1482
+ aboveDisableSmartSharing.prop('checked', true).trigger('click');
1483
+ }
1484
+ }
1485
+
1486
+ else if($(this).is(aboveSmartSharingLink)) {
1487
+ aboveSmartSharingLink.hide();
1488
+ customizeButtonLink.show();
1489
+ if(!aboveEnableSmartSharing.is(':checked')) {
1490
+ aboveEnableSmartSharing.prop('checked', true).trigger('click');
1491
+ }
1492
+ }
1493
+
1494
+ });
1495
+
1496
+ $('.below-customize-sharing-link').bind('click', function(ev) {
1497
+
1498
+ var belowSmartSharingLink = $('.below-smart-sharing-container .smart-sharing-link'),
1499
+ customizeButtonLink = $('.below-smart-sharing-container .customize-your-buttons');
1500
+
1501
+ ev.preventDefault();
1502
+
1503
+ if($(this).is(customizeButtonLink)) {
1504
+ customizeButtonLink.hide();
1505
+ belowSmartSharingLink.show();
1506
+ if(!belowDisableSmartSharing.is(':checked')) {
1507
+ belowDisableSmartSharing.prop('checked', true).trigger('click');
1508
+ }
1509
+ }
1510
+
1511
+ else if($(this).is(belowSmartSharingLink)) {
1512
+ belowSmartSharingLink.hide();
1513
+ customizeButtonLink.show();
1514
+ if(!belowEnableSmartSharing.is(':checked')) {
1515
+ belowEnableSmartSharing.prop('checked', true).trigger('click');
1516
+ }
1517
+ }
1518
+
1519
+ });
1520
+
1521
+ $('body').bind({
1522
+
1523
+ 'populatedList': function() {
1524
+ setTimeout(function() {
1525
+ $('.sortable .disabled, .sortable .close').tooltip({
1526
+ position: {
1527
+ my: 'left+15 top',
1528
+ at: 'right top',
1529
+ collision: 'none',
1530
+ tooltipClass: 'custom-tooltip-styling'
1531
+ }
1532
+ });
1533
+ $('.above-smart-sharing-container .sortable .disabled').bind('mouseover', function() {
1534
+ $('.above-smart-sharing-container .horizontal-drag, .above-smart-sharing-container .vertical-drag').hide();
1535
+ });
1536
+ $('.above-smart-sharing-container .sharing-buttons .enabled').bind('mouseenter', function() {
1537
+ if($(this).parent().parent().hasClass('sharing-buttons')) {
1538
+ $('.above-smart-sharing-container .horizontal-drag').show();
1539
+ }
1540
+ });
1541
+ $('.above-smart-sharing-container .selected-services .enabled').bind('mouseenter', function() {
1542
+ $('.above-smart-sharing-container .vertical-drag').show();
1543
+ });
1544
+ $('.below-smart-sharing-container .sortable .disabled').bind('mouseover', function() {
1545
+ $('.below-smart-sharing-container .horizontal-drag, .below-smart-sharing-container .vertical-drag').hide();
1546
+ });
1547
+ $('.below-smart-sharing-container .sharing-buttons .enabled').bind('mouseenter', function() {
1548
+ if($(this).parent().parent().hasClass('sharing-buttons')) {
1549
+ $('.below-smart-sharing-container .horizontal-drag').show();
1550
+ }
1551
+ });
1552
+ $('.below-smart-sharing-container .selected-services .enabled').bind('mouseenter', function() {
1553
+ $('.below-smart-sharing-container .vertical-drag').show();
1554
+ });
1555
+ },0);
1556
+ }
1557
+ });
1558
+
1559
+ return self;
1560
+
1561
+ }
1562
+
1563
+ };
1564
+
1565
+ // Helps Fetch all of the service names
1566
+ window.loadServices = function(response) {
1567
+
1568
+ var serviceList = [],
1569
+ currentService = '',
1570
+ itemCopy,
1571
+ addthisButtonPath = 'http://cache.addthiscdn.com/icons/v1/thumbs/addthis.gif',
1572
+ customServicesAPI = window.customServicesAPI,
1573
+ duplicateServices = customServicesAPI.duplicateServices = {},
1574
+ checkDuplicateName = {},
1575
+ checkDuplicateService = {},
1576
+ service,
1577
+ thirdPartyButtons = customServicesAPI.thirdPartyButtons.services();
1578
+
1579
+ $(function() {
1580
+
1581
+ customServicesAPI.addthisButtons.services = serviceList;
1582
+ if((response||{}).data) {
1583
+ for (var i = 0; i < response.data.length; i += 1) {
1584
+ currentService = response.data[i].code;
1585
+ if(currentService === 'pinterest') {
1586
+ service = { service: 'pinterest_share', name: 'Pinterest', icon: 'pinterest_share' };
1587
+ }
1588
+ else {
1589
+ service = { service: currentService, name: response.data[i].name, icon: currentService };
1590
+ }
1591
+ checkDuplicateName['name'] = response.data[i].name;
1592
+ checkDuplicateService['service'] = currentService;
1593
+ if(_.where(thirdPartyButtons, checkDuplicateName).length) {
1594
+ duplicateServices[currentService] = service;
1595
+ }
1596
+ if(!_.where(thirdPartyButtons, checkDuplicateService).length) {
1597
+ serviceList.push(service);
1598
+ }
1599
+ }
1600
+ }
1601
+
1602
+ try {
1603
+
1604
+ if(!_.where(serviceList, { 'service': 'compact' } ).length) {
1605
+ serviceList.push({ service: "compact", name: "More", icon: 'compact' });
1606
+ }
1607
+
1608
+ } catch(e) {}
1609
+
1610
+ customServicesAPI.totalServices = $.merge($.merge([],serviceList), customServicesAPI.thirdPartyButtons.services());
1611
+
1612
+ customServicesAPI.disabledServices = _.filter(serviceList, function(service) {
1613
+ return !_.where(customServicesAPI.thirdPartyButtons.services(), { 'linkedService': service.service }).length;
1614
+ });
1615
+
1616
+ customServicesAPI.loadDeferred.resolve(serviceList);
1617
+
1618
+ });
1619
+
1620
+ };
1621
+
1622
+ }(window.jQuery, window, document));
1623
+
js/gtc.cover.js ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ window.commonMethods = {
2
+
3
+ localStorageSettings: function(obj, callback) {
4
+
5
+ var tempObj = {};
6
+
7
+ if(!obj.namespace || !obj.namespace.length || !obj.method || !obj.method.length) return;
8
+
9
+ if(window.localStorage && window.JSON) {
10
+
11
+ if(obj.method.toLowerCase() === "get") {
12
+
13
+ callback.call(this, JSON.parse(window.localStorage.getItem(obj.namespace)));
14
+
15
+ }
16
+
17
+ else if(obj.method.toLowerCase() === "set" && obj.data != null && $.isPlainObject(obj.data)) {
18
+
19
+ tempObj = $.extend({}, JSON.parse(window.localStorage.getItem(obj.namespace)), obj.data);
20
+
21
+ return window.localStorage.setItem(obj.namespace, JSON.stringify(tempObj));
22
+
23
+ }
24
+
25
+ else if(obj.method.toLowerCase() === "set" && obj.data != null && $.isArray(obj.data)) {
26
+
27
+ return window.localStorage.setItem(obj.namespace, JSON.stringify(obj.data));
28
+
29
+
30
+ }
31
+
32
+ else if(obj.method.toLowerCase() === "remove") {
33
+
34
+ return window.localStorage.removeItem(obj.namespace);
35
+
36
+ }
37
+
38
+ }
39
+
40
+ },
41
+
42
+ resetOptions: function(namespace, obj, callback) {
43
+
44
+ if(obj) {
45
+
46
+ for(var x in obj) {
47
+
48
+ if($(x).is(':checkbox') || $(x).is(':radio')) $(x).prop('checked', obj[x]).change();
49
+
50
+ else $(x).val(obj[x]).change().keyup();
51
+
52
+ }
53
+
54
+ if(window.localStorage && namespace) {
55
+
56
+ commonMethods.localStorageSettings({ namespace: namespace, method: "remove" });
57
+
58
+ }
59
+
60
+ if(callback) callback.call(this);
61
+
62
+ }
63
+
64
+ },
65
+
66
+ loadCode: function (namespace, callback) {
67
+
68
+ commonMethods.localStorageSettings({ namespace: namespace, method: "get" }, function(obj) {
69
+
70
+ if(obj) {
71
+
72
+ for(var x in obj) {
73
+
74
+ if($(x).is(':checkbox') || $(x).is(':radio')) {
75
+
76
+ $(x).prop('checked', obj[x]).val(obj[x]);
77
+
78
+ if($(x).is(':checked')) $(x).trigger('auto-dismiss');
79
+
80
+ }
81
+
82
+ else $(x).val(obj[x]).attr("data-updated", "updated");
83
+
84
+ }
85
+
86
+ }
87
+
88
+ if(callback) callback.call(this, obj);
89
+
90
+ });
91
+
92
+ }
93
+
94
+ };
95
+
96
+ window.addthisnamespaces = {
97
+ aboveshare: 'addthis-share-above',
98
+ belowshare: 'addthis-share-below'
99
+ };
100
+
101
+ $(function() {
102
+
103
+ });
js/options-page.32.js CHANGED
@@ -1,8 +1,11 @@
1
- jQuery(document).ready(function($) {
 
2
  $( "#config-error" ).hide();
3
  $( "#share-error" ).hide();
4
  $( "#tabs" ).tabs();
5
- var thickDims, tbWidth, tbHeight;
 
 
6
  thickDims = function() {
7
  var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
8
 
@@ -17,6 +20,7 @@ jQuery(document).ready(function($) {
17
  }
18
  };
19
 
 
20
  $('a.thickbox-preview').click( function() {
21
 
22
  var previewLink = this;
@@ -45,6 +49,7 @@ jQuery(document).ready(function($) {
45
 
46
 
47
  jQuery.post(ajaxurl, data, function(response) {
 
48
  // Fix for WP 2.9's version of lightbox
49
  if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
50
  {
@@ -76,50 +81,9 @@ jQuery(document).ready(function($) {
76
  return false;
77
  });
78
 
79
- /**
80
- * Handle enable disable top and bottom share buttons
81
- */
82
- $("#enable_above, #enable_below").click(enableShareIconsClickHandler);
83
-
84
- function enableShareIconsClickHandler(){
85
- toggleShareIconsContainer($(this));
86
- }
87
- function toggleShareIconsContainer(element){
88
- var animationContainer = element.closest("td").find(".select_row");
89
- if (!element.attr("checked")) {
90
- animationContainer.css("opacity", 0.4);
91
- animationContainer.find("input").attr("disabled", true);
92
- } else {
93
- animationContainer.css("opacity", 1);
94
- animationContainer.find("input").attr("disabled", false);
95
- }
96
- }
97
- toggleShareIconsContainer($("#enable_above"));
98
- toggleShareIconsContainer($("#enable_below"));
99
-
100
- var show_above = $('input[name="addthis_settings[show_above]"]');
101
- var show_below = $('input[name="addthis_settings[show_below]"]');
102
- if ( show_above.prop('checked') != "undefined" && show_above.prop('checked') == true)
103
- {
104
- $('.above_option').toggleClass('hide');
105
- }
106
-
107
- if ( show_below.prop('checked') != "undefined" && show_below.prop('checked') == true)
108
- {
109
- $('.below_option').toggleClass('hide');
110
- }
111
-
112
- $('input[name="addthis_settings[show_above]"]').change( function() {
113
- $('.above_option').toggleClass('hide');
114
- });
115
-
116
- $('input[name="addthis_settings[show_below]"]').change( function() {
117
- $('.below_option').toggleClass('hide');
118
- });
119
-
120
  var aboveCustom = $('#above_custom_button');
121
  var aboveCustomShow = function(){
122
- if ( aboveCustom.prop('checked') != 'undefined' && aboveCustom.prop('checked') == true)
123
  {
124
  $('.above_option_custom').removeClass('hidden');
125
  }
@@ -131,7 +95,7 @@ jQuery(document).ready(function($) {
131
 
132
  var belowCustom = $('#below_custom_button');
133
  var belowCustomShow = function(){
134
- if ( belowCustom.prop('checked') != 'undefined' && belowCustom.prop('checked') == true)
135
  {
136
  $('.below_option_custom').removeClass('hidden');
137
  }
@@ -141,9 +105,29 @@ jQuery(document).ready(function($) {
141
  }
142
  };
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  var aboveCustomString = $('#above_custom_string');
145
  var aboveCustomStringShow = function(){
146
- if ( aboveCustomString.prop('checked') != 'undefined' && aboveCustomString.prop('checked') == true)
147
  {
148
  $('.above_custom_string_input').removeClass('hidden');
149
  }
@@ -155,7 +139,7 @@ jQuery(document).ready(function($) {
155
 
156
  var belowCustomString = $('#below_custom_string');
157
  var belowCustomStringShow = function(){
158
- if ( belowCustomString.prop('checked') != 'undefined' && belowCustomString.prop('checked') == true)
159
  {
160
  $('.below_custom_string_input').removeClass('hidden');
161
  }
@@ -171,7 +155,7 @@ jQuery(document).ready(function($) {
171
  belowCustomStringShow();
172
 
173
  $('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow(); aboveCustomStringShow();} );
174
- $('input[name="addthis_settings[below]"]').change( function(){belowCustomShow(); belowCustomStringShow();} );
175
 
176
  /**
177
  * Hide Theming and branding options when user selects version 3.0 or above
@@ -206,7 +190,7 @@ jQuery(document).ready(function($) {
206
  $(this).closest("form").submit();
207
  return false;
208
  });
209
-
210
  var addthis_credential_validation_status = $("#addthis_credential_validation_status");
211
  var addthis_validation_message = $("#addthis-credential-validation-message");
212
  var addthis_profile_validation_message = $("#addthis-profile-validation-message");
@@ -291,7 +275,7 @@ jQuery(document).ready(function($) {
291
  addthis_validation_message.next().hide();
292
  }
293
  });
294
-
295
  $('#addthis-config-json').focusout(function() {
296
  var error = 0;
297
  if ($('#addthis-config-json').val() != " ") {
@@ -306,8 +290,7 @@ jQuery(document).ready(function($) {
306
  if (error == 0) {
307
  $('#config-error').hide();
308
  return true;
309
- }
310
- else {
311
  $('#config-error').show();
312
  return false;
313
  }
@@ -327,8 +310,7 @@ jQuery(document).ready(function($) {
327
  if (error == 0) {
328
  $('#share-error').hide();
329
  return true;
330
- }
331
- else {
332
  $('#share-error').show();
333
  return false;
334
  }
@@ -340,27 +322,540 @@ jQuery(document).ready(function($) {
340
  var error = 0;
341
  if ($('#addthis-config-json').val() != " ") {
342
  try {
343
- var addthis_config_json = jQuery.parseJSON($('#addthis-config-json').val());
344
  }
345
- catch (e) {
346
- $('#config-error').show();
347
- error = 1;
348
  }
349
  }
350
  if ($('#addthis-share-json').val() != " ") {
351
  try {
352
- var addthis_share_json = jQuery.parseJSON($('#addthis-share-json').val());
353
  }
354
- catch (e) {
355
- $('#share-error').show();
356
- error = 1;
357
  }
358
  }
359
- if (error == 0) {
360
  return true;
361
- }
362
- else {
363
  return false;
364
  }
365
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  });
 
1
+ jQuery(document).ready(function($) {
2
+
3
  $( "#config-error" ).hide();
4
  $( "#share-error" ).hide();
5
  $( "#tabs" ).tabs();
6
+
7
+ var thickDims, tbWidth, tbHeight, img = abvimg = belimg = '';
8
+
9
  thickDims = function() {
10
  var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
11
 
20
  }
21
  };
22
 
23
+
24
  $('a.thickbox-preview').click( function() {
25
 
26
  var previewLink = this;
49
 
50
 
51
  jQuery.post(ajaxurl, data, function(response) {
52
+
53
  // Fix for WP 2.9's version of lightbox
54
  if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
55
  {
81
  return false;
82
  });
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  var aboveCustom = $('#above_custom_button');
85
  var aboveCustomShow = function(){
86
+ if ( aboveCustom.is(':checked'))
87
  {
88
  $('.above_option_custom').removeClass('hidden');
89
  }
95
 
96
  var belowCustom = $('#below_custom_button');
97
  var belowCustomShow = function(){
98
+ if ( belowCustom.is(':checked'))
99
  {
100
  $('.below_option_custom').removeClass('hidden');
101
  }
105
  }
106
  };
107
 
108
+ var show_above = $('input[name="addthis_settings[show_above]"]');
109
+ var show_below = $('input[name="addthis_settings[show_below]"]');
110
+ if ( $('#input[name="addthis_settings[show_above]"]').is(':checked'))
111
+ {
112
+ $('.above_option').toggleClass('hide');
113
+ }
114
+
115
+ if ( $('#input[name="addthis_settings[show_below]"]').is(':checked'))
116
+ {
117
+ $('.below_option').toggleClass('hide');
118
+ }
119
+
120
+ $('input[name="addthis_settings[show_above]"]').change( function() {
121
+ $('.above_option').toggleClass('hide');
122
+ });
123
+
124
+ $('input[name="addthis_settings[show_below]"]').change( function() {
125
+ $('.below_option').toggleClass('hide');
126
+ });
127
+
128
  var aboveCustomString = $('#above_custom_string');
129
  var aboveCustomStringShow = function(){
130
+ if ( aboveCustomString.is(':checked'))
131
  {
132
  $('.above_custom_string_input').removeClass('hidden');
133
  }
139
 
140
  var belowCustomString = $('#below_custom_string');
141
  var belowCustomStringShow = function(){
142
+ if ( belowCustomString.is(':checked'))
143
  {
144
  $('.below_custom_string_input').removeClass('hidden');
145
  }
155
  belowCustomStringShow();
156
 
157
  $('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow(); aboveCustomStringShow();} );
158
+ $('input[name="addthis_settings[below]"]').change( function(){belowCustomStringShow();} );
159
 
160
  /**
161
  * Hide Theming and branding options when user selects version 3.0 or above
190
  $(this).closest("form").submit();
191
  return false;
192
  });
193
+
194
  var addthis_credential_validation_status = $("#addthis_credential_validation_status");
195
  var addthis_validation_message = $("#addthis-credential-validation-message");
196
  var addthis_profile_validation_message = $("#addthis-profile-validation-message");
275
  addthis_validation_message.next().hide();
276
  }
277
  });
278
+
279
  $('#addthis-config-json').focusout(function() {
280
  var error = 0;
281
  if ($('#addthis-config-json').val() != " ") {
290
  if (error == 0) {
291
  $('#config-error').hide();
292
  return true;
293
+ } else {
 
294
  $('#config-error').show();
295
  return false;
296
  }
310
  if (error == 0) {
311
  $('#share-error').hide();
312
  return true;
313
+ } else {
 
314
  $('#share-error').show();
315
  return false;
316
  }
322
  var error = 0;
323
  if ($('#addthis-config-json').val() != " ") {
324
  try {
325
+ var addthis_config_json = jQuery.parseJSON($('#addthis-config-json').val());
326
  }
327
+ catch (e) {
328
+ $('#config-error').show();
329
+ error = 1;
330
  }
331
  }
332
  if ($('#addthis-share-json').val() != " ") {
333
  try {
334
+ var addthis_share_json = jQuery.parseJSON($('#addthis-share-json').val());
335
  }
336
+ catch (e) {
337
+ $('#share-error').show();
338
+ error = 1;
339
  }
340
  }
341
+ if (error == 0) {
342
  return true;
343
+ } else {
 
344
  return false;
345
  }
346
  });
347
+
348
+
349
+ //preview box
350
+ function rewriteServices(posn) {
351
+ var services = $('#'+posn+'-chosen-list').val();
352
+ var service = services.split(', ');
353
+ var i;
354
+ var newservice = '';
355
+ for (i = 0; i < (service.length); ++i) {
356
+ if(service[i] == 'linkedin') {
357
+ newservice += 'linkedin_counter, ';
358
+ }
359
+ else if(service[i] == 'facebook') {
360
+ newservice += 'facebook_like, ';
361
+ }
362
+ else if(service[i] == 'twitter') {
363
+ newservice += 'tweet, ';
364
+ }
365
+ else if(service[i] == 'pinterest_share') {
366
+ newservice += 'pinterest_pinit, ';
367
+ }
368
+ else if(service[i] == 'hyves') {
369
+ newservice += 'hyves_respect, ';
370
+ }
371
+ else if(service[i] == 'google_plusone_share') {
372
+ newservice += 'google_plusone, ';
373
+ }
374
+ else if(service[i] == 'counter' || service[i] == 'compact') {
375
+ newservice += service[i]+', ';
376
+ }
377
+ }
378
+ var newservices = newservice.slice(0,-2);
379
+ return newservices;
380
+ }
381
+
382
+ function revertServices(posn) {
383
+ var services = $('#'+posn+'-chosen-list').val();
384
+ var service = services.split(', ');
385
+ var i;
386
+ var newservice = '';
387
+ for (i = 0; i < (service.length); ++i) {
388
+ if(service[i] == 'facebook_like') {
389
+ newservice += 'facebook, ';
390
+ }
391
+ else if(service[i] == 'linkedin_counter') {
392
+ newservice += 'linkedin, ';
393
+ }
394
+ else if(service[i] == 'hyves_respect') {
395
+ newservice += 'hyves, ';
396
+ }
397
+ else if(service[i] == 'google_plusone') {
398
+ newservice += 'google_plusone_share, ';
399
+ }
400
+ else if(service[i] == 'tweet') {
401
+ newservice += 'twitter, ';
402
+ }
403
+ else if(service[i] == 'pinterest_pinit') {
404
+ newservice += 'pinterest_share, ';
405
+ }
406
+ else {
407
+ newservice += service[i]+', ';
408
+ }
409
+ }
410
+ var newservices = newservice.slice(0,-2);
411
+ return newservices;
412
+ }
413
+
414
+ function updatePreview(posn, style, option) {
415
+ var preview = '';
416
+ var service = option.split(', ');
417
+ var i;
418
+
419
+ if(style == 'large_toolbox') {
420
+ preview += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
421
+ for (i = 0; i < (service.length); ++i) {
422
+ if(service[i] == 'counter') {
423
+ preview += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
424
+ } else {
425
+ preview += '<span class="at300bs at15nc at15t_'+service[i]+' at16t_'+service[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
426
+ }
427
+ }
428
+ preview += '</div>';
429
+ }
430
+ else if(style == 'fb_tw_p1_sc') {
431
+ for (i = 0; i < (service.length); ++i) {
432
+ if(service[i] == 'compact') {
433
+ preview += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
434
+ }
435
+ else if(service[i] != 'counter') {
436
+ preview += '<img src="'+addthis_option_params.img_base+service[i]+'.png">';
437
+ }
438
+ }
439
+ }
440
+ else if(style == 'small_toolbox') {
441
+ for (i = 0; i < (service.length); ++i) {
442
+ if(service[i] == 'counter') {
443
+ preview += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float:left;" href="#" tabindex="0"></a>';
444
+ } else {
445
+ preview += '<span class="at300bs at15nc at15t_'+service[i]+' at16t_'+service[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
446
+ }
447
+ }
448
+ }
449
+ $('#'+posn+'_previewContainer').html(preview);
450
+ }
451
+ if($('#large_toolbox_above').is(':checked')) {
452
+ if($('#above-chosen-list').val() == "") {
453
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">';
454
+ } else {
455
+ abvimg += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
456
+ var aboveserv = $('#above-chosen-list').val();
457
+ var aservice = aboveserv.split(', ');
458
+ var i;
459
+ for (i = 0; i < (aservice.length); ++i) {
460
+ if(aservice[i] == 'counter') {
461
+ abvimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
462
+ } else {
463
+ abvimg += '<span class="at300bs at15nc at15t_'+aservice[i]+' at16t_'+aservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
464
+ }
465
+ }
466
+ abvimg += '</div>';
467
+ }
468
+ $('.above_button_set').css('opacity', 1);
469
+ $('.above-customize-sharing-link').css('opacity', 1);
470
+ $('.above-smart-sharing-container').show();
471
+ $('#above_previewContainer').html(abvimg);
472
+ } else if($('#fb_tw_p1_sc_above').is(':checked')) {
473
+ if($('#above-chosen-list').val() == "") {
474
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">';
475
+ } else {
476
+ var aboveserv = $('#above-chosen-list').val();
477
+ var aservice = aboveserv.split(', ');
478
+ var i;
479
+ for (i = 0; i < (aservice.length); ++i) {
480
+ if(aservice[i] == 'compact') {
481
+ abvimg += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
482
+ }
483
+ else if(aservice[i] != 'counter') {
484
+ abvimg += '<img src="'+addthis_option_params.img_base+aservice[i]+'.png">';
485
+ }
486
+ }
487
+ }
488
+ $('.above_button_set').css('opacity', 1);
489
+ $('.above-customize-sharing-link').css('opacity', 1);
490
+ $('.above-smart-sharing-container').show();
491
+ $('#above_previewContainer').html(abvimg);
492
+ } else if($('#small_toolbox_above').is(':checked')) {
493
+ if($('#above-chosen-list').val() == "") {
494
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">';
495
+ } else {
496
+ var aboveserv = $('#above-chosen-list').val();
497
+ var aservice = aboveserv.split(', ');
498
+ var i;
499
+ for (i = 0; i < (aservice.length); ++i) {
500
+ if(aservice[i] == 'counter') {
501
+ abvimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float:left;" href="#" tabindex="0"></a>';
502
+ } else {
503
+ abvimg += '<span class="at300bs at15nc at15t_'+aservice[i]+' at16t_'+aservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
504
+ }
505
+ }
506
+ }
507
+ $('.above_button_set').css('opacity', 1);
508
+ $('.above-customize-sharing-link').css('opacity', 1);
509
+ $('.above-smart-sharing-container').show();
510
+ $('#above_previewContainer').html(abvimg);
511
+ } else if($('#button_above').is(':checked')) {
512
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">';
513
+ $('.above_button_set').css('opacity', 1);
514
+ $('.above-customize-sharing-link').css('opacity', 0);
515
+ $('.above-smart-sharing-container').hide();
516
+ $('#above_previewContainer').html(abvimg);
517
+ } else if($('#disable_above').is(':checked')) {
518
+ abvimg = '';
519
+ $('.above_button_set').css('opacity', 0.4);
520
+ $('.above-customize-sharing-link').css('opacity', 0);
521
+ $('.above-smart-sharing-container').hide();
522
+ $('#above_previewContainer').html(abvimg);
523
+ }
524
+
525
+ if($('#large_toolbox_below').is(':checked')) {
526
+ if($('#below-chosen-list').val() == "") {
527
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">';
528
+ } else {
529
+ belimg += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
530
+ var belowserv = $('#below-chosen-list').val();
531
+ var bservice = belowserv.split(', ');
532
+ var i;
533
+ for (i = 0; i < (bservice.length); ++i) {
534
+ if(bservice[i] == 'counter') {
535
+ belimg +='<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
536
+ } else {
537
+ belimg += '<span class="at300bs at15nc at15t_'+bservice[i]+' at16t_'+bservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
538
+ }
539
+ }
540
+ belimg += '</div>';
541
+
542
+ }
543
+ $('.below_button_set').css('opacity', 1);
544
+ $('.below-customize-sharing-link').css('opacity', 1);
545
+ $('.below-smart-sharing-container').show();
546
+ $('#below_previewContainer').html(belimg);
547
+ } else if($('#fb_tw_p1_sc_below').is(':checked')) {
548
+ if($('#below-chosen-list').val() == "") {
549
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">';
550
+ } else {
551
+ var belowserv = $('#below-chosen-list').val();
552
+ var bservice = belowserv.split(', ');
553
+ var i;
554
+ for (i = 0; i < (bservice.length-1); ++i) {
555
+ if(bservice[i] == 'compact') {
556
+ belimg += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
557
+ } else if(bservice[i] != 'counter') {
558
+ belimg += '<img src="'+addthis_option_params.img_base+bservice[i]+'.png">';
559
+ }
560
+ }
561
+ }
562
+ $('.below_button_set').css('opacity', 1);
563
+ $('.below-customize-sharing-link').css('opacity', 1);
564
+ $('.below-smart-sharing-container').show();
565
+ $('#below_previewContainer').html(belimg);
566
+ } else if($('#small_toolbox_below').is(':checked')) {
567
+ if($('#below-chosen-list').val() == "") {
568
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">';
569
+ } else {
570
+ var belowserv = $('#below-chosen-list').val();
571
+ var bservice = belowserv.split(', ');
572
+ var i;
573
+ for (i = 0; i < (bservice.length); ++i) {
574
+ if(bservice[i] == 'counter') {
575
+ belimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
576
+ } else {
577
+ belimg += '<span class="at300bs at15nc at15t_'+bservice[i]+' at16t_'+bservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
578
+ }
579
+ }
580
+ }
581
+ $('.below_button_set').css('opacity', 1);
582
+ $('.below-customize-sharing-link').css('opacity', 1);
583
+ $('.below-smart-sharing-container').show();
584
+ $('#below_previewContainer').html(belimg);
585
+ } else if($('#button_below').is(':checked')) {
586
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">';
587
+ $('.below_button_set').css('opacity', 1);
588
+ $('.below-customize-sharing-link').css('opacity', 0);
589
+ $('.below-smart-sharing-container').hide();
590
+ $('#below_previewContainer').html(belimg);
591
+ } else if($('#disable_below').is(':checked')) {
592
+ belimg = '';
593
+ $('.below_button_set').css('opacity', 0.4);
594
+ $('.below-customize-sharing-link').css('opacity', 0);
595
+ $('.below-smart-sharing-container').hide();
596
+ $('#below_previewContainer').html(belimg);
597
+ }
598
+
599
+ $("#large_toolbox_above").click( function() {
600
+ if($('#above-chosen-list').val() != '') {
601
+ var newserv = revertServices('above');
602
+ updatePreview('above', 'large_toolbox', newserv);
603
+ $('#above-chosen-list').val(newserv);
604
+ }
605
+ else {
606
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">');
607
+ }
608
+ $('.above_button_set').css('opacity', 1);
609
+ $('.above-customize-sharing-link').css('opacity', 1);
610
+ $('.above-smart-sharing-container').show();
611
+ });
612
+
613
+ $("#large_toolbox_below").click( function() {
614
+ if($('#below-chosen-list').val() != '') {
615
+ var newserv = revertServices('below');
616
+ updatePreview('below', 'large_toolbox', newserv);
617
+ $('#below-chosen-list').val(newserv);
618
+ }
619
+ else {
620
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">');
621
+ }
622
+ $('.below_button_set').css('opacity', 1);
623
+ $('.below-customize-sharing-link').css('opacity', 1);
624
+ $('.below-smart-sharing-container').show();
625
+ });
626
+
627
+ $("#fb_tw_p1_sc_above").click( function() {
628
+ if($('#above-chosen-list').val() != '') {
629
+ var newserv = rewriteServices('above');
630
+ updatePreview('above', 'fb_tw_p1_sc', newserv);
631
+ $('#above-chosen-list').val(newserv);
632
+ }
633
+ else {
634
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">');
635
+ }
636
+ $('.above_button_set').css('opacity', 1);
637
+ $('.above-customize-sharing-link').css('opacity', 1);
638
+ $('.above-smart-sharing-container').show();
639
+ });
640
+
641
+ $("#fb_tw_p1_sc_below").click( function() {
642
+ if($('#below-chosen-list').val() != '') {
643
+ var newserv = rewriteServices('below');
644
+ updatePreview('below', 'fb_tw_p1_sc', newserv);
645
+ $('#below-chosen-list').val(newserv);
646
+ }
647
+ else {
648
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">');
649
+ }
650
+ $('.below_button_set').css('opacity', 1);
651
+ $('.below-customize-sharing-link').css('opacity', 1);
652
+ $('.below-smart-sharing-container').show();
653
+ });
654
+
655
+ $("#small_toolbox_above").click( function() {
656
+ if($('#above-chosen-list').val() != '') {
657
+ var newserv = revertServices('above');
658
+ updatePreview('above', 'small_toolbox', newserv);
659
+ $('#above-chosen-list').val(newserv);
660
+ }
661
+ else {
662
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">');
663
+ }
664
+ $('.above_button_set').css('opacity', 1);
665
+ $('.above-customize-sharing-link').css('opacity', 1);
666
+ $('.above-smart-sharing-container').show();
667
+ });
668
+
669
+ $("#small_toolbox_below").click( function() {
670
+ if($('#below-chosen-list').val() != '') {
671
+ var newserv = revertServices('below');
672
+ updatePreview('below', 'small_toolbox', newserv);
673
+ $('#below-chosen-list').val(newserv);
674
+ }
675
+ else {
676
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">');
677
+ }
678
+ $('.below_button_set').css('opacity', 1);
679
+ $('.below-customize-sharing-link').css('opacity', 1);
680
+ $('.below-smart-sharing-container').show();
681
+ });
682
+
683
+ $("#button_above").click( function() {
684
+ if($(this).is(':checked')){
685
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">');
686
+ }
687
+ $('.above_button_set').css('opacity', 1);
688
+ $('.above-customize-sharing-link').css('opacity', 1);
689
+ $('.above-smart-sharing-container').show();
690
+ });
691
+
692
+ $("#button_below").click( function() {
693
+ if($(this).is(':checked')){
694
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">');
695
+ }
696
+ $('.below_button_set').css('opacity', 1);
697
+ $('.below-customize-sharing-link').css('opacity', 1);
698
+ $('.below-smart-sharing-container').show();
699
+ });
700
+
701
+ $("#disable_above").click( function() {
702
+ if($(this).is(':checked')){
703
+ $('#above_previewContainer').html('');
704
+ $('.above_button_set').css('opacity', 0.4);
705
+ $('.above-customize-sharing-link').css('opacity', 0);
706
+ $('.above-smart-sharing-container').hide();
707
+ }
708
+ });
709
+
710
+ $("#disable_below").click( function() {
711
+ if($(this).is(':checked')){
712
+ $('#below_previewContainer').html('');
713
+ $('.below_button_set').css('opacity', 0.4);
714
+ $('.below-customize-sharing-link').css('opacity', 0);
715
+ $('.below-smart-sharing-container').hide();
716
+ }
717
+ });
718
+
719
+ $('#submit-button').click(function() {
720
+ if($('#above-disable-smart-sharing').is(':checked')) {
721
+ if($('#button_above').is(':checked')) {
722
+ $('#above-chosen-list').val('');
723
+ } else if($('#disable_above').is(':checked')) {
724
+ $('#above-chosen-list').val('');
725
+ } else {
726
+ var list = [];
727
+ $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
728
+ var service = '';
729
+ $(this).find('li').each(function(){
730
+ if($(this).hasClass('enabled')) {
731
+ list.push($(this).attr('data-service'));
732
+ if($(this).attr('data-service') == 'compact') {
733
+ list.push('counter');
734
+ }
735
+ }
736
+ });
737
+ });
738
+ var aboveservices = list.join(', ');
739
+ $('#above-chosen-list').val(aboveservices);
740
+ }
741
+ }
742
+ if($('#button_above').is(':checked')) {
743
+ $('#above-chosen-list').val('');
744
+ }
745
+ if($('#disable_above').is(':checked')) {
746
+ $('#above-chosen-list').val('');
747
+ }
748
+ if($('#above_custom_string').length > 0) {
749
+ if ( ! $('#above_custom_string').is(':checked') ) {
750
+ var toConfirm = confirm("Upon saving the custom code that has been saved will be removed permanently!Do you wish to continue?");
751
+ if (toConfirm == true)
752
+ {
753
+ return true;
754
+ } else {
755
+ return false;
756
+ }
757
+ }
758
+ }
759
+
760
+ if($('#below-disable-smart-sharing').is(':checked')) {
761
+ if($('#button_below').is(':checked')) {
762
+ $('#below-chosen-list').val('');
763
+ } else if($('#disable_below').is(':checked')) {
764
+ $('#below-chosen-list').val('');
765
+ } else {
766
+ var list = [];
767
+ $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
768
+ var service = '';
769
+ $(this).find('li').each(function(){
770
+ if($(this).hasClass('enabled')) {
771
+ list.push($(this).attr('data-service'));
772
+ if($(this).attr('data-service') == 'compact') {
773
+ list.push('counter');
774
+ }
775
+ }
776
+ });
777
+ });
778
+ var belowservices = list.join(', ');
779
+ $('#below-chosen-list').val(belowservices);
780
+ }
781
+ }
782
+ if($('#button_below').is(':checked')) {
783
+ $('#below-chosen-list').val('');
784
+ }
785
+ if($('#disable_below').is(':checked')) {
786
+ $('#below-chosen-list').val('');
787
+ }
788
+ if($('#below_custom_string').length > 0) {
789
+ if ( ! $('#below_custom_string').is(':checked') ) {
790
+ var toConfirm = confirm("Upon saving the custom code that has been saved will be removed permanently!Do you wish to continue?");
791
+ if (toConfirm == true)
792
+ {
793
+ return true;
794
+ } else {
795
+ return false;
796
+ }
797
+ }
798
+ }
799
+ });
800
+
801
+ var s = $("#preview_floater");
802
+ var pos = s.position();
803
+ $(window).scroll(function() {
804
+ var windowpos = $(window).scrollTop();
805
+
806
+ if (windowpos >= pos.top) {
807
+ s.addClass("stick");
808
+ } else {
809
+ s.removeClass("stick");
810
+ }
811
+ });
812
+
813
+ $('.folded #collapse-menu').click(function(){
814
+ $('#preview_floater').removeClass();
815
+ var s = $("#preview_floater");
816
+ var pos = s.position();
817
+ $(window).scroll(function() {
818
+ var windowpos = $(window).scrollTop();
819
+
820
+ if (windowpos >= pos.top) {
821
+ setTimeout(function(){$('#preview_floater').addClass('stick');},1);
822
+ }
823
+ });
824
+ });
825
+
826
+ var dataContent = '';
827
+ var dataTitle = '';
828
+ var innerContent = '';
829
+ var left = 0;
830
+ var top = 0;
831
+ var popoverHeight = 0;
832
+ var parent;
833
+ var me;
834
+ $('.row-right a').mouseover(function(){
835
+ me = $(this);
836
+ parent = $(me).parent();
837
+
838
+ dataContent = $(parent).attr('data-content');
839
+ dataTitle = $(parent).attr('data-original-title');
840
+ innerContent = "<div class='popover fade right in' style='display: block;'><div class='arrow'></div><h3 class='popover-title'>";
841
+ innerContent = innerContent + dataTitle;
842
+ innerContent = innerContent + "</h3><div class='popover-content'>";
843
+ innerContent = innerContent + dataContent;
844
+ innerContent = innerContent + "</div></div>";
845
+ $(parent).append(innerContent);
846
+
847
+ popoverHeight = $(parent).find('.popover').height();
848
+ left = $(me).position().left + 15;
849
+ top = $(me).position().top - (popoverHeight/2) + 8;
850
+
851
+ $(parent).find('.popover').css({
852
+ 'left': left+'px',
853
+ 'top': top+'px'
854
+ });
855
+ });
856
+ $('.row-right a').mouseout(function(){
857
+ $('.popover').remove();
858
+ });
859
+
860
  });
861
+
js/options-page.js CHANGED
@@ -1,8 +1,11 @@
1
  jQuery(document).ready(function($) {
 
2
  $( "#config-error" ).hide();
3
  $( "#share-error" ).hide();
4
  $( "#tabs" ).tabs();
5
- var thickDims, tbWidth, tbHeight;
 
 
6
  thickDims = function() {
7
  var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
8
 
@@ -17,6 +20,7 @@ jQuery(document).ready(function($) {
17
  }
18
  };
19
 
 
20
  $('a.thickbox-preview').click( function() {
21
 
22
  var previewLink = this;
@@ -77,51 +81,9 @@ jQuery(document).ready(function($) {
77
  return false;
78
  });
79
 
80
- /**
81
- * Handle enable disable top and bottom share buttons
82
- */
83
- $("#enable_above, #enable_below").click(enableShareIconsClickHandler);
84
-
85
- function enableShareIconsClickHandler(){
86
- toggleShareIconsContainer($(this));
87
- }
88
- function toggleShareIconsContainer(element){
89
- var animationContainer = element.closest("td").find(".select_row");
90
- if (!element.attr("checked")) {
91
- animationContainer.css("opacity", 0.4);
92
- animationContainer.find("input").attr("disabled", true);
93
- } else {
94
- animationContainer.css("opacity", 1);
95
- animationContainer.find("input").attr("disabled", false);
96
- }
97
- }
98
- toggleShareIconsContainer($("#enable_above"));
99
- toggleShareIconsContainer($("#enable_below"));
100
-
101
- var show_above = $('input[name="addthis_settings[show_above]"]');
102
- var show_below = $('input[name="addthis_settings[show_below]"]');
103
- if ( $('#input[name="addthis_settings[show_above]"]').is(':checked'))
104
- {
105
- $('.above_option').toggleClass('hide');
106
- }
107
-
108
- if ( $('#input[name="addthis_settings[show_below]"]').is(':checked'))
109
- {
110
- $('.below_option').toggleClass('hide');
111
- }
112
-
113
- $('input[name="addthis_settings[show_above]"]').change( function() {
114
- $('.above_option').toggleClass('hide');
115
- });
116
-
117
- $('input[name="addthis_settings[show_below]"]').change( function() {
118
- $('.below_option').toggleClass('hide');
119
- });
120
-
121
-
122
  var aboveCustom = $('#above_custom_button');
123
  var aboveCustomShow = function(){
124
- if ( $('#above_custom_button').is(':checked'))
125
  {
126
  $('.above_option_custom').removeClass('hidden');
127
  }
@@ -130,9 +92,10 @@ jQuery(document).ready(function($) {
130
  $('.above_option_custom').addClass('hidden');
131
  }
132
  };
 
133
  var belowCustom = $('#below_custom_button');
134
  var belowCustomShow = function(){
135
- if ( $('#below_custom_button').is(':checked'))
136
  {
137
  $('.below_option_custom').removeClass('hidden');
138
  }
@@ -142,9 +105,29 @@ jQuery(document).ready(function($) {
142
  }
143
  };
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  var aboveCustomString = $('#above_custom_string');
146
  var aboveCustomStringShow = function(){
147
- if ( $('#above_custom_string').is(':checked'))
148
  {
149
  $('.above_custom_string_input').removeClass('hidden');
150
  }
@@ -153,9 +136,10 @@ jQuery(document).ready(function($) {
153
  $('.above_custom_string_input').addClass('hidden');
154
  }
155
  };
 
156
  var belowCustomString = $('#below_custom_string');
157
  var belowCustomStringShow = function(){
158
- if ( $('#below_custom_string').is(':checked'))
159
  {
160
  $('.below_custom_string_input').removeClass('hidden');
161
  }
@@ -171,8 +155,8 @@ jQuery(document).ready(function($) {
171
  belowCustomStringShow();
172
 
173
  $('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow(); aboveCustomStringShow();} );
174
- $('input[name="addthis_settings[below]"]').change( function(){belowCustomShow(); belowCustomStringShow();} );
175
-
176
  /**
177
  * Hide Theming and branding options when user selects version 3.0 or above
178
  */
@@ -306,8 +290,7 @@ jQuery(document).ready(function($) {
306
  if (error == 0) {
307
  $('#config-error').hide();
308
  return true;
309
- }
310
- else {
311
  $('#config-error').show();
312
  return false;
313
  }
@@ -327,8 +310,7 @@ jQuery(document).ready(function($) {
327
  if (error == 0) {
328
  $('#share-error').hide();
329
  return true;
330
- }
331
- else {
332
  $('#share-error').show();
333
  return false;
334
  }
@@ -340,27 +322,539 @@ jQuery(document).ready(function($) {
340
  var error = 0;
341
  if ($('#addthis-config-json').val() != " ") {
342
  try {
343
- var addthis_config_json = jQuery.parseJSON($('#addthis-config-json').val());
344
  }
345
- catch (e) {
346
- $('#config-error').show();
347
- error = 1;
348
  }
349
  }
350
  if ($('#addthis-share-json').val() != " ") {
351
  try {
352
- var addthis_share_json = jQuery.parseJSON($('#addthis-share-json').val());
353
  }
354
- catch (e) {
355
- $('#share-error').show();
356
- error = 1;
357
  }
358
  }
359
- if (error == 0) {
360
  return true;
361
- }
362
- else {
363
  return false;
364
  }
365
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  });
 
1
  jQuery(document).ready(function($) {
2
+
3
  $( "#config-error" ).hide();
4
  $( "#share-error" ).hide();
5
  $( "#tabs" ).tabs();
6
+
7
+ var thickDims, tbWidth, tbHeight, img = abvimg = belimg = '';
8
+
9
  thickDims = function() {
10
  var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
11
 
20
  }
21
  };
22
 
23
+
24
  $('a.thickbox-preview').click( function() {
25
 
26
  var previewLink = this;
81
  return false;
82
  });
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  var aboveCustom = $('#above_custom_button');
85
  var aboveCustomShow = function(){
86
+ if ( aboveCustom.is(':checked'))
87
  {
88
  $('.above_option_custom').removeClass('hidden');
89
  }
92
  $('.above_option_custom').addClass('hidden');
93
  }
94
  };
95
+
96
  var belowCustom = $('#below_custom_button');
97
  var belowCustomShow = function(){
98
+ if ( belowCustom.is(':checked'))
99
  {
100
  $('.below_option_custom').removeClass('hidden');
101
  }
105
  }
106
  };
107
 
108
+ var show_above = $('input[name="addthis_settings[show_above]"]');
109
+ var show_below = $('input[name="addthis_settings[show_below]"]');
110
+ if ( $('#input[name="addthis_settings[show_above]"]').is(':checked'))
111
+ {
112
+ $('.above_option').toggleClass('hide');
113
+ }
114
+
115
+ if ( $('#input[name="addthis_settings[show_below]"]').is(':checked'))
116
+ {
117
+ $('.below_option').toggleClass('hide');
118
+ }
119
+
120
+ $('input[name="addthis_settings[show_above]"]').change( function() {
121
+ $('.above_option').toggleClass('hide');
122
+ });
123
+
124
+ $('input[name="addthis_settings[show_below]"]').change( function() {
125
+ $('.below_option').toggleClass('hide');
126
+ });
127
+
128
  var aboveCustomString = $('#above_custom_string');
129
  var aboveCustomStringShow = function(){
130
+ if ( aboveCustomString.is(':checked'))
131
  {
132
  $('.above_custom_string_input').removeClass('hidden');
133
  }
136
  $('.above_custom_string_input').addClass('hidden');
137
  }
138
  };
139
+
140
  var belowCustomString = $('#below_custom_string');
141
  var belowCustomStringShow = function(){
142
+ if ( belowCustomString.is(':checked'))
143
  {
144
  $('.below_custom_string_input').removeClass('hidden');
145
  }
155
  belowCustomStringShow();
156
 
157
  $('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow(); aboveCustomStringShow();} );
158
+ $('input[name="addthis_settings[below]"]').change( function(){belowCustomStringShow();} );
159
+
160
  /**
161
  * Hide Theming and branding options when user selects version 3.0 or above
162
  */
290
  if (error == 0) {
291
  $('#config-error').hide();
292
  return true;
293
+ } else {
 
294
  $('#config-error').show();
295
  return false;
296
  }
310
  if (error == 0) {
311
  $('#share-error').hide();
312
  return true;
313
+ } else {
 
314
  $('#share-error').show();
315
  return false;
316
  }
322
  var error = 0;
323
  if ($('#addthis-config-json').val() != " ") {
324
  try {
325
+ var addthis_config_json = jQuery.parseJSON($('#addthis-config-json').val());
326
  }
327
+ catch (e) {
328
+ $('#config-error').show();
329
+ error = 1;
330
  }
331
  }
332
  if ($('#addthis-share-json').val() != " ") {
333
  try {
334
+ var addthis_share_json = jQuery.parseJSON($('#addthis-share-json').val());
335
  }
336
+ catch (e) {
337
+ $('#share-error').show();
338
+ error = 1;
339
  }
340
  }
341
+ if (error == 0) {
342
  return true;
343
+ } else {
 
344
  return false;
345
  }
346
  });
347
+
348
+
349
+ //preview box
350
+ function rewriteServices(posn) {
351
+ var services = $('#'+posn+'-chosen-list').val();
352
+ var service = services.split(', ');
353
+ var i;
354
+ var newservice = '';
355
+ for (i = 0; i < (service.length); ++i) {
356
+ if(service[i] == 'linkedin') {
357
+ newservice += 'linkedin_counter, ';
358
+ }
359
+ else if(service[i] == 'facebook') {
360
+ newservice += 'facebook_like, ';
361
+ }
362
+ else if(service[i] == 'twitter') {
363
+ newservice += 'tweet, ';
364
+ }
365
+ else if(service[i] == 'pinterest_share') {
366
+ newservice += 'pinterest_pinit, ';
367
+ }
368
+ else if(service[i] == 'hyves') {
369
+ newservice += 'hyves_respect, ';
370
+ }
371
+ else if(service[i] == 'google_plusone_share') {
372
+ newservice += 'google_plusone, ';
373
+ }
374
+ else if(service[i] == 'counter' || service[i] == 'compact') {
375
+ newservice += service[i]+', ';
376
+ }
377
+ }
378
+ var newservices = newservice.slice(0,-2);
379
+ return newservices;
380
+ }
381
+
382
+ function revertServices(posn) {
383
+ var services = $('#'+posn+'-chosen-list').val();
384
+ var service = services.split(', ');
385
+ var i;
386
+ var newservice = '';
387
+ for (i = 0; i < (service.length); ++i) {
388
+ if(service[i] == 'facebook_like') {
389
+ newservice += 'facebook, ';
390
+ }
391
+ else if(service[i] == 'linkedin_counter') {
392
+ newservice += 'linkedin, ';
393
+ }
394
+ else if(service[i] == 'hyves_respect') {
395
+ newservice += 'hyves, ';
396
+ }
397
+ else if(service[i] == 'google_plusone') {
398
+ newservice += 'google_plusone_share, ';
399
+ }
400
+ else if(service[i] == 'tweet') {
401
+ newservice += 'twitter, ';
402
+ }
403
+ else if(service[i] == 'pinterest_pinit') {
404
+ newservice += 'pinterest_share, ';
405
+ }
406
+ else {
407
+ newservice += service[i]+', ';
408
+ }
409
+ }
410
+ var newservices = newservice.slice(0,-2);
411
+ return newservices;
412
+ }
413
+
414
+ function updatePreview(posn, style, option) {
415
+ var preview = '';
416
+ var service = option.split(', ');
417
+ var i;
418
+ if(style == 'large_toolbox') {
419
+ preview += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
420
+ for (i = 0; i < (service.length); ++i) {
421
+ if(service[i] == 'counter') {
422
+ preview += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
423
+ } else {
424
+ preview += '<span class="at300bs at15nc at15t_'+service[i]+' at16t_'+service[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
425
+ }
426
+ }
427
+ preview += '</div>';
428
+ }
429
+ else if(style == 'fb_tw_p1_sc') {
430
+ for (i = 0; i < (service.length); ++i) {
431
+ if(service[i] == 'compact') {
432
+ preview += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
433
+ }
434
+ else if(service[i] != 'counter') {
435
+ preview += '<img src="'+addthis_option_params.img_base+service[i]+'.png">';
436
+ }
437
+ }
438
+ }
439
+ else if(style == 'small_toolbox') {
440
+ for (i = 0; i < (service.length); ++i) {
441
+ if(service[i] == 'counter') {
442
+ preview += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float:left;" href="#" tabindex="0"></a>';
443
+ } else {
444
+ preview += '<span class="at300bs at15nc at15t_'+service[i]+' at16t_'+service[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
445
+ }
446
+ }
447
+ }
448
+ $('#'+posn+'_previewContainer').html(preview);
449
+ }
450
+ if($('#large_toolbox_above').is(':checked')) {
451
+ if($('#above-chosen-list').val() == "") {
452
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">';
453
+ } else {
454
+ abvimg += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
455
+ var aboveserv = $('#above-chosen-list').val();
456
+ var aservice = aboveserv.split(', ');
457
+ var i;
458
+ for (i = 0; i < (aservice.length); ++i) {
459
+ if(aservice[i] == 'counter') {
460
+ abvimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
461
+ } else {
462
+ abvimg += '<span class="at300bs at15nc at15t_'+aservice[i]+' at16t_'+aservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
463
+ }
464
+ }
465
+ abvimg += '</div>';
466
+ }
467
+ $('.above_button_set').css('opacity', 1);
468
+ $('.above-customize-sharing-link').css('opacity', 1);
469
+ $('.above-smart-sharing-container').show();
470
+ $('#above_previewContainer').html(abvimg);
471
+ } else if($('#fb_tw_p1_sc_above').is(':checked')) {
472
+ if($('#above-chosen-list').val() == "") {
473
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">';
474
+ } else {
475
+ var aboveserv = $('#above-chosen-list').val();
476
+ var aservice = aboveserv.split(', ');
477
+ var i;
478
+ for (i = 0; i < (aservice.length); ++i) {
479
+ if(aservice[i] == 'compact') {
480
+ abvimg += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
481
+ }
482
+ else if(aservice[i] != 'counter') {
483
+ abvimg += '<img src="'+addthis_option_params.img_base+aservice[i]+'.png">';
484
+ }
485
+ }
486
+ }
487
+ $('.above_button_set').css('opacity', 1);
488
+ $('.above-customize-sharing-link').css('opacity', 1);
489
+ $('.above-smart-sharing-container').show();
490
+ $('#above_previewContainer').html(abvimg);
491
+ } else if($('#small_toolbox_above').is(':checked')) {
492
+ if($('#above-chosen-list').val() == "") {
493
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">';
494
+ } else {
495
+ var aboveserv = $('#above-chosen-list').val();
496
+ var aservice = aboveserv.split(', ');
497
+ var i;
498
+ for (i = 0; i < (aservice.length); ++i) {
499
+ if(aservice[i] == 'counter') {
500
+ abvimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float:left;" href="#" tabindex="0"></a>';
501
+ } else {
502
+ abvimg += '<span class="at300bs at15nc at15t_'+aservice[i]+' at16t_'+aservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
503
+ }
504
+ }
505
+ }
506
+ $('.above_button_set').css('opacity', 1);
507
+ $('.above-customize-sharing-link').css('opacity', 1);
508
+ $('.above-smart-sharing-container').show();
509
+ $('#above_previewContainer').html(abvimg);
510
+ } else if($('#button_above').is(':checked')) {
511
+ abvimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">';
512
+ $('.above_button_set').css('opacity', 1);
513
+ $('.above-customize-sharing-link').css('opacity', 0);
514
+ $('.above-smart-sharing-container').hide();
515
+ $('#above_previewContainer').html(abvimg);
516
+ } else if($('#disable_above').is(':checked')) {
517
+ abvimg = '';
518
+ $('.above_button_set').css('opacity', 0.4);
519
+ $('.above-customize-sharing-link').css('opacity', 0);
520
+ $('.above-smart-sharing-container').hide();
521
+ $('#above_previewContainer').html(abvimg);
522
+ }
523
+
524
+ if($('#large_toolbox_below').is(':checked')) {
525
+ if($('#below-chosen-list').val() == "") {
526
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">';
527
+ } else {
528
+ belimg += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
529
+ var belowserv = $('#below-chosen-list').val();
530
+ var bservice = belowserv.split(', ');
531
+ var i;
532
+ for (i = 0; i < (bservice.length); ++i) {
533
+ if(bservice[i] == 'counter') {
534
+ belimg +='<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
535
+ } else {
536
+ belimg += '<span class="at300bs at15nc at15t_'+bservice[i]+' at16t_'+bservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
537
+ }
538
+ }
539
+ belimg += '</div>';
540
+
541
+ }
542
+ $('.below_button_set').css('opacity', 1);
543
+ $('.below-customize-sharing-link').css('opacity', 1);
544
+ $('.below-smart-sharing-container').show();
545
+ $('#below_previewContainer').html(belimg);
546
+ } else if($('#fb_tw_p1_sc_below').is(':checked')) {
547
+ if($('#below-chosen-list').val() == "") {
548
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">';
549
+ } else {
550
+ var belowserv = $('#below-chosen-list').val();
551
+ var bservice = belowserv.split(', ');
552
+ var i;
553
+ for (i = 0; i < (bservice.length-1); ++i) {
554
+ if(bservice[i] == 'compact') {
555
+ belimg += '<img src="'+addthis_option_params.img_base+'addthis_pill_style.png">';
556
+ } else if(bservice[i] != 'counter') {
557
+ belimg += '<img src="'+addthis_option_params.img_base+bservice[i]+'.png">';
558
+ }
559
+ }
560
+ }
561
+ $('.below_button_set').css('opacity', 1);
562
+ $('.below-customize-sharing-link').css('opacity', 1);
563
+ $('.below-smart-sharing-container').show();
564
+ $('#below_previewContainer').html(belimg);
565
+ } else if($('#small_toolbox_below').is(':checked')) {
566
+ if($('#below-chosen-list').val() == "") {
567
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">';
568
+ } else {
569
+ var belowserv = $('#below-chosen-list').val();
570
+ var bservice = belowserv.split(', ');
571
+ var i;
572
+ for (i = 0; i < (bservice.length); ++i) {
573
+ if(bservice[i] == 'counter') {
574
+ belimg += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
575
+ } else {
576
+ belimg += '<span class="at300bs at15nc at15t_'+bservice[i]+' at16t_'+bservice[i]+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
577
+ }
578
+ }
579
+ }
580
+ $('.below_button_set').css('opacity', 1);
581
+ $('.below-customize-sharing-link').css('opacity', 1);
582
+ $('.below-smart-sharing-container').show();
583
+ $('#below_previewContainer').html(belimg);
584
+ } else if($('#button_below').is(':checked')) {
585
+ belimg = '<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">';
586
+ $('.below_button_set').css('opacity', 1);
587
+ $('.below-customize-sharing-link').css('opacity', 0);
588
+ $('.below-smart-sharing-container').hide();
589
+ $('#below_previewContainer').html(belimg);
590
+ } else if($('#disable_below').is(':checked')) {
591
+ belimg = '';
592
+ $('.below_button_set').css('opacity', 0.4);
593
+ $('.below-customize-sharing-link').css('opacity', 0);
594
+ $('.below-smart-sharing-container').hide();
595
+ $('#below_previewContainer').html(belimg);
596
+ }
597
+
598
+ $("#large_toolbox_above").click( function() {
599
+ if($('#above-chosen-list').val() != '') {
600
+ var newserv = revertServices('above');
601
+ updatePreview('above', 'large_toolbox', newserv);
602
+ $('#above-chosen-list').val(newserv);
603
+ }
604
+ else {
605
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">');
606
+ }
607
+ $('.above_button_set').css('opacity', 1);
608
+ $('.above-customize-sharing-link').css('opacity', 1);
609
+ $('.above-smart-sharing-container').show();
610
+ });
611
+
612
+ $("#large_toolbox_below").click( function() {
613
+ if($('#below-chosen-list').val() != '') {
614
+ var newserv = revertServices('below');
615
+ updatePreview('below', 'large_toolbox', newserv);
616
+ $('#below-chosen-list').val(newserv);
617
+ }
618
+ else {
619
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-large.png">');
620
+ }
621
+ $('.below_button_set').css('opacity', 1);
622
+ $('.below-customize-sharing-link').css('opacity', 1);
623
+ $('.below-smart-sharing-container').show();
624
+ });
625
+
626
+ $("#fb_tw_p1_sc_above").click( function() {
627
+ if($('#above-chosen-list').val() != '') {
628
+ var newserv = rewriteServices('above');
629
+ updatePreview('above', 'fb_tw_p1_sc', newserv);
630
+ $('#above-chosen-list').val(newserv);
631
+ }
632
+ else {
633
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">');
634
+ }
635
+ $('.above_button_set').css('opacity', 1);
636
+ $('.above-customize-sharing-link').css('opacity', 1);
637
+ $('.above-smart-sharing-container').show();
638
+ });
639
+
640
+ $("#fb_tw_p1_sc_below").click( function() {
641
+ if($('#below-chosen-list').val() != '') {
642
+ var newserv = rewriteServices('below');
643
+ updatePreview('below', 'fb_tw_p1_sc', newserv);
644
+ $('#below-chosen-list').val(newserv);
645
+ }
646
+ else {
647
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share_rect.png">');
648
+ }
649
+ $('.below_button_set').css('opacity', 1);
650
+ $('.below-customize-sharing-link').css('opacity', 1);
651
+ $('.below-smart-sharing-container').show();
652
+ });
653
+
654
+ $("#small_toolbox_above").click( function() {
655
+ if($('#above-chosen-list').val() != '') {
656
+ var newserv = revertServices('above');
657
+ updatePreview('above', 'small_toolbox', newserv);
658
+ $('#above-chosen-list').val(newserv);
659
+ }
660
+ else {
661
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">');
662
+ }
663
+ $('.above_button_set').css('opacity', 1);
664
+ $('.above-customize-sharing-link').css('opacity', 1);
665
+ $('.above-smart-sharing-container').show();
666
+ });
667
+
668
+ $("#small_toolbox_below").click( function() {
669
+ if($('#below-chosen-list').val() != '') {
670
+ var newserv = revertServices('below');
671
+ updatePreview('below', 'small_toolbox', newserv);
672
+ $('#below-chosen-list').val(newserv);
673
+ }
674
+ else {
675
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'toolbox-small.png">');
676
+ }
677
+ $('.below_button_set').css('opacity', 1);
678
+ $('.below-customize-sharing-link').css('opacity', 1);
679
+ $('.below-smart-sharing-container').show();
680
+ });
681
+
682
+ $("#button_above").click( function() {
683
+ if($(this).is(':checked')){
684
+ $('#above_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">');
685
+ }
686
+ $('.above_button_set').css('opacity', 1);
687
+ $('.above-customize-sharing-link').css('opacity', 1);
688
+ $('.above-smart-sharing-container').show();
689
+ });
690
+
691
+ $("#button_below").click( function() {
692
+ if($(this).is(':checked')){
693
+ $('#below_previewContainer').html('<img alt="large_toolbox" src="'+addthis_option_params.img_base+'horizontal_share.png">');
694
+ }
695
+ $('.below_button_set').css('opacity', 1);
696
+ $('.below-customize-sharing-link').css('opacity', 1);
697
+ $('.below-smart-sharing-container').show();
698
+ });
699
+
700
+ $("#disable_above").click( function() {
701
+ if($(this).is(':checked')){
702
+ $('#above_previewContainer').html('');
703
+ $('.above_button_set').css('opacity', 0.4);
704
+ $('.above-customize-sharing-link').css('opacity', 0);
705
+ $('.above-smart-sharing-container').hide();
706
+ }
707
+ });
708
+
709
+ $("#disable_below").click( function() {
710
+ if($(this).is(':checked')){
711
+ $('#below_previewContainer').html('');
712
+ $('.below_button_set').css('opacity', 0.4);
713
+ $('.below-customize-sharing-link').css('opacity', 0);
714
+ $('.below-smart-sharing-container').hide();
715
+ }
716
+ });
717
+
718
+ $('#submit-button').click(function() {
719
+ if($('#above-disable-smart-sharing').is(':checked')) {
720
+ if($('#button_above').is(':checked')) {
721
+ $('#above-chosen-list').val('');
722
+ } else if($('#disable_above').is(':checked')) {
723
+ $('#above-chosen-list').val('');
724
+ } else {
725
+ var list = [];
726
+ $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
727
+ var service = '';
728
+ $(this).find('li').each(function(){
729
+ if($(this).hasClass('enabled')) {
730
+ list.push($(this).attr('data-service'));
731
+ if($(this).attr('data-service') == 'compact') {
732
+ list.push('counter');
733
+ }
734
+ }
735
+ });
736
+ });
737
+ var aboveservices = list.join(', ');
738
+ $('#above-chosen-list').val(aboveservices);
739
+ }
740
+ }
741
+ if($('#button_above').is(':checked')) {
742
+ $('#above-chosen-list').val('');
743
+ }
744
+ if($('#disable_above').is(':checked')) {
745
+ $('#above-chosen-list').val('');
746
+ }
747
+ if($('#above_custom_string').length > 0) {
748
+ if ( ! $('#above_custom_string').is(':checked') ) {
749
+ var toConfirm = confirm("Upon saving the custom code that has been saved will be removed permanently!Do you wish to continue?");
750
+ if (toConfirm == true)
751
+ {
752
+ return true;
753
+ } else {
754
+ return false;
755
+ }
756
+ }
757
+ }
758
+
759
+ if($('#below-disable-smart-sharing').is(':checked')) {
760
+ if($('#button_below').is(':checked')) {
761
+ $('#below-chosen-list').val('');
762
+ } else if($('#disable_below').is(':checked')) {
763
+ $('#below-chosen-list').val('');
764
+ } else {
765
+ var list = [];
766
+ $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
767
+ var service = '';
768
+ $(this).find('li').each(function(){
769
+ if($(this).hasClass('enabled')) {
770
+ list.push($(this).attr('data-service'));
771
+ if($(this).attr('data-service') == 'compact') {
772
+ list.push('counter');
773
+ }
774
+ }
775
+ });
776
+ });
777
+ var belowservices = list.join(', ');
778
+ $('#below-chosen-list').val(belowservices);
779
+ }
780
+ }
781
+ if($('#button_below').is(':checked')) {
782
+ $('#below-chosen-list').val('');
783
+ }
784
+ if($('#disable_below').is(':checked')) {
785
+ $('#below-chosen-list').val('');
786
+ }
787
+ if($('#below_custom_string').length > 0) {
788
+ if ( ! $('#below_custom_string').is(':checked') ) {
789
+ var toConfirm = confirm("Upon saving the custom code that has been saved will be removed permanently!Do you wish to continue?");
790
+ if (toConfirm == true)
791
+ {
792
+ return true;
793
+ } else {
794
+ return false;
795
+ }
796
+ }
797
+ }
798
+ });
799
+
800
+ var s = $("#preview_floater");
801
+ var pos = s.position();
802
+ $(window).scroll(function() {
803
+ var windowpos = $(window).scrollTop();
804
+
805
+ if (windowpos >= pos.top) {
806
+ s.addClass("stick");
807
+ } else {
808
+ s.removeClass("stick");
809
+ }
810
+ });
811
+
812
+ $('.folded #collapse-menu').click(function(){
813
+ $('#preview_floater').removeClass();
814
+ var s = $("#preview_floater");
815
+ var pos = s.position();
816
+ $(window).scroll(function() {
817
+ var windowpos = $(window).scrollTop();
818
+
819
+ if (windowpos >= pos.top) {
820
+ setTimeout(function(){$('#preview_floater').addClass('stick');},1);
821
+ }
822
+ });
823
+ });
824
+
825
+ var dataContent = '';
826
+ var dataTitle = '';
827
+ var innerContent = '';
828
+ var left = 0;
829
+ var top = 0;
830
+ var popoverHeight = 0;
831
+ var parent;
832
+ var me;
833
+ $('.row-right a').mouseover(function(){
834
+ me = $(this);
835
+ parent = $(me).parent();
836
+
837
+ dataContent = $(parent).attr('data-content');
838
+ dataTitle = $(parent).attr('data-original-title');
839
+ innerContent = "<div class='popover fade right in' style='display: block;'><div class='arrow'></div><h3 class='popover-title'>";
840
+ innerContent = innerContent + dataTitle;
841
+ innerContent = innerContent + "</h3><div class='popover-content'>";
842
+ innerContent = innerContent + dataContent;
843
+ innerContent = innerContent + "</div></div>";
844
+ $(parent).append(innerContent);
845
+
846
+ popoverHeight = $(parent).find('.popover').height();
847
+ left = $(me).position().left + 15;
848
+ top = $(me).position().top - (popoverHeight/2) + 8;
849
+
850
+ $(parent).find('.popover').css({
851
+ 'left': left+'px',
852
+ 'top': top+'px'
853
+ });
854
+ });
855
+ $('.row-right a').mouseout(function(){
856
+ $('.popover').remove();
857
+ });
858
+
859
  });
860
+
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Share Buttons by AddThis ===
2
  Contributors: srijith.v, solchea, _mjk_, addthis_paul
3
  Tags: share, addthis, social, bookmark, sharing, bookmarking, widget,AddThis, addtoany, aim, bookmark, buzz, del.icio.us, Digg,e-mail, email, Facebook, google bookmarks, google buzz, myspace,network, NewsVine, Reddit, Share, share this, sharethis, social, socialize, stumbleupon, twitter, windows live, yahoo buzz, pintrest, widget
4
- Requires at least: 2.9
5
- Tested up to: 3.5.1
6
- Stable tag: 3.1
7
 
8
  AddThis Share Buttons help drive traffic to your site by helping visitors share, bookmark and email your content to over 330 services.
9
 
@@ -76,6 +76,11 @@ PHP 5+ is preferred; PHP 4 is supported.
76
 
77
  == Changelog ==
78
 
 
 
 
 
 
79
  = 3.1 =
80
  * Better support for excerpts
81
  * Internal issues with tw:screenname resolved
@@ -228,6 +233,8 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
228
 
229
 
230
  == Upgrade Notice ==
 
 
231
 
232
  = 3.1 =
233
  Bug fixes, better validations
1
  === Share Buttons by AddThis ===
2
  Contributors: srijith.v, solchea, _mjk_, addthis_paul
3
  Tags: share, addthis, social, bookmark, sharing, bookmarking, widget,AddThis, addtoany, aim, bookmark, buzz, del.icio.us, Digg,e-mail, email, Facebook, google bookmarks, google buzz, myspace,network, NewsVine, Reddit, Share, share this, sharethis, social, socialize, stumbleupon, twitter, windows live, yahoo buzz, pintrest, widget
4
+ Requires at least: 3.0
5
+ Tested up to: 3.6
6
+ Stable tag: 3.5
7
 
8
  AddThis Share Buttons help drive traffic to your site by helping visitors share, bookmark and email your content to over 330 services.
9
 
76
 
77
  == Changelog ==
78
 
79
+ = 3.5 =
80
+ * Drag and drop customization of buttons
81
+ * Better preview of buttons
82
+ * Bug fixes
83
+
84
  = 3.1 =
85
  * Better support for excerpts
86
  * Internal issues with tw:screenname resolved
233
 
234
 
235
  == Upgrade Notice ==
236
+ = 3.5 =
237
+ * Drag and drop customization of buttons, better preview of buttons
238
 
239
  = 3.1 =
240
  Bug fixes, better validations