WordPress Share Buttons Plugin – AddThis - Version 5.1.0

Version Description

  • New feature: set your own addthis.layers() paramaters to customize further using our API (in WordPress mode only)
  • Fixing a bug with the AddThis Sharing Buttons meta box not showing up for users in AddThis mode when editing posts
  • Fixing a bug with addthis_config where the JSON wasn't always checked before submitting the settings form
  • Fixing a bug with the sharing sidebar, where the theme for the sidebar was used for all AddThis layers tools (in WordPress mode)
  • Fixing a bug between AddThis Sharing Buttons and AddThis Follow Buttons, where saving changes in Follow Buttons would reset Sharing Buttons settings
  • Support for WordPress 4.3
Download this release

Release Info

Developer jgrodel
Plugin Icon 128x128 WordPress Share Buttons Plugin – AddThis
Version 5.1.0
Comparing to
See all releases

Code changes from version 5.0.13 to 5.1.0

AddThisConfigs.php CHANGED
@@ -47,6 +47,7 @@ if (!class_exists('AddThisConfigs')) {
47
  'addthis_config_json' => '',
48
  'addthis_environment' => '',
49
  'addthis_language' => '',
 
50
  'addthis_per_post_enabled' => true,
51
  'addthis_plugin_controls' => 'AddThis',
52
  'addthis_profile' => '',
@@ -69,7 +70,8 @@ if (!class_exists('AddThisConfigs')) {
69
  'credential_validation_status' => 0,
70
  'data_ga_property' => '',
71
  'location' => 'below',
72
- 'style' => addthis_style_default ,
 
73
  'toolbox' => '',
74
  );
75
 
@@ -174,7 +176,7 @@ if (!class_exists('AddThisConfigs')) {
174
  public function saveSubmittedConfigs($input) {
175
  $configs = $this->cmsInterface->prepareSubmittedConfigs($input);
176
 
177
- if( isset($options['addthis_plugin_controls'])
178
  && $this->configs['addthis_plugin_controls'] != "AddThis"
179
  ) {
180
  $configs = $this->cmsInterface->prepareCmsModeSubmittedConfigs($input, $configs);
@@ -308,15 +310,18 @@ if (!class_exists('AddThisConfigs')) {
308
  $addThisShareVariable['shorteners']['bitly'] = new stdClass();
309
  }
310
 
311
- // this should happen last!
312
- if (!empty($this->configs['addthis_share_json'])) {
313
- $json = $this->configs['addthis_share_json'];
314
- $fromJson = json_decode($json, true);
315
- if (is_array($fromJson)) {
316
- $addThisShareVariable = array_merge($addThisShareVariable, $fromJson);
317
- }
 
 
318
  }
319
 
 
320
  return $addThisShareVariable;
321
  }
322
 
@@ -363,13 +368,15 @@ if (!class_exists('AddThisConfigs')) {
363
  }
364
  }
365
 
366
- // this should happen last!
367
- if (!empty($this->configs['addthis_config_json'])) {
368
- $json = $this->configs['addthis_config_json'];
369
- $fromJson = json_decode($json, true);
370
- if (is_array($fromJson)) {
371
- $addThisConfigVariable = array_merge($addThisConfigVariable, $fromJson);
372
- }
 
 
373
  }
374
 
375
  if( isset($this->configs['addthis_plugin_controls'])
@@ -378,9 +385,70 @@ if (!class_exists('AddThisConfigs')) {
378
  $addThisConfigVariable['ignore_server_config'] = true;
379
  }
380
 
 
381
  return $addThisConfigVariable;
382
  }
383
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  public function getFirstTwitterUsername($input)
385
  {
386
  $twitter_username = '';
47
  'addthis_config_json' => '',
48
  'addthis_environment' => '',
49
  'addthis_language' => '',
50
+ 'addthis_layers_json' => '',
51
  'addthis_per_post_enabled' => true,
52
  'addthis_plugin_controls' => 'AddThis',
53
  'addthis_profile' => '',
70
  'credential_validation_status' => 0,
71
  'data_ga_property' => '',
72
  'location' => 'below',
73
+ 'sharing_buttons_feature_enabled' => '1',
74
+ 'style' => addthis_style_default,
75
  'toolbox' => '',
76
  );
77
 
176
  public function saveSubmittedConfigs($input) {
177
  $configs = $this->cmsInterface->prepareSubmittedConfigs($input);
178
 
179
+ if( isset($this->configs['addthis_plugin_controls'])
180
  && $this->configs['addthis_plugin_controls'] != "AddThis"
181
  ) {
182
  $configs = $this->cmsInterface->prepareCmsModeSubmittedConfigs($input, $configs);
310
  $addThisShareVariable['shorteners']['bitly'] = new stdClass();
311
  }
312
 
313
+ $variablesWithShareJson = array(
314
+ 'addthis_share_follow_json',
315
+ 'addthis_share_recommended_json',
316
+ 'addthis_share_welcome_json',
317
+ 'addthis_share_trending_json',
318
+ 'addthis_share_json', // this one should happen last!
319
+ );
320
+ foreach ($variablesWithShareJson as $jsonVariable) {
321
+ $addThisShareVariable = $this->mergeJson($jsonVariable, $addThisShareVariable);
322
  }
323
 
324
+ $addThisShareVariable = (object)$addThisShareVariable;
325
  return $addThisShareVariable;
326
  }
327
 
368
  }
369
  }
370
 
371
+ $variablesWithConfigJson = array(
372
+ 'addthis_config_follow_json',
373
+ 'addthis_config_recommended_json',
374
+ 'addthis_config_welcome_json',
375
+ 'addthis_config_trending_json',
376
+ 'addthis_config_json', // this one should happen last!
377
+ );
378
+ foreach ($variablesWithConfigJson as $jsonVariable) {
379
+ $addThisConfigVariable = $this->mergeJson($jsonVariable, $addThisConfigVariable);
380
  }
381
 
382
  if( isset($this->configs['addthis_plugin_controls'])
385
  $addThisConfigVariable['ignore_server_config'] = true;
386
  }
387
 
388
+ $addThisConfigVariable = (object)$addThisConfigVariable;
389
  return $addThisConfigVariable;
390
  }
391
 
392
+ public function createAddThisLayersVariable() {
393
+ if (!is_array($this->configs)) {
394
+ $this->getConfigs();
395
+ }
396
+
397
+ $addThisLayersVariable = array();
398
+
399
+ if ( isset($this->configs['addthis_plugin_controls'])
400
+ && $this->configs['addthis_plugin_controls'] == "AddThis"
401
+ ) {
402
+ $addThisLayersVariable = (object)$addThisLayersVariable;
403
+ return $addThisLayersVariable;
404
+ }
405
+
406
+ if (!empty($this->configs['addthis_sidebar_enabled'])) {
407
+ $templateType = _addthis_determine_template_type();
408
+
409
+ $display = false;
410
+ if (is_string($templateType)) {
411
+ $fieldList = $this->getFieldsForContentTypeSharingLocations($templateType, 'sidebar');
412
+ $fieldName = $fieldList[0]['fieldName'];
413
+ if (!empty($this->configs[$fieldName])) {
414
+ $display = true;
415
+ }
416
+ }
417
+
418
+ if ($display) {
419
+ $addThisLayersVariable['share']['theme'] = strtolower($this->configs['addthis_sidebar_theme']);
420
+ $addThisLayersVariable['share']['position'] = strtolower($this->configs['addthis_sidebar_position']);
421
+ $addThisLayersVariable['share']['numPreferredServices'] = (int)$this->configs['addthis_sidebar_count'];
422
+ }
423
+ }
424
+
425
+ $variablesWithLayersJson = array(
426
+ 'addthis_layers_follow_json',
427
+ 'addthis_layers_recommended_json',
428
+ 'addthis_layers_welcome_json',
429
+ 'addthis_layers_trending_json',
430
+ 'addthis_layers_json', // this one should happen last!
431
+ );
432
+ foreach ($variablesWithLayersJson as $jsonVariable) {
433
+ $addThisLayersVariable = $this->mergeJson($jsonVariable, $addThisLayersVariable);
434
+ }
435
+
436
+ $addThisLayersVariable = (object)$addThisLayersVariable;
437
+ return $addThisLayersVariable;
438
+ }
439
+
440
+ public function mergeJson($jsonVariable, $currentValue) {
441
+ if (!empty($this->configs[$jsonVariable])) {
442
+ $json = $this->configs[$jsonVariable];
443
+ $fromJson = json_decode($json, true);
444
+ if (is_array($fromJson)) {
445
+ $currentValue = array_replace_recursive($currentValue, $fromJson);
446
+ }
447
+ }
448
+
449
+ return $currentValue;
450
+ }
451
+
452
  public function getFirstTwitterUsername($input)
453
  {
454
  $twitter_username = '';
AddThisWordPressConnector.php CHANGED
@@ -46,16 +46,37 @@ if (!class_exists('AddThisWordPressConnector')) {
46
 
47
  static $sharedVariables = array(
48
  // general
49
- 'addthis_plugin_controls',
50
- 'addthis_profile',
51
  'addthis_anonymous_profile',
52
- 'credential_validation_status',
53
  'addthis_asynchronous_loading',
54
  'addthis_environment',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  // addthis_share
56
  'addthis_twitter_template',
57
  'addthis_bitly',
58
  'addthis_share_json',
 
 
 
 
 
 
 
 
 
 
59
  // addthis_config
60
  'data_ga_property',
61
  'addthis_language',
@@ -64,7 +85,12 @@ if (!class_exists('AddThisWordPressConnector')) {
64
  'addthis_addressbar',
65
  'addthis_508',
66
  'addthis_config_json',
 
 
 
 
67
  'addthis_plugin_controls',
 
68
  );
69
 
70
  static $deprecatedSharedVariables = array(
@@ -237,23 +263,35 @@ if (!class_exists('AddThisWordPressConnector')) {
237
  }
238
 
239
  if (is_array($configs)) {
240
- $newPluginConfigs = $configs;
241
- $newSharedConfigs = array();
242
- foreach (self::$sharedVariables as $variable) {
243
- if(isset($configs[$variable])) {
244
- $newSharedConfigs[$variable] = $configs[$variable];
245
- unset($newPluginConfigs[$variable]);
246
- }
247
- }
248
-
249
- update_option($this->plugin->getConfigVariableName(), $newPluginConfigs);
250
- update_option($this->sharedConfigVariableName, $newSharedConfigs);
251
  $this->configs = $this->getConfigs();
252
  }
253
 
254
  return $this->configs;
255
  }
256
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  /**
258
  * checks if you're in preview mode
259
  * @return boolean true if in preview, false otherwise
@@ -513,19 +551,27 @@ if (!class_exists('AddThisWordPressConnector')) {
513
  * not be killed
514
  */
515
  public function evalKillEnqueue($handle, $src, $whitelist = array()) {
516
- $pluginsFolder = '/wp-content/plugins/';
517
- $addThisPluginsFolder = $pluginsFolder . $this->getPluginFolder();
518
- $addThisUrl = $this->getPluginUrl();
 
 
 
 
 
 
 
519
 
520
- if (!is_string($src)) { return false; }
 
 
521
 
522
  if ( !is_string($src) // is the source location a string? keep css if not, cause, for some reason it breaks otherwise
523
  || in_array($handle, $whitelist) // keep stuff that's in the whitelist
524
- || substr($handle, 0, 7) === 'addthis' // handle has our prefix
525
- || substr($src, 0, strlen($addThisPluginsFolder)) === $addThisPluginsFolder // keep relative path stuff from this plugin
526
- || substr($src, 0, strlen($addThisUrl)) === $addThisUrl //full urls for this plugin
527
- || ( substr($src, 0, 4) === "/wp-" // keep css for non-plugins
528
- && substr($src, 0, strlen($pluginsFolder)) !== $pluginsFolder)
529
  ) {
530
  return false;
531
  }
@@ -588,12 +634,13 @@ if (!class_exists('AddThisWordPressConnector')) {
588
  $optionsJsUrl = $jsRootUrl . 'options-page.js';
589
  }
590
 
591
- wp_enqueue_script(
592
- 'addthis_options_page_script',
593
- $optionsJsUrl,
594
- array('jquery-ui-tabs', 'thickbox')
595
  );
596
 
 
 
597
  if ($this->configs['addthis_plugin_controls'] == 'AddThis') {
598
  wp_enqueue_script(
599
  'addThisScript',
@@ -603,14 +650,23 @@ if (!class_exists('AddThisWordPressConnector')) {
603
  return;
604
  }
605
 
606
- wp_enqueue_script('addthis_core', $jsRootUrl . 'core-1.1.1.js');
 
 
 
 
 
 
 
 
 
607
  wp_enqueue_script('addthis_lr', $jsRootUrl . 'lr.js');
608
  wp_enqueue_script('addthis_qtip_script', $jsRootUrl . 'jquery.qtip.min.js');
609
- wp_enqueue_script('addthis_ui_script', $jsRootUrl . 'jqueryui.sortable.js');
610
  wp_enqueue_script('addthis_selectbox', $jsRootUrl . 'jquery.selectBoxIt.min.js');
611
  wp_enqueue_script('addthis_jquery_messagebox', $jsRootUrl . 'jquery.messagebox.js');
612
  wp_enqueue_script('addthis_jquery_atjax', $jsRootUrl . 'jquery.atjax.js');
613
  wp_enqueue_script('addthis_lodash_script', $jsRootUrl . 'lodash-0.10.0.js');
 
614
  wp_enqueue_script('addthis_services_script', $jsRootUrl . 'gtc-sharing-personalize.js');
615
  wp_enqueue_script('addthis_service_script', $jsRootUrl . 'gtc.cover.js');
616
 
@@ -688,45 +744,32 @@ if (!class_exists('AddThisWordPressConnector')) {
688
  }
689
 
690
  public function prepareSubmittedConfigs($input) {
691
- if (isset($input['addthis_profile'])) {
692
- $configs['addthis_profile'] = $input['addthis_profile'];
693
- }
694
-
695
- if (isset($input['addthis_environment'])) {
696
- $configs['addthis_environment'] = $input['addthis_environment'];
697
- }
698
-
699
- if (isset($input['addthis_plugin_controls'])) {
700
- if ($input['addthis_plugin_controls'] == 'WordPress') {
701
- $configs['addthis_plugin_controls'] = 'WordPress';
702
- } else {
703
- $configs['addthis_plugin_controls'] = 'AddThis';
704
- }
705
- }
706
-
707
- if (isset($input['addthis_twitter_template'])) {
708
- $configs['addthis_twitter_template'] = $input['addthis_twitter_template'];
709
- }
710
-
711
- if (isset($input['data_ga_property'])) {
712
- $configs['data_ga_property'] = $input['data_ga_property'];
713
- }
714
-
715
- if (isset($input['addthis_language'])) {
716
- $configs['addthis_language'] = $input['addthis_language'];
717
- }
718
 
719
  if (isset($input['addthis_rate_us'])) {
720
- $configs['addthis_rate_us'] = $input['addthis_rate_us'];
721
- $configs['addthis_rate_us_timestamp'] = time();
722
- }
723
-
724
- if (isset($input['addthis_config_json'])) {
725
- $configs['addthis_config_json'] = sanitize_text_field($input['addthis_config_json']);
726
- }
 
 
 
 
 
 
 
 
 
 
 
 
727
 
728
- if (isset($input['addthis_share_json'])) {
729
- $configs['addthis_share_json'] = sanitize_text_field($input['addthis_share_json']);
 
 
730
  }
731
 
732
  // All the checkbox fields
@@ -741,17 +784,26 @@ if (!class_exists('AddThisWordPressConnector')) {
741
 
742
  foreach ($checkboxFields as $field) {
743
  if (!empty($input[$field])) {
744
- $configs[$field] = true;
745
  } else {
746
- $configs[$field] = false;
747
  }
748
  }
749
 
750
- return $configs;
751
  }
752
 
753
- public function prepareCmsModeSubmittedConfigs($input, $configs) {
754
- return $configs;
 
 
 
 
 
 
 
 
 
755
  }
756
  }
757
  }
46
 
47
  static $sharedVariables = array(
48
  // general
 
 
49
  'addthis_anonymous_profile',
 
50
  'addthis_asynchronous_loading',
51
  'addthis_environment',
52
+ 'addthis_per_post_enabled',
53
+ 'addthis_plugin_controls',
54
+ 'addthis_profile',
55
+ 'api_key',
56
+ 'credential_validation_status',
57
+ 'debug_enable',
58
+ 'debug_profile_level',
59
+ 'debug_profile_type',
60
+ 'script_location',
61
+ 'wpfooter',
62
+ 'follow_buttons_feature_enabled',
63
+ 'recommended_content_feature_enabled',
64
+ 'sharing_buttons_feature_enabled',
65
+ 'trending_content_feature_enabled',
66
  // addthis_share
67
  'addthis_twitter_template',
68
  'addthis_bitly',
69
  'addthis_share_json',
70
+ 'addthis_share_follow_json',
71
+ 'addthis_share_recommended_json',
72
+ 'addthis_share_trending_json',
73
+ 'addthis_share_welcome_json',
74
+ // addthis_layers
75
+ 'addthis_layers_json',
76
+ 'addthis_layers_follow_json',
77
+ 'addthis_layers_recommended_json',
78
+ 'addthis_layers_trending_json',
79
+ 'addthis_layers_welcome_json',
80
  // addthis_config
81
  'data_ga_property',
82
  'addthis_language',
85
  'addthis_addressbar',
86
  'addthis_508',
87
  'addthis_config_json',
88
+ 'addthis_config_follow_json',
89
+ 'addthis_config_recommended_json',
90
+ 'addthis_config_trending_json',
91
+ 'addthis_config_welcome_json',
92
  'addthis_plugin_controls',
93
+
94
  );
95
 
96
  static $deprecatedSharedVariables = array(
263
  }
264
 
265
  if (is_array($configs)) {
266
+ $this->saveSharedConfigs($configs);
267
+ $this->savePluginConfigs($configs);
 
 
 
 
 
 
 
 
 
268
  $this->configs = $this->getConfigs();
269
  }
270
 
271
  return $this->configs;
272
  }
273
 
274
+ protected function saveSharedConfigs($configs) {
275
+ $newSharedConfigs = array();
276
+ foreach (self::$sharedVariables as $variable) {
277
+ if(isset($configs[$variable])) {
278
+ $newSharedConfigs[$variable] = $configs[$variable];
279
+ }
280
+ }
281
+
282
+ update_option($this->sharedConfigVariableName, $newSharedConfigs);
283
+ }
284
+
285
+ protected function savePluginConfigs($configs) {
286
+ foreach (self::$sharedVariables as $variable) {
287
+ if(isset($configs[$variable])) {
288
+ unset($configs[$variable]);
289
+ }
290
+ }
291
+
292
+ update_option($this->plugin->getConfigVariableName(), $configs);
293
+ }
294
+
295
  /**
296
  * checks if you're in preview mode
297
  * @return boolean true if in preview, false otherwise
551
  * not be killed
552
  */
553
  public function evalKillEnqueue($handle, $src, $whitelist = array()) {
554
+ $regex = "/\/[^\/]+\/plugins$/";
555
+ preg_match($regex, plugins_url(), $matches);
556
+ if (isset($matches[0])) {
557
+ $pluginsFolder = $matches[0] . '/';
558
+ } else {
559
+ $pluginsFolder = '/wp-content/plugins/';
560
+ }
561
+
562
+ $partialPathToOurPlugin = $pluginsFolder . $this->getPluginFolder();
563
+ $fullUrlToOurPlugin = $this->getPluginUrl();
564
 
565
+ if (!is_string($src)) {
566
+ return false;
567
+ }
568
 
569
  if ( !is_string($src) // is the source location a string? keep css if not, cause, for some reason it breaks otherwise
570
  || in_array($handle, $whitelist) // keep stuff that's in the whitelist
571
+ || strpos($handle, 'addthis') !== false // handle has our name
572
+ || strpos($partialPathToOurPlugin, $src) !== false // keep relative path stuff from this plugin
573
+ || strpos($fullUrlToOurPlugin, $src) !== false // full urls for this plugin
574
+ || strpos($src, $pluginsFolder) == false // keep enqueued stuff for non-plugins
 
575
  ) {
576
  return false;
577
  }
634
  $optionsJsUrl = $jsRootUrl . 'options-page.js';
635
  }
636
 
637
+ $dependencies = array(
638
+ 'jquery-ui-tabs',
639
+ 'thickbox',
 
640
  );
641
 
642
+ wp_enqueue_script('addthis_options_page_script',$optionsJsUrl, $dependencies);
643
+
644
  if ($this->configs['addthis_plugin_controls'] == 'AddThis') {
645
  wp_enqueue_script(
646
  'addThisScript',
650
  return;
651
  }
652
 
653
+ wp_enqueue_script('jquery-core');
654
+ wp_enqueue_script('jquery-ui-core');
655
+ wp_enqueue_script('jquery-ui-widget');
656
+ wp_enqueue_script('jquery-ui-mouse');
657
+ wp_enqueue_script('jquery-ui-position');
658
+ wp_enqueue_script('jquery-ui-draggable');
659
+ wp_enqueue_script('jquery-ui-droppable');
660
+ wp_enqueue_script('jquery-ui-sortable');
661
+ wp_enqueue_script('jquery-ui-tooltip');
662
+
663
  wp_enqueue_script('addthis_lr', $jsRootUrl . 'lr.js');
664
  wp_enqueue_script('addthis_qtip_script', $jsRootUrl . 'jquery.qtip.min.js');
 
665
  wp_enqueue_script('addthis_selectbox', $jsRootUrl . 'jquery.selectBoxIt.min.js');
666
  wp_enqueue_script('addthis_jquery_messagebox', $jsRootUrl . 'jquery.messagebox.js');
667
  wp_enqueue_script('addthis_jquery_atjax', $jsRootUrl . 'jquery.atjax.js');
668
  wp_enqueue_script('addthis_lodash_script', $jsRootUrl . 'lodash-0.10.0.js');
669
+
670
  wp_enqueue_script('addthis_services_script', $jsRootUrl . 'gtc-sharing-personalize.js');
671
  wp_enqueue_script('addthis_service_script', $jsRootUrl . 'gtc.cover.js');
672
 
744
  }
745
 
746
  public function prepareSubmittedConfigs($input) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
747
 
748
  if (isset($input['addthis_rate_us'])) {
749
+ $output['addthis_rate_us_timestamp'] = time();
750
+ }
751
+
752
+ $checkAndSanitize = array(
753
+ 'addthis_config_json',
754
+ 'addthis_environment',
755
+ 'addthis_language',
756
+ 'addthis_layers_json',
757
+ 'addthis_plugin_controls',
758
+ 'addthis_profile',
759
+ 'addthis_rate_us',
760
+ 'addthis_share_json',
761
+ 'addthis_twitter_template',
762
+ 'atversion',
763
+ 'atversion_update_status',
764
+ 'credential_validation_status',
765
+ 'data_ga_property',
766
+ 'pubid'
767
+ );
768
 
769
+ foreach ($checkAndSanitize as $field) {
770
+ if (isset($input[$field])) {
771
+ $output[$field] = sanitize_text_field($input[$field]);
772
+ }
773
  }
774
 
775
  // All the checkbox fields
784
 
785
  foreach ($checkboxFields as $field) {
786
  if (!empty($input[$field])) {
787
+ $output[$field] = true;
788
  } else {
789
+ $output[$field] = false;
790
  }
791
  }
792
 
793
+ return $output;
794
  }
795
 
796
+ public function prepareCmsModeSubmittedConfigs($input, $output) {
797
+ return $output;
798
+ }
799
+
800
+ public function deactivate() {
801
+ $configs = $this->getConfigs(true);
802
+
803
+ if (isset($configs['sharing_buttons_feature_enabled'])) {
804
+ unset($configs['sharing_buttons_feature_enabled']);
805
+ $this->saveSharedConfigs($configs);
806
+ }
807
  }
808
  }
809
  }
AddThisWordPressSharingButtonsPlugin.php CHANGED
@@ -25,7 +25,7 @@ if (!class_exists('AddThisWordPressSharingButtonsPlugin')) {
25
  Class AddThisWordPressSharingButtonsPlugin {
26
  // implements AddThisWordPressPluginInterface {
27
 
28
- static $version = '5.0.12';
29
  static $settingsPageId = 'addthis_social_widget';
30
  static $name = "AddThis Sharing Buttons";
31
  static $productPrefix = 'wpp';
25
  Class AddThisWordPressSharingButtonsPlugin {
26
  // implements AddThisWordPressPluginInterface {
27
 
28
+ static $version = '5.1.0';
29
  static $settingsPageId = 'addthis_social_widget';
30
  static $name = "AddThis Sharing Buttons";
31
  static $productPrefix = 'wpp';
addthis_addjs_new.php CHANGED
@@ -187,16 +187,13 @@ Class AddThis_addjs_sharing_button_plugin{
187
  urlencode($this->addThisConfigs->getUsableProfileId());
188
 
189
  $addthis_share = $this->addThisConfigs->createAddThisShareVariable();
190
- $addthis_share_js = '';
191
- if (!empty($addthis_share)) {
192
- $addthis_share_js = 'var addthis_share = '. json_encode($addthis_share) .';';
193
- }
194
 
195
  $addthis_config = $this->addThisConfigs->createAddThisConfigVariable();
196
- $addthis_config_js = '';
197
- if (!empty($addthis_config)) {
198
- $addthis_config_js = 'var addthis_config = '. json_encode($addthis_config) .';';
199
- }
200
 
201
  $this->jsToAdd .= '
202
  <!-- AddThis Settings Begin -->
@@ -211,6 +208,9 @@ Class AddThis_addjs_sharing_button_plugin{
211
  if (typeof(addthis_share) == "undefined") {
212
  ' . $addthis_share_js . '
213
  }
 
 
 
214
  </script>
215
  <script
216
  data-cfasync="false"
@@ -218,7 +218,18 @@ Class AddThis_addjs_sharing_button_plugin{
218
  src="' . $url . ' "
219
  ' . $async . '
220
  >
221
- </script>';
 
 
 
 
 
 
 
 
 
 
 
222
  }
223
  }
224
 
187
  urlencode($this->addThisConfigs->getUsableProfileId());
188
 
189
  $addthis_share = $this->addThisConfigs->createAddThisShareVariable();
190
+ $addthis_share_js = 'var addthis_share = '. json_encode($addthis_share) .';';
 
 
 
191
 
192
  $addthis_config = $this->addThisConfigs->createAddThisConfigVariable();
193
+ $addthis_config_js = 'var addthis_config = '. json_encode($addthis_config) .';';
194
+
195
+ $addthis_layers = $this->addThisConfigs->createAddThisLayersVariable();
196
+ $addthis_layers_js = 'var addthis_layers = '. json_encode($addthis_layers) .';';
197
 
198
  $this->jsToAdd .= '
199
  <!-- AddThis Settings Begin -->
208
  if (typeof(addthis_share) == "undefined") {
209
  ' . $addthis_share_js . '
210
  }
211
+ if (typeof(addthis_layers) == "undefined") {
212
+ ' . $addthis_layers_js . '
213
+ }
214
  </script>
215
  <script
216
  data-cfasync="false"
218
  src="' . $url . ' "
219
  ' . $async . '
220
  >
221
+ </script>
222
+ <script data-cfasync="false" type="text/javascript">
223
+ (function() {
224
+ var at_interval = setInterval(function () {
225
+ if(window.addthis) {
226
+ clearInterval(at_interval);
227
+ addthis.layers(addthis_layers);
228
+ }
229
+ },1000)
230
+ }());
231
+ </script>
232
+ ';
233
  }
234
  }
235
 
addthis_settings_functions.php CHANGED
@@ -469,4 +469,38 @@ function _addthis_excerpt_buttons_enabled() {
469
  $addthis_below_showon_excerpts = _addthis_excerpt_buttons_enabled_below();
470
  $enabled = (boolean)($addthis_above_showon_excerpts || $addthis_below_showon_excerpts);
471
  return $enabled;
472
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
469
  $addthis_below_showon_excerpts = _addthis_excerpt_buttons_enabled_below();
470
  $enabled = (boolean)($addthis_above_showon_excerpts || $addthis_below_showon_excerpts);
471
  return $enabled;
472
+ }
473
+
474
+ if (!function_exists('array_replace_recursive')) {
475
+ function array_replace_recursive($array, $array1) {
476
+ function recurse($array, $array1) {
477
+ foreach ($array1 as $key => $value) {
478
+ if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key]))) {
479
+ $array[$key] = array();
480
+ }
481
+
482
+ if (is_array($value)) {
483
+ $value = recurse($array[$key], $value);
484
+ }
485
+
486
+ $array[$key] = $value;
487
+ }
488
+
489
+ return $array;
490
+ }
491
+
492
+ // handle the arguments, merge one by one
493
+ $args = func_get_args();
494
+ $array = $args[0];
495
+ if (!is_array($array)) {
496
+ return $array;
497
+ }
498
+ for ($i = 1; $i < count($args); $i++) {
499
+ if (is_array($args[$i])) {
500
+ $array = recurse($array, $args[$i]);
501
+ }
502
+ }
503
+
504
+ return $array;
505
+ }
506
+ }
addthis_sidebar_widget.php CHANGED
@@ -28,7 +28,7 @@ class AddThisSidebarWidget extends WP_Widget {
28
  /**
29
  * Constructor
30
  */
31
- function AddThisSidebarWidget()
32
  {
33
 
34
  $widget_ops = array(
@@ -40,7 +40,7 @@ class AddThisSidebarWidget extends WP_Widget {
40
  $control_ops = array('width' => 325);
41
 
42
  /* Create the widget. */
43
- $this->WP_Widget(
44
  'addthis-widget',
45
  'AddThis Sharing Buttons',
46
  $widget_ops,
28
  /**
29
  * Constructor
30
  */
31
+ function __construct()
32
  {
33
 
34
  $widget_ops = array(
40
  $control_ops = array('width' => 325);
41
 
42
  /* Create the widget. */
43
+ parent::__construct(
44
  'addthis-widget',
45
  'AddThis Sharing Buttons',
46
  $widget_ops,
addthis_social_widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: AddThis Sharing Buttons
4
  * Plugin URI: http://www.addthis.com
5
  * Description: Use the AddThis suite of website tools which includes sharing, following, recommended content, and conversion tools to help you make your website smarter. With AddThis, you can see how your users are engaging with your content, provide a personalized experience for each user and encourage them to share, subscribe or follow.
6
- * Version: 5.0.12
7
  * Author: The AddThis Team
8
  * Author URI: http://www.addthis.com/
9
  * License: GPL2
@@ -36,6 +36,7 @@ define( 'ENABLE_ADDITIONAL_PLACEMENT_OPTION', 0);
36
  require_once('AddThisWordPressSharingButtonsPlugin.php');
37
  require_once('AddThisWordPressConnector.php');
38
  require_once('AddThisConfigs.php');
 
39
 
40
  $addThisSharingButtonsPluginObject = new AddThisWordPressSharingButtonsPlugin();
41
  $cmsConnector = new AddThisWordPressConnector($addThisSharingButtonsPluginObject);
@@ -109,6 +110,8 @@ function pluginActivationNotice()
109
  }
110
  }
111
 
 
 
112
  /**
113
  * Make sure the option gets added on registration
114
  * @since 2.0.6
@@ -699,7 +702,9 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
699
  ) {
700
  $configs['addthis_profile'] = $input['addthis_profile'];
701
  }
702
- } else {
 
 
703
  $configs = addthis_parse_options($input);
704
  }
705
 
@@ -851,17 +856,19 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
851
 
852
  // All the checkbox fields
853
  $checkboxFields = array(
854
- 'above_auto_services',
855
  'addthis_508',
856
- 'addthis_above_enabled',
857
  'addthis_addressbar',
858
- 'addthis_aftertitle' ,
859
  'addthis_append_data',
860
  'addthis_asynchronous_loading',
861
- 'addthis_beforecomments',
862
- 'addthis_below_enabled',
863
  'addthis_bitly',
864
  'addthis_per_post_enabled',
 
 
 
 
 
 
865
  'addthis_sidebar_enabled',
866
  'below_auto_services',
867
  );
@@ -881,41 +888,31 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
881
  }
882
  }
883
 
884
- if (isset($data['data_ga_property'])) {
885
- $options['data_ga_property'] = sanitize_text_field($data['data_ga_property']);
886
- }
887
-
888
- //[addthis_twitter_template]
889
- if (isset($data['addthis_twitter_template'])) {
890
- //Parse the first twitter username to be used with via
891
- $options['addthis_twitter_template'] = sanitize_text_field($data['addthis_twitter_template']);
892
- }
893
-
894
- //[addthis_language] =>
895
- if (isset($data['addthis_language'])) {
896
- $options['addthis_language'] = sanitize_text_field($data['addthis_language']);
897
- }
898
-
899
- //[atversion]=>
900
- if (isset($data['atversion'])) {
901
- $options['atversion'] = sanitize_text_field($data['atversion']);
902
- }
903
-
904
- //[atversion_update_status]=>
905
- if (isset($data['atversion_update_status'])) {
906
- $options['atversion_update_status'] = sanitize_text_field($data['atversion_update_status']);
907
- }
908
-
909
- if (isset($data['credential_validation_status'])) {
910
- $options['credential_validation_status'] = sanitize_text_field($data['credential_validation_status']);
911
- }
912
-
913
- if (isset($data['addthis_config_json'])) {
914
- $options['addthis_config_json'] = sanitize_text_field($data['addthis_config_json']);
915
- }
916
 
917
- if (isset($data['addthis_share_json'])) {
918
- $options['addthis_share_json'] = sanitize_text_field($data['addthis_share_json']);
 
 
919
  }
920
 
921
  if (!empty($data['above_chosen_list'])) {
@@ -930,31 +927,10 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
930
  $options['below_chosen_list'] = "";
931
  }
932
 
933
- if (isset($data['addthis_sidebar_position'])) {
934
- $options['addthis_sidebar_position'] = $data['addthis_sidebar_position'];
935
- }
936
-
937
- if (isset($data['addthis_sidebar_count'])) {
938
- $options['addthis_sidebar_count'] = $data['addthis_sidebar_count'];
939
- }
940
-
941
- if (isset($data['addthis_sidebar_theme'])) {
942
- $options['addthis_sidebar_theme'] = $data['addthis_sidebar_theme'];
943
- }
944
-
945
- if (isset($data['addthis_environment'])) {
946
- $options['addthis_environment'] = $data['addthis_environment'];
947
- }
948
-
949
- if (isset($data['addthis_plugin_controls'])) {
950
- $options['addthis_plugin_controls'] = $data['addthis_plugin_controls'];
951
- }
952
-
953
- if (isset($data['addthis_rate_us'])) {
954
- if($options['addthis_rate_us'] != $data['addthis_rate_us']) {
955
  $options['addthis_rate_us_timestamp'] = time();
956
- }
957
- $options['addthis_rate_us'] = $data['addthis_rate_us'];
958
  }
959
 
960
  return $options;
@@ -1358,8 +1334,6 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
1358
  global $AddThis_addjs_sharing_button_plugin;
1359
  $script = addthis_output_script(true, true);
1360
  $AddThis_addjs_sharing_button_plugin->addToScript($script);
1361
-
1362
- $addthis_sidebar = addthis_sidebar_script();
1363
  $AddThis_addjs_sharing_button_plugin->addAfterScript($addthis_sidebar);
1364
  }
1365
 
@@ -1375,16 +1349,13 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
1375
  $options = $addThisConfigs->getConfigs();
1376
 
1377
  $addthis_config = $addThisConfigs->createAddThisConfigVariable();
1378
- $addthis_config_js = '';
1379
- if (!empty($addthis_config)) {
1380
- $addthis_config_js = 'var addthis_config = '. json_encode($addthis_config) .';';
1381
- }
1382
 
1383
  $addthis_share = $addThisConfigs->createAddThisShareVariable();
1384
- $addthis_share_js = '';
1385
- if (!empty($addthis_share)) {
1386
- $addthis_share_js = 'var addthis_share = '. json_encode($addthis_share) .';';
1387
- }
1388
 
1389
  if ($justConfig) {
1390
  $script = "\n" . $addthis_config_js . "\n" . $addthis_share_js . "\n";
@@ -1424,6 +1395,9 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
1424
  if (typeof(addthis_share) == "undefined") {
1425
  ' . $addthis_share_js . '
1426
  }
 
 
 
1427
  </script>
1428
  <script
1429
  data-cfasync="false"
@@ -1432,6 +1406,16 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
1432
  ' . $async . '
1433
  >
1434
  </script>
 
 
 
 
 
 
 
 
 
 
1435
  ';
1436
 
1437
  if (!is_admin() && !is_feed()) {
@@ -1441,50 +1425,6 @@ if ($addthis_options['addthis_plugin_controls'] == "AddThis") {
1441
  }
1442
  }
1443
 
1444
- function addthis_sidebar_script(){
1445
- global $addThisConfigs;
1446
- $options = $addThisConfigs->getConfigs();
1447
- $return = '';
1448
-
1449
- if ($options['addthis_sidebar_enabled'] != true) {
1450
- return $return;
1451
- }
1452
-
1453
- $templateType = _addthis_determine_template_type();
1454
-
1455
- if (is_string($templateType)) {
1456
- $fieldList = $addThisConfigs->getFieldsForContentTypeSharingLocations($templateType, 'sidebar');
1457
- $fieldName = $fieldList[0]['fieldName'];
1458
- $display = (isset($options[$fieldName]) && $options[$fieldName]) ? true : false;
1459
- } else {
1460
- $display = false;
1461
- }
1462
-
1463
- if (!$display) {
1464
- return $return;
1465
- }
1466
-
1467
- $return .= "
1468
- (function() {
1469
- var at_interval = setInterval(function () {
1470
- if(window.addthis) {
1471
- clearInterval(at_interval);
1472
- addthis.layers(
1473
- {
1474
- 'theme' : '".strtolower($options['addthis_sidebar_theme'])."',
1475
- 'share' : {
1476
- 'position' : '".$options['addthis_sidebar_position']."',
1477
- 'numPreferredServices' : ".$options['addthis_sidebar_count']."
1478
- }
1479
- }
1480
- );
1481
- }
1482
- },1000)
1483
- }());";
1484
-
1485
- return $return;
1486
- }
1487
-
1488
  /**
1489
  * Appends AddThis button to post content.
1490
  */
@@ -1965,8 +1905,6 @@ EOF;
1965
  return $isPro;
1966
  }
1967
 
1968
- require_once('addthis_post_metabox.php');
1969
-
1970
  function addthis_deactivation_hook()
1971
  {
1972
  if (get_option('addthis_run_once')) {
@@ -2465,8 +2403,8 @@ function _addthis_display_options_card() {
2465
  <input
2466
  id="addthis_508"
2467
  type="checkbox"
2468
- name="addthis_settings[addthis_508]" v
2469
- alue="true" ' . $a508Checked . ' />
2470
  <label for="addthis_508">
2471
  <span class="addthis-checkbox-label">
2472
  <strong>' . translate("Enhanced accessibility", 'addthis_trans_domain') . '</strong>
@@ -2567,7 +2505,30 @@ function _addthis_additional_options_card() {
2567
  name="addthis_settings[addthis_share_json]"
2568
  id="addthis-share-json"/>' . $options['addthis_share_json'] . '</textarea>
2569
  <span id="share-error" class="hidden error_text">Invalid JSON format</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2570
  </li>
 
 
 
 
 
2571
  </ul>
2572
  </li>
2573
  </ul>
3
  * Plugin Name: AddThis Sharing Buttons
4
  * Plugin URI: http://www.addthis.com
5
  * Description: Use the AddThis suite of website tools which includes sharing, following, recommended content, and conversion tools to help you make your website smarter. With AddThis, you can see how your users are engaging with your content, provide a personalized experience for each user and encourage them to share, subscribe or follow.
6
+ * Version: 5.1.0
7
  * Author: The AddThis Team
8
  * Author URI: http://www.addthis.com/
9
  * License: GPL2
36
  require_once('AddThisWordPressSharingButtonsPlugin.php');
37
  require_once('AddThisWordPressConnector.php');
38
  require_once('AddThisConfigs.php');
39
+ require_once('addthis_post_metabox.php');
40
 
41
  $addThisSharingButtonsPluginObject = new AddThisWordPressSharingButtonsPlugin();
42
  $cmsConnector = new AddThisWordPressConnector($addThisSharingButtonsPluginObject);
110
  }
111
  }
112
 
113
+ register_deactivation_hook(__FILE__, array($cmsConnector, 'deactivate'));
114
+
115
  /**
116
  * Make sure the option gets added on registration
117
  * @since 2.0.6
702
  ) {
703
  $configs['addthis_profile'] = $input['addthis_profile'];
704
  }
705
+ } elseif(count($input) > 2) {
706
+ // there should be more than two entires in forms posted from this
707
+ // plugin
708
  $configs = addthis_parse_options($input);
709
  }
710
 
856
 
857
  // All the checkbox fields
858
  $checkboxFields = array(
859
+ // general
860
  'addthis_508',
 
861
  'addthis_addressbar',
 
862
  'addthis_append_data',
863
  'addthis_asynchronous_loading',
 
 
864
  'addthis_bitly',
865
  'addthis_per_post_enabled',
866
+ // WordPress mode only
867
+ 'above_auto_services',
868
+ 'addthis_above_enabled',
869
+ 'addthis_aftertitle' ,
870
+ 'addthis_beforecomments',
871
+ 'addthis_below_enabled',
872
  'addthis_sidebar_enabled',
873
  'below_auto_services',
874
  );
888
  }
889
  }
890
 
891
+ $checkAndSanitize = array(
892
+ // general
893
+ 'addthis_config_json',
894
+ 'addthis_environment',
895
+ 'addthis_language',
896
+ 'addthis_layers_json',
897
+ 'addthis_plugin_controls',
898
+ 'addthis_profile',
899
+ 'addthis_rate_us',
900
+ 'addthis_share_json',
901
+ 'addthis_twitter_template',
902
+ 'atversion',
903
+ 'atversion_update_status',
904
+ 'credential_validation_status',
905
+ 'data_ga_property',
906
+ // WordPress mode only
907
+ 'addthis_sidebar_count',
908
+ 'addthis_sidebar_position',
909
+ 'addthis_sidebar_theme',
910
+ );
 
 
 
 
 
 
 
 
 
 
 
 
911
 
912
+ foreach ($checkAndSanitize as $field) {
913
+ if (isset($data[$field])) {
914
+ $options[$field] = sanitize_text_field($data[$field]);
915
+ }
916
  }
917
 
918
  if (!empty($data['above_chosen_list'])) {
927
  $options['below_chosen_list'] = "";
928
  }
929
 
930
+ if (isset($data['addthis_rate_us'])
931
+ && $options['addthis_rate_us'] != $data['addthis_rate_us']
932
+ ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
933
  $options['addthis_rate_us_timestamp'] = time();
 
 
934
  }
935
 
936
  return $options;
1334
  global $AddThis_addjs_sharing_button_plugin;
1335
  $script = addthis_output_script(true, true);
1336
  $AddThis_addjs_sharing_button_plugin->addToScript($script);
 
 
1337
  $AddThis_addjs_sharing_button_plugin->addAfterScript($addthis_sidebar);
1338
  }
1339
 
1349
  $options = $addThisConfigs->getConfigs();
1350
 
1351
  $addthis_config = $addThisConfigs->createAddThisConfigVariable();
1352
+ $addthis_config_js = 'var addthis_config = '. json_encode($addthis_config) .';';
 
 
 
1353
 
1354
  $addthis_share = $addThisConfigs->createAddThisShareVariable();
1355
+ $addthis_share_js = 'var addthis_share = '. json_encode($addthis_share) .';';
1356
+
1357
+ $addthis_layers = $addThisConfigs->createAddThisLayersVariable();
1358
+ $addthis_layers_js = 'var addthis_layers = '. json_encode($addthis_layers) .';';
1359
 
1360
  if ($justConfig) {
1361
  $script = "\n" . $addthis_config_js . "\n" . $addthis_share_js . "\n";
1395
  if (typeof(addthis_share) == "undefined") {
1396
  ' . $addthis_share_js . '
1397
  }
1398
+ if (typeof(addthis_layers) == "undefined") {
1399
+ ' . $addthis_layers_js . '
1400
+ }
1401
  </script>
1402
  <script
1403
  data-cfasync="false"
1406
  ' . $async . '
1407
  >
1408
  </script>
1409
+ <script data-cfasync="false" type="text/javascript">
1410
+ (function() {
1411
+ var at_interval = setInterval(function () {
1412
+ if(window.addthis) {
1413
+ clearInterval(at_interval);
1414
+ addthis.layers(addthis_layers);
1415
+ }
1416
+ },1000)
1417
+ }());
1418
+ </script>
1419
  ';
1420
 
1421
  if (!is_admin() && !is_feed()) {
1425
  }
1426
  }
1427
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1428
  /**
1429
  * Appends AddThis button to post content.
1430
  */
1905
  return $isPro;
1906
  }
1907
 
 
 
1908
  function addthis_deactivation_hook()
1909
  {
1910
  if (get_option('addthis_run_once')) {
2403
  <input
2404
  id="addthis_508"
2405
  type="checkbox"
2406
+ name="addthis_settings[addthis_508]"
2407
+ value="true" ' . $a508Checked . ' />
2408
  <label for="addthis_508">
2409
  <span class="addthis-checkbox-label">
2410
  <strong>' . translate("Enhanced accessibility", 'addthis_trans_domain') . '</strong>
2505
  name="addthis_settings[addthis_share_json]"
2506
  id="addthis-share-json"/>' . $options['addthis_share_json'] . '</textarea>
2507
  <span id="share-error" class="hidden error_text">Invalid JSON format</span>
2508
+ </li>';
2509
+
2510
+ if ($options['addthis_plugin_controls'] != 'AddThis') {
2511
+ $html .= '
2512
+ <li>
2513
+ <label for="addthis_layers_json">
2514
+ ' . translate("addthis.layers() initial paramater (json format)", 'addthis_trans_domain') . '
2515
+ </label>
2516
+ <br/>
2517
+ <small>ex:- <i>{ "share": { "services": "facebook,twitter,google_plusone_share,pinterest_share,print,more" } }</i></small>
2518
+ <div><p>For more information, please see the AddThis documentation on <a href="http://support.addthis.com/customer/portal/articles/1200473-smart-layers-api">the addthis.layers() paramters</a>.</p></div>
2519
+ <textarea
2520
+ id="addthis_layers_json"
2521
+ rows="3"
2522
+ type="text"
2523
+ name="addthis_settings[addthis_layers_json]"
2524
+ id="addthis-layers-json"/>' . $options['addthis_layers_json'] . '</textarea>
2525
+ <span id="layers-error" class="hidden error_text">Invalid JSON format</span>
2526
  </li>
2527
+ ';
2528
+ }
2529
+
2530
+ $html .= '
2531
+
2532
  </ul>
2533
  </li>
2534
  </ul>
js/addthis-for-wordpress.js CHANGED
@@ -22,7 +22,7 @@
22
  * Javascript for Addthis for Wordpress plugin
23
  */
24
 
25
- jQuery(document).ready(function($) {
26
  jQuery('#async_load').change(function(){
27
 
28
  var syncLoad = jQuery(this).is(':checked')?1:0;
22
  * Javascript for Addthis for Wordpress plugin
23
  */
24
 
25
+ jQuery(document).ready(function(jQuery) {
26
  jQuery('#async_load').change(function(){
27
 
28
  var syncLoad = jQuery(this).is(':checked')?1:0;
js/core-1.1.1.js DELETED
@@ -1,23 +0,0 @@
1
- /*! jQuery v1.8.3 jquery.com | jquery.org/license */
2
- (function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&v.extend(!0,e,i)}function An(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function On(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function Fn(){try{return new e.XMLHttpRequest}catch(t){}}function In(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $n(){return setTimeout(function(){qn=t},0),qn=v.now()}function Jn(e,t){v.each(t,function(t,n){var r=(Vn[t]||[]).concat(Vn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Kn(e,t,n){var r,i=0,s=0,o=Xn.length,u=v.Deferred().always(function(){delete a.elem}),a=function(){var t=qn||$n(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,i=1-r,s=0,o=f.tweens.length;for(;s<o;s++)f.tweens[s].run(i);return u.notifyWith(e,[f,i,n]),i<1&&o?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:v.extend({},t),opts:v.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:qn||$n(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=v.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Qn(l,f.opts.specialEasing);for(;i<o;i++){r=Xn[i].call(f,e,l,f.opts);if(r)return r}return Jn(f,l),v.isFunction(f.opts.start)&&f.opts.start.call(e,f),v.fx.timer(v.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Qn(e,t){var n,r,i,s,o;for(n in e){r=v.camelCase(n),i=t[r],s=e[n],v.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=v.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Gn(e,t,n){var r,i,s,o,u,a,f,l,c,h=this,p=e.style,d={},m=[],g=e.nodeType&&Gt(e);n.queue||(l=v._queueHooks(e,"fx"),l.unqueued==null&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,h.always(function(){h.always(function(){l.unqueued--,v.queue(e,"fx").length||l.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],v.css(e,"display")==="inline"&&v.css(e,"float")==="none"&&(!v.support.inlineBlockNeedsLayout||nn(e.nodeName)==="inline"?p.display="inline-block":p.zoom=1)),n.overflow&&(p.overflow="hidden",v.support.shrinkWrapBlocks||h.done(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Un.exec(s)){delete t[r],a=a||s==="toggle";if(s===(g?"hide":"show"))continue;m.push(r)}}o=m.length;if(o){u=v._data(e,"fxshow")||v._data(e,"fxshow",{}),"hidden"in u&&(g=u.hidden),a&&(u.hidden=!g),g?v(e).show():h.done(function(){v(e).hide()}),h.done(function(){var t;v.removeData(e,"fxshow",!0);for(t in d)v.style(e,t,d[t])});for(r=0;r<o;r++)i=m[r],f=h.createTween(i,g?u[i]:0),d[i]=u[i]||v.style(e,i),i in u||(u[i]=f.start,g&&(f.end=f.start,f.start=i==="width"||i==="height"?1:0))}}function Yn(e,t,n,r,i){return new Yn.prototype.init(e,t,n,r,i)}function Zn(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=$t[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function tr(e){return v.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.navigator,u=e.jQuery,a=e.$,f=Array.prototype.push,l=Array.prototype.slice,c=Array.prototype.indexOf,h=Object.prototype.toString,p=Object.prototype.hasOwnProperty,d=String.prototype.trim,v=function(e,t){return new v.fn.init(e,t,n)},m=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,g=/\S/,y=/\s+/,b=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,w=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(v.isPlainObject(i)||(s=v.isArray(i)))?(s?(s=!1,o=r&&v.isArray(r)?r:[]):o=r&&v.isPlainObject(r)?r:{},u[n]=v.extend(l,o,i)):i!==t&&(u[n]=i)}return u},v.extend({noConflict:function(t){return e.$===v&&(e.$=a),t&&e.jQuery===v&&(e.jQuery=u),v},isReady:!1,readyWait:1,holdReady:function(e){e?v.readyWait++:v.ready(!0)},ready:function(e){if(e===!0?--v.readyWait:v.isReady)return;if(!i.body)return setTimeout(v.ready,1);v.isReady=!0;if(e!==!0&&--v.readyWait>0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:d&&!d.call("\ufeff\u00a0")?function(e){return e==null?"":d.call(e)}:function(e){return e==null?"":(e+"").replace(b,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=v.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||v.isWindow(e)?f.call(r,e):v.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(c)return c.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof v||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),v.isFunction(e)?(i=l.call(arguments,2),s=function(){return e.apply(n,i.concat(l.call(arguments)))},s.guid=e.guid=e.guid||v.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)v.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&v.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(v(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),v.ready.promise=function(t){if(!r){r=v.Deferred();if(i.readyState==="complete")setTimeout(v.ready,1);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",A,!1),e.addEventListener("load",v.ready,!1);else{i.attachEvent("onreadystatechange",A),e.attachEvent("onload",v.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!v.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}v.ready()}}()}}return r.promise(t)},v.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){O["[object "+t+"]"]=t.toLowerCase()}),n=v(i);var M={};v.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):v.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){v.each(t,function(t,n){var i=v.type(n);i==="function"?(!e.unique||!c.has(n))&&a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&v.each(arguments,function(e,t){var n;while((n=v.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&v.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),v.support=function(){var t,n,r,s,o,u,a,f,l,c,h,p=i.createElement("div");p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&v.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),v.fn.extend({data:function(e,n){var r,i,s,o,u,a=this[0],f=0,l=null;if(e===t){if(this.length){l=v.data(a);if(a.nodeType===1&&!v._data(a,"parsedAttrs")){s=a.attributes;for(u=s.length;f<u;f++)o=s[f].name,o.indexOf("data-")||(o=v.camelCase(o.substring(5)),H(a,o,l[o]));v._data(a,"parsedAttrs",!0)}}return l}return typeof e=="object"?this.each(function(){v.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",v.access(this,function(n){if(n===t)return l=this.triggerHandler("getData"+i,[r[0]]),l===t&&a&&(l=v.data(a,e),l=H(a,e,l)),l===t&&r[1]?this.data(r[0]):l;r[1]=n,this.each(function(){var t=v(this);t.triggerHandler("setData"+i,r),v.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?v.queue(this[0],e):n===t?this:this.each(function(){var t=v.queue(this,e,n);v._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},delay:function(e,t){return e=v.fx?v.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=v.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=v._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var j,F,I,q=/[\t\r\n]/g,R=/\r/g,U=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,W=/^a(?:rea|)$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,V=v.support.getSetAttribute;v.fn.extend({attr:function(e,t){return v.access(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)s.indexOf(" "+t[o]+" ")<0&&(s+=t[o]+" ");i.className=v.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(v.isFunction(e))return this.each(function(t){v(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(y);for(u=0,a=this.length;u<a;u++){i=this[u];if(i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(q," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(q," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(v.support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!v.nodeName(n.parentNode,"optgroup"))){t=v(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n=v.makeArray(t);return v(e).find("option").each(function(){this.selected=v.inArray(v(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o<r.length;o++)i=r[o],i&&(n=v.propFix[i]||i,s=X.test(i),s||v.attr(e,i,""),e.removeAttribute(V?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(U.test(e.nodeName)&&e.parentNode)v.error("type property can't be changed");else if(!v.support.radioValue&&t==="radio"&&v.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return j&&v.nodeName(e,"button")?j.get(e,t):t in e?e.value:null},set:function(e,t,n){if(j&&v.nodeName(e,"button"))return j.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!v.isXMLDoc(e),o&&(n=v.propFix[n]||n,s=v.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):z.test(e.nodeName)||W.test(e.nodeName)&&e.href?0:t}}}}),F={get:function(e,n){var r,i=v.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?v.removeAttr(e,n):(r=v.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},V||(I={name:!0,id:!0,coords:!0},j=v.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(I[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=i.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},v.each(["width","height"],function(e,t){v.attrHooks[t]=v.extend(v.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),v.attrHooks.contenteditable={get:j.get,set:function(e,t,n){t===""&&(t="false"),j.set(e,t,n)}}),v.support.hrefNormalized||v.each(["href","src","width","height"],function(e,n){v.attrHooks[n]=v.extend(v.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),v.support.style||(v.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),v.support.optSelected||(v.propHooks.selected=v.extend(v.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),v.support.enctype||(v.propFix.enctype="encoding"),v.support.checkOn||v.each(["radio","checkbox"],function(){v.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]=v.extend(v.valHooks[this],{set:function(e,t){if(v.isArray(t))return e.checked=v.inArray(v(e).val(),t)>=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f<n.length;f++){l=J.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),g=v.event.special[c]||{},c=(s?g.delegateType:g.bindType)||c,g=v.event.special[c]||{},p=v.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&v.expr.match.needsContext.test(s),namespace:h.join(".")},d),m=a[c];if(!m){m=a[c]=[],m.delegateCount=0;if(!g.setup||g.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}g.add&&(g.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),v.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,m,g=v.hasData(e)&&v._data(e);if(!g||!(h=g.events))return;t=v.trim(Z(t||"")).split(" ");for(s=0;s<t.length;s++){o=J.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)v.event.remove(e,u+t[s],n,r,!0);continue}p=v.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)m=d[c],(i||a===m.origType)&&(!n||n.guid===m.guid)&&(!f||f.test(m.namespace))&&(!r||r===m.selector||r==="**"&&m.selector)&&(d.splice(c--,1),m.selector&&d.delegateCount--,p.remove&&p.remove.call(e,m));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,g.handle)===!1)&&v.removeEvent(e,u,g.handle),delete h[u])}v.isEmptyObject(h)&&(delete g.handle,v.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,s,o){if(!s||s.nodeType!==3&&s.nodeType!==8){var u,a,f,l,c,h,p,d,m,g,y=n.type||n,b=[];if(Y.test(y+v.event.triggered))return;y.indexOf("!")>=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f<m.length&&!n.isPropagationStopped();f++)l=m[f][0],n.type=m[f][1],d=(v._data(l,"events")||{})[n.type]&&v._data(l,"handle"),d&&d.apply(l,r),d=h&&l[h],d&&v.acceptData(l)&&d.apply&&d.apply(l,r)===!1&&n.preventDefault();return n.type=y,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(y!=="click"||!v.nodeName(s,"a"))&&v.acceptData(s)&&h&&s[y]&&(y!=="focus"&&y!=="blur"||n.target.offsetWidth!==0)&&!v.isWindow(s)&&(c=s[h],c&&(s[h]=null),v.event.triggered=y,s[y](),v.event.triggered=t,c&&(s[h]=c)),n.result}return},dispatch:function(n){n=v.event.fix(n||e.event);var r,i,s,o,u,a,f,c,h,p,d=(v._data(this,"events")||{})[n.type]||[],m=d.delegateCount,g=l.call(arguments),y=!n.exclusive&&!n.namespace,b=v.event.special[n.type]||{},w=[];g[0]=n,n.delegateTarget=this;if(b.preDispatch&&b.preDispatch.call(this,n)===!1)return;if(m&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<m;r++)c=d[r],h=c.selector,u[h]===t&&(u[h]=c.needsContext?v(h,this).index(s)>=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r<w.length&&!n.isPropagationStopped();r++){a=w[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){c=a.matches[i];if(y||!n.namespace&&!c.namespace||n.namespace_re&&n.namespace_re.test(c.namespace))n.data=c.data,n.handleObj=c,o=((v.event.special[c.origType]||{}).handle||c.handler).apply(a.elem,g),o!==t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return b.postDispatch&&b.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[v.expando])return e;var t,n,r=e,s=v.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=v.Event(r);for(t=o.length;t;)n=o[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){v.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=v.extend(new v.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?v.event.trigger(i,null,t):v.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},v.event.handle=v.event.dispatch,v.removeEvent=i.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?tt:et):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||v.now(),this[v.expando]=!0},v.Event.prototype={preventDefault:function(){this.isDefaultPrevented=tt;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=tt;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tt,this.stopPropagation()},isDefaultPrevented:et,isPropagationStopped:et,isImmediatePropagationStopped:et},v.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==r&&!v.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),v.support.submitBubbles||(v.event.special.submit={setup:function(){if(v.nodeName(this,"form"))return!1;v.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=v.nodeName(n,"input")||v.nodeName(n,"button")?n.form:t;r&&!v._data(r,"_submit_attached")&&(v.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),v._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&v.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(v.nodeName(this,"form"))return!1;v.event.remove(this,"._submit")}}),v.support.changeBubbles||(v.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")v.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),v.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),v.event.simulate("change",this,e,!0)});return!1}v.event.add(this,"beforeactivate._change",function(e){var t=e.target;$.test(t.nodeName)&&!v._data(t,"_change_attached")&&(v.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&v.event.simulate("change",this.parentNode,e,!0)}),v._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return v.event.remove(this,"._change"),!$.test(this.nodeName)}}),v.support.focusinBubbles||v.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){v.event.simulate(t,e.target,v.event.fix(e),!0)};v.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),v.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=et;else if(!i)return this;return s===1&&(o=i,i=function(e){return v().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=v.guid++)),this.each(function(){v.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,v(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=et),this.each(function(){v.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return v(this.context).on(e,this.selector,t,n),this},die:function(e,t){return v(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return v.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||v.guid++,r=0,i=function(n){var i=(v._data(this,"lastToggle"+e.guid)||0)%r;return v._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),v.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){v.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function ct(e,t,n,r,i,s){return r&&!r[d]&&(r=ct(r)),i&&!i[d]&&(i=ct(i,s)),N(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||dt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?lt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=lt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?T.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a<s;a++)if(n=i.relative[e[a].type])h=[at(ft(h),n)];else{n=i.filter[e[a].type].apply(null,e[a].matches);if(n[d]){r=++a;for(;r<s;r++)if(i.relative[e[r].type])break;return ct(a>1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a<r&&ht(e.slice(a,r)),r<s&&ht(e=e.slice(r)),r<s&&e.join(""))}h.push(n)}return ft(h)}function pt(e,t){var r=t.length>0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r<i;r++)nt(e,t[r],n);return n}function vt(e,t,n,r,s){var o,u,f,l,c,h=ut(e),p=h.length;if(!r&&h.length===1){u=h[0]=h[0].slice(0);if(u.length>2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},N=function(e,t){return e[d]=t==null||t,e},C=function(){var e={},t=[];return N(function(n,r){return t.push(n)>i.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="<a name='"+d+"'></a><div name='"+d+"'></div>",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:st(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:st(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},f=y.compareDocumentPosition?function(e,t){return e===t?(l=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return l=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,u=t.parentNode,a=o;if(o===u)return ot(e,t);if(!o)return-1;if(!u)return 1;while(a)i.unshift(a),a=a.parentNode;a=u;while(a)s.unshift(a),a=a.parentNode;n=i.length,r=s.length;for(var f=0;f<n&&f<r;f++)if(i[f]!==s[f])return ot(i[f],s[f]);return f===n?ot(e,s[f],-1):ot(i[f],t,1)},[0,0].sort(f),h=!l,nt.uniqueSort=function(e){var t,n=[],r=1,i=0;l=h,e.sort(f);if(l){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e},nt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},a=nt.compile=function(e,t){var n,r=[],i=[],s=A[d][e+" "];if(!s){t||(t=ut(e)),n=t.length;while(n--)s=ht(t[n]),s[d]?r.push(s):i.push(s);s=A(e,pt(i,r))}return s},g.querySelectorAll&&function(){var e,t=vt,n=/'|\\/g,r=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],s=[":active"],u=y.matchesSelector||y.mozMatchesSelector||y.webkitMatchesSelector||y.oMatchesSelector||y.msMatchesSelector;K(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(v.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,v.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=v(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(v.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1),"not",e)},filter:function(e){return this.pushStack(ft(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?st.test(e)?v(e,this.context).index(this[0])>=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/<tbody/i,gt=/<|&#?\w+;/,yt=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,wt=new RegExp("<(?:"+ct+")[\\s/>]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Nt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X<div>","</div>"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return ut(this[0])?this.length?this.pushStack(v(v.isFunction(e)?e():e),"replaceWith",e):this:v.isFunction(e)?this.each(function(t){var n=v(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=v(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;v(this).remove(),t?v(t).before(e):v(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o,u,a=0,f=e[0],l=[],c=this.length;if(!v.support.checkClone&&c>1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a<c;a++)r.call(n&&v.nodeName(this[a],"table")?Lt(this[a],"tbody"):this[a],a===u?o:v.clone(o,!0,!0))}o=s=null,l.length&&v.each(l,function(e,t){t.src?v.ajax?v.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):v.error("no ajax"):v.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Tt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),v.buildFragment=function(e,n,r){var s,o,u,a=e[0];return n=n||i,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof a=="string"&&a.length<512&&n===i&&a.charAt(0)==="<"&&!bt.test(a)&&(v.support.checkClone||!St.test(a))&&(v.support.html5Clone||!wt.test(a))&&(o=!0,s=v.fragments[a],u=s!==t),s||(s=n.createDocumentFragment(),v.clean(e,n,s,r),o&&(v.fragments[a]=u&&s)),{fragment:s,cacheable:o}},v.fragments={},v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(n){var r,i=0,s=[],o=v(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1></$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]==="<table>"&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("<div>").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,n=v.timers,r=0;qn=v.now();for(;r<n.length;r++)e=n[r],!e()&&n[r]===e&&n.splice(r--,1);n.length||v.fx.stop(),qn=t},v.fx.timer=function(e){e()&&v.timers.push(e)&&!Rn&&(Rn=setInterval(v.fx.tick,v.fx.interval))},v.fx.interval=13,v.fx.stop=function(){clearInterval(Rn),Rn=null},v.fx.speeds={slow:600,fast:200,_default:400},v.fx.step={},v.expr&&v.expr.filters&&(v.expr.filters.animated=function(e){return v.grep(v.timers,function(t){return e===t.elem}).length});var er=/^(?:body|html)$/i;v.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){v.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f={top:0,left:0},l=this[0],c=l&&l.ownerDocument;if(!c)return;return(r=c.body)===l?v.offset.bodyOffset(l):(n=c.documentElement,v.contains(n,l)?(typeof l.getBoundingClientRect!="undefined"&&(f=l.getBoundingClientRect()),i=tr(c),s=n.clientTop||r.clientTop||0,o=n.clientLeft||r.clientLeft||0,u=i.pageYOffset||n.scrollTop,a=i.pageXOffset||n.scrollLeft,{top:f.top+u-s,left:f.left+a-o}):f)},v.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return v.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(v.css(e,"marginTop"))||0,n+=parseFloat(v.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=v.css(e,"position");r==="static"&&(e.style.position="relative");var i=v(e),s=i.offset(),o=v.css(e,"top"),u=v.css(e,"left"),a=(r==="absolute"||r==="fixed")&&v.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window);
3
-
4
- /**
5
- * Cookie plugin
6
- *
7
- * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
8
- * Dual licensed under the MIT and GPL licenses:
9
- * http://www.opensource.org/licenses/mit-license.php
10
- * http://www.gnu.org/licenses/gpl.html
11
- *
12
- */
13
- jQuery.cookie=function(_1,_2,_3){if(typeof _2!="undefined"){_3=_3||{};if(_2===null){_2="";_3.expires=-1;}var _4="";if(_3.expires&&(typeof _3.expires=="number"||_3.expires.toUTCString)){var _5;if(typeof _3.expires=="number"){_5=new Date();_5.setTime(_5.getTime()+(_3.expires*24*60*60*1000));}else{_5=_3.expires;}_4="; expires="+_5.toUTCString();}var _6=_3.path?"; path="+(_3.path):"";var _7=_3.domain?"; domain="+(_3.domain):"";var _8=_3.secure?"; secure":"";document.cookie=[_1,"=",encodeURIComponent(_2),_4,_6,_7,_8].join("");}else{var _9=null;if(document.cookie&&document.cookie!=""){var _a=document.cookie.split(";");for(var i=0;i<_a.length;i++){var _c=jQuery.trim(_a[i]);if(_c.substring(0,_1.length+1)==(_1+"=")){_9=decodeURIComponent(_c.substring(_1.length+1));break;}}}return _9;}};
14
-
15
- /*
16
- * jQuery BBQ: Back Button & Query Library - v1.0.3 - 12/2/2009
17
- * http://benalman.com/projects/jquery-bbq-plugin/
18
- *
19
- * Copyright (c) 2009 "Cowboy" Ben Alman
20
- * Dual licensed under the MIT and GPL licenses.
21
- * http://benalman.com/about/license/
22
- */
23
- (function($,c){var g,m=c.location,i=Array.prototype.slice,F=decodeURIComponent,a=$.param,o,d,r,p=$.bbq=$.bbq||{},q,e,A,b="hashchange",w="querystring",z="fragment",y="elemUrlAttr",h="href",E="src",D=$.browser,n=D.msie&&D.version<8,l="on"+b in c&&!n,s=/^.*\?|#.*$/g,B=/^.*\#/,u={};function t(G){return typeof G==="string"}function x(H){var G=i.call(arguments,1);return function(){return H.apply(this,G.concat(i.call(arguments)))}}function j(G){return G.replace(/^[^#]*#?(.*)$/,"$1")}function k(G){return G.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,O,G,I,L){var N,M,K,P,J;if(I!==g){K=G.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(L===2&&t(I)){M=I.replace(H?B:s,"")}else{P=d(K[2]);I=t(I)?d[H?z:w](I):I;M=L===2?I:L===1?$.extend({},I,P):$.extend({},P,I);M=a(M)}N=K[1]+(H?"#":M||!K[1]?"?":"")+M+J}else{N=O(G!==g?G:m[h])}return N}a[w]=x(f,0,k);a[z]=o=x(f,1,j);$.deparam=d=function(J,H){var I={},G={"true":!0,"false":!1,"null":null};$.each(J.replace(/\+/g," ").split("&"),function(N,P){var M=P.split("="),Q=F(M[0]),L,R=I,O=0,S=Q.split("]["),K=S.length-1;if(/\[/.test(S[0])&&/\]$/.test(S[K])){S[K]=S[K].replace(/\]$/,"");S=S.shift().split("[").concat(S);K=S.length-1}else{K=0}if(M.length===2){L=F(M[1]);if(H){L=L&&!isNaN(L)?+L:L==="undefined"?g:G[L]!==g?G[L]:L}if(K){for(;O<=K;O++){Q=S[O]===""?R.length:S[O];R=R[Q]=O<K?R[Q]||(S[O+1]&&isNaN(S[O+1])?{}:[]):L}}else{if($.isArray(I[Q])){I[Q].push(L)}else{if(I[Q]!==g){I[Q]=[I[Q],L]}else{I[Q]=L}}}}else{if(Q){I[Q]=H?g:""}}});return I};function v(I,H,G){if(H===g||typeof H==="boolean"){G=H;H=a[I?z:w]()}else{H=t(H)?H.replace(I?B:s,""):H}return d(H,G)}d[w]=x(v,0);d[z]=r=x(v,1);$[y]||($[y]=function(G){return $.extend(u,G)})({a:h,base:h,iframe:E,img:E,input:E,form:"action",link:h,script:E});e=$[y];function C(J,G,I,H){if(!t(I)&&typeof I!=="object"){H=I;I=G;G=g}return this.each(function(){var M=$(this),K=G||e()[(this.nodeName||"").toLowerCase()]||"",L=K&&M.attr(K)||"";M.attr(K,a[J](L,I,H))})}$.fn[w]=x(C,w);$.fn[z]=x(C,z);p.pushState=q=function(J,I){if(t(J)&&/^#/.test(J)&&I===g){I=2}var H=J!==g,G=o(m[h],H?J:{},H?I:2);m[h]=G+(/#/.test(G)?"":"#")};p.getState=function(H,G){return H===g||typeof H==="boolean"?r(H):r(G)[H]};p.pollDelay=100;$.event.special[b]={setup:function(){if(l){return false}A.start()},teardown:function(){if(l){return false}A.stop()},add:function(G,I,H){return function(K){var J=K[z]=o();K.getState=function(M,L){return M===g||typeof M==="boolean"?d(J,M):d(J,L)[M]};G.apply(this,arguments)}}};A=(function(){var H={},L,G,I,K;function J(){I=K=function(M){return M};if(n){G=$('<iframe src="javascript:0"/>').hide().appendTo("body")[0].contentWindow;K=function(){return j(G.document.location[h])};I=function(O,M){if(O!==M){var N=G.document;N.open().close();N.location.hash="#"+O}};I(o())}}H.start=function(){if(L){return}var N=o();I||J();(function M(){var P=o(),O=K(N);if(P!==N){I(N=P,O);$(c).trigger(b)}else{if(O!==N){q("#"+O)}}L=setTimeout(M,p.pollDelay)})()};H.stop=function(){if(!G){L&&clearTimeout(L);L=0}};return H})()})(jQuery,this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/gtc-sharing-personalize.js CHANGED
@@ -18,10 +18,10 @@
18
  * +--------------------------------------------------------------------------+
19
  */
20
 
21
- (function($, window, document, undefined) {
22
 
23
- var aboveshareNamespace = window.addthisnamespaces && window.addthisnamespaces['aboveshare'] ? addthisnamespaces['aboveshare']: 'addthis-share-above';
24
- var belowshareNamespace = window.addthisnamespaces && window.addthisnamespaces['belowshare'] ? addthisnamespaces['belowshare']: 'addthis-share-below';
25
 
26
  /* Event Tracking */
27
  function trackPageView(p) {
@@ -29,13 +29,13 @@
29
  }
30
 
31
  // jQuery ready event
32
- $(function() {
33
 
34
- $('.above-smart-sharing-container .restore-default-options').hide();
35
- $('.below-smart-sharing-container .restore-default-options').hide();
36
- $('#below').tooltip({ position: { my: "left+15 center", at: "right center" } });
37
- $('.sortable .disabled').tooltip({ position: { my: "left+15 center", at: "right center" } });
38
- $('.sortable .close').tooltip({ position: { my: "left+10 center", at: "right center" } });
39
  setTimeout(function() {
40
 
41
  window.customServicesAPI.events().fetchServices();
@@ -47,7 +47,7 @@
47
  // API for the custom service UI
48
  window.customServicesAPI = {
49
 
50
- 'loadDeferred': $.Deferred(),
51
 
52
  'scriptIncluded': false,
53
 
@@ -211,7 +211,7 @@
211
  'fetchServices': function() {
212
 
213
  var self = this,
214
- def = $.Deferred();
215
 
216
  if(self.scriptIncluded) {
217
  def.resolve(self.addthisButtons.services);
@@ -237,7 +237,7 @@
237
  'abovepopulateSharingServices': function(restoreDefaults, pageload) {
238
 
239
  var self = this,
240
- def = $.Deferred(),
241
  defaults,
242
  services,
243
  currentType,
@@ -245,8 +245,8 @@
245
  thirdPartyMappedDefaults,
246
  addthisServices,
247
  thirdPartyServices,
248
- abovesharingSortable = $('.above-smart-sharing-container .sharing-buttons .sortable'),
249
- aboveselectedSortable = $('.above-smart-sharing-container .selected-services .sortable');
250
 
251
  self.fetchServices().done(function(services) {
252
 
@@ -262,30 +262,30 @@
262
 
263
  defaults = restoreDefaults ? self.defaults: obj.rememberedDefaults;
264
 
265
- abovecurrentType = $('input[name="addthis_settings[above]"]:checked');
266
 
267
  if(!abovecurrentType.length) {
268
- abovecurrentType = $('input[name="addthis_settings[above]"]:visible').first();
269
  }
270
 
271
  if(abovecurrentType.length) {
272
 
273
- if(abovecurrentType.attr('id') == 'large_toolbox_above') {
274
- style = "horizontal";
275
- abovecurrentType = "addthisButtons";
276
- }
277
- else if(abovecurrentType.attr('id') == 'fb_tw_p1_sc_above') {
278
- style = "horizontal";
279
- abovecurrentType = "thirdPartyButtons";
280
- }
281
- else if(abovecurrentType.attr('id') == 'small_toolbox_above') {
282
- style = "horizontal";
283
- abovecurrentType = "addthisButtons";
284
- }
285
- else if(abovecurrentType.attr('id') == 'button_above') {
286
- style = "";
287
- abovecurrentType = "image";
288
- }
289
 
290
 
291
 
@@ -328,13 +328,13 @@
328
 
329
  }
330
 
331
- $('body').trigger('populatedList');
332
  def.resolve();
333
 
334
  }
335
 
336
  else {
337
- $('body').trigger('populatedList');
338
  def.resolve();
339
  }
340
  });
@@ -350,7 +350,7 @@
350
  'belowpopulateSharingServices': function(restoreDefaults, pageload) {
351
 
352
  var self = this,
353
- def = $.Deferred(),
354
  defaults,
355
  services,
356
  currentType,
@@ -358,8 +358,8 @@
358
  thirdPartyMappedDefaults,
359
  addthisServices,
360
  thirdPartyServices,
361
- belowsharingSortable = $('.below-smart-sharing-container .sharing-buttons .sortable'),
362
- belowselectedSortable = $('.below-smart-sharing-container .selected-services .sortable');
363
 
364
  self.fetchServices().done(function(services) {
365
 
@@ -376,32 +376,32 @@
376
  defaults = restoreDefaults ? self.defaults: obj.rememberedDefaults;
377
 
378
 
379
- belowcurrentType = $('input[name="addthis_settings[below]"]:checked');
380
 
381
  if(!belowcurrentType.length) {
382
- belowcurrentType = $('input[name="addthis_settings[above]"]:visible').first();
383
  }
384
 
385
  if(belowcurrentType.length) {
386
 
387
- if(belowcurrentType.attr('id') == 'large_toolbox_below') {
388
- style = "horizontal";
389
- belowcurrentType = "addthisButtons";
390
- }
391
- else if(belowcurrentType.attr('id') == 'fb_tw_p1_sc_below') {
392
- style = "horizontal";
393
- belowcurrentType = "thirdPartyButtons";
394
- }
395
- else if(belowcurrentType.attr('id') == 'small_toolbox_below') {
396
- style = "horizontal";
397
- belowcurrentType = "addthisButtons";
398
- }
399
- else if(belowcurrentType.attr('id') == 'button_below') {
400
- style = "";
401
- belowcurrentType = "image";
402
- }
403
-
404
- addthisMappedDefaults = _.map(defaults, function(value) {
405
  var service = _.where(self.thirdPartyButtons.services(), { 'service': value });
406
  if(service.length) {
407
  return service[0].linkedService;
@@ -427,7 +427,7 @@
427
  thirdPartyServices = self.sort({ defaults: thirdPartyMappedDefaults, services: self.totalServices });
428
 
429
  if(belowcurrentType === 'addthisButtons') {
430
- self.populateList({ elem: belowsharingSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'sharing-buttons', buttonType: 'addthisButtons' });
431
 
432
  self.populateList({ elem: belowselectedSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'selected-services', buttonType: 'addthisButtons' });
433
  }
@@ -441,7 +441,7 @@
441
 
442
  }
443
  else {
444
- $('body').trigger('populatedList');
445
  def.resolve();
446
  }
447
 
@@ -461,12 +461,12 @@
461
  whereInArray,
462
  currentService,
463
  defaults = obj.defaults,
464
- services = $.merge([], obj.services);
465
 
466
  // Sorts the addthis button list in the correct order
467
- $.each(services, function(iterator, value) {
468
  currentService = value.service;
469
- whereInArray = $.inArray(currentService, defaults);
470
  if(whereInArray !== -1) {
471
  copiedItem = services[whereInArray];
472
  services[whereInArray] = value;
@@ -503,7 +503,7 @@
503
  }
504
  else {
505
  arr = _.filter(self.thirdPartyButtons.exclude[style], function(value) {
506
- return $.inArray(value, defaults) === -1;
507
  }), disabledArr = [], serviceObj = {};
508
  _.each(arr, function(value) {
509
  serviceObj = _.where(self.thirdPartyButtons.services(), { service: value });
@@ -514,7 +514,7 @@
514
  }
515
  return disabledArr;
516
  }()),
517
- disabledServices = (buttonType === 'addthisButtons' || type === 'selected-services') ? []: $.merge($.merge([], self.disabledServices), thirdPartyDisabled),
518
  selectedDefaults = [],
519
  isDuplicate = false,
520
  isDefault = false,
@@ -529,9 +529,9 @@
529
  service = (value.service) || key;
530
  name = value.name;
531
  iconService = value.icon;
532
- isDuplicate = $.inArray(service, duplicates) !== -1,
533
- isDefault = $.inArray(service, defaults) !== -1,
534
- isExcluded = $.inArray(service, excludeList) !== -1;
535
  containsService = _.where(buttonServices , { 'service': service }).length;
536
 
537
  if(!isDuplicate) {
@@ -575,7 +575,7 @@
575
  }
576
 
577
  if(disabledServices.length) {
578
- $.each(disabledServices, function(iterator, disabledService) {
579
  var service = disabledService.service,
580
  iconService = disabledService.icon,
581
  name = disabledService['name'];
@@ -647,7 +647,7 @@
647
 
648
  'abovesaveOrder': function(obj) {
649
 
650
- var self = this,
651
  defaults = [],
652
  dynamicObj = {},
653
  size = obj['size'],
@@ -664,12 +664,12 @@
664
  removed = true;
665
 
666
  serviceItems.each(function(iterator) {
667
- currentService = $(this).attr('data-service');
668
  defaults.push(currentService);
669
  if(currentService === updatedItem) {
670
  removed = false;
671
  }
672
- if($(this).hasClass('enabled')) {
673
  enabledDefaults.push(currentService);
674
  }
675
  });
@@ -688,7 +688,7 @@
688
  commonMethods.localStorageSettings({ namespace: aboveshareNamespace, method: 'set', data: dynamicObj });
689
  setTimeout(function() {
690
 
691
- self.aboveupdatePreview({ size: size, services: enabledDefaults, type: type, style: style, location: location });
692
 
693
  }, 1000);
694
 
@@ -700,7 +700,7 @@
700
 
701
  'belowsaveOrder': function(obj) {
702
 
703
- var self = this,
704
  defaults = [],
705
  dynamicObj = {},
706
  size = obj['size'],
@@ -717,12 +717,12 @@
717
  removed = true;
718
 
719
  serviceItems.each(function(iterator) {
720
- currentService = $(this).attr('data-service');
721
  defaults.push(currentService);
722
  if(currentService === updatedItem) {
723
  removed = false;
724
  }
725
- if($(this).hasClass('enabled')) {
726
  enabledDefaults.push(currentService);
727
  }
728
  });
@@ -741,7 +741,7 @@
741
  commonMethods.localStorageSettings({ namespace: belowshareNamespace, method: 'set', data: dynamicObj });
742
  setTimeout(function() {
743
 
744
- self.belowupdatePreview({ size: size, services: enabledDefaults, type: type, style: style, location: location });
745
 
746
  }, 1000);
747
 
@@ -753,117 +753,117 @@
753
 
754
  'aboveupdatePreview': function(obj) {
755
 
756
- var self = this,
757
  size = obj['size'],
758
  style = obj['style'],
759
  services = obj.services,
760
  type = obj['type'],
761
  buttons = '';
762
- if (size == "large") {
763
- buttons += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
764
- $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
765
- $(this).find('li').each(function(){
766
- if($(this).hasClass('enabled')) {
767
- 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>';
768
- if($(this).attr('data-service') == 'compact') {
769
- buttons += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block;float: left;" href="#" tabindex="0"></a>';
770
- }
771
- }
772
- });
773
- });
774
- buttons += '</div>';
775
- }
776
- else if (size == "small") {
777
- $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
778
- $(this).find('li').each(function(){
779
- if($(this).hasClass('enabled')) {
780
- 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>';
781
- if($(this).attr('data-service') == 'compact') {
782
- buttons += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block;float: left;" href="#" tabindex="0"></a>';
783
- }
784
- }
785
- });
786
- });
787
- }
788
- else {
789
- $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
790
- $(this).find('li').each(function(){
791
- if($(this).hasClass('enabled')) {
792
- if($(this).attr('data-service') == 'compact') {
793
- buttons += '<img src="'+addthis_params.img_base+'addthis_pill_style.png">';
794
- }
795
- else {
796
- buttons += '<img src="'+addthis_params.img_base+$(this).attr('data-service')+'.png">';
797
- }
798
- }
799
- });
800
- });
801
- }
802
 
803
  },
804
 
805
 
806
  'belowupdatePreview': function(obj) {
807
 
808
- var self = this,
809
  size = obj['size'],
810
  style = obj['style'],
811
  services = obj.services,
812
  type = obj['type'],
813
  buttons = '';
814
- if (size == "large") {
815
- buttons += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
816
- $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
817
- $(this).find('li').each(function(){
818
- if($(this).hasClass('enabled')) {
819
- 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>';
820
- if($(this).attr('data-service') == 'compact') {
821
- buttons += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
822
- }
823
- }
824
- });
825
- });
826
- buttons += '</div>';
827
- }
828
- else if (size == "small") {
829
- $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
830
- $(this).find('li').each(function(){
831
- if($(this).hasClass('enabled')) {
832
- 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>';
833
- if($(this).attr('data-service') == 'compact') {
834
- buttons += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
835
- }
836
- }
837
- });
838
- });
839
- }
840
- else {
841
- $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
842
- $(this).find('li').each(function(){
843
- if($(this).hasClass('enabled')) {
844
- if($(this).attr('data-service') == 'compact') {
845
- buttons += '<img src="'+addthis_params.img_base+'addthis_pill_style.png">';
846
- }
847
- else {
848
- buttons += '<img src="'+addthis_params.img_base+$(this).attr('data-service')+'.png">';
849
- }
850
- }
851
- });
852
- });
853
- }
854
  },
855
 
856
  'events': function() {
857
 
858
  var self = this,
859
- aboveEnableSmartSharing = $('#above-enable-smart-sharing'),
860
- aboveDisableSmartSharing = $('#above-disable-smart-sharing'),
861
- belowEnableSmartSharing = $('#below-enable-smart-sharing'),
862
- belowDisableSmartSharing = $('#below-disable-smart-sharing'),
863
 
864
  sortableContainer,
865
- aboveradioInputs = $('input[name="addthis_settings[above]"]'),
866
- belowradioInputs = $('input[name="addthis_settings[below]"]'),
867
  abovecurrentRadioInput,
868
  belowcurrentRadioInput,
869
  abovecurrentType,
@@ -871,35 +871,35 @@
871
  abovecurrentStyle,
872
  belowcurrentStyle,
873
  excludeList,
874
- whereInputs = $('input[name=where]'),
875
- aboveSmartSharingContainer = $('.above-smart-sharing-container'),
876
- aboveSmartSharingInnerContainer = $('.above-smart-sharing-container .smart-sharing-inner-container'),
877
- aboveCustomizeButtons = $('.above-smart-sharing-container .customize-buttons'),
878
- aboveButtons = $('.above-smart-sharing-container .customize-buttons'),
879
- belowSmartSharingContainer = $('.below-smart-sharing-container'),
880
- belowSmartSharingInnerContainer = $('.below-smart-sharing-container .smart-sharing-inner-container'),
881
- belowCustomizeButtons = $('.below-smart-sharing-container .customize-buttons'),
882
- belowButtons = $('.below-smart-sharing-container .customize-buttons'),
883
  defaults,
884
  buttontype,
885
  buttonsize,
886
  buttonstyle,
887
- sortableLists = $('.sortable'),
888
  sortableListItems = sortableLists.find('li'),
889
- sortableSelectedListItems = $('.selected-services').find('li'),
890
  sortableListItemsCloseIcons = sortableSelectedListItems.find('.close'),
891
- aboveRestoreDefaultOptions = $('.above-smart-sharing-container .restore-default-options'),
892
- belowRestoreDefaultOptions = $('.below-smart-sharing-container .restore-default-options'),
893
  aboverestoreToDefault = _.debounce(function() {
894
  // Updates the personalization UI
895
- self.abovepopulateSharingServices(true);
896
- $('.above-smart-sharing-container .selected-services .sortable:visible').trigger('sortupdate');
897
  commonMethods.localStorageSettings({ method: "remove", namespace: aboveshareNamespace });
898
  }, 1000, true),
899
  belowrestoreToDefault = _.debounce(function() {
900
  // Updates the personalization UI
901
- self.belowpopulateSharingServices(true);
902
- $('.below-smart-sharing-container .selected-services .sortable:visible').trigger('sortupdate');
903
  commonMethods.localStorageSettings({ method: "remove", namespace: belowshareNamespace });
904
  }, 1000, true),
905
  aboveEnableCustomization = _.debounce(function() {
@@ -914,35 +914,35 @@
914
 
915
  aboveDisableSmartSharing.add(aboveradioInputs).not('#button_above').bind('click', function() {
916
 
917
- abovecurrentRadioInput = $('input[name="addthis_settings[above]"]:checked');
918
  if(!abovecurrentRadioInput.length) {
919
- abovecurrentRadioInput = $('input[name="addthis_settings[above]"]').first();
920
  }
921
 
922
  if(abovecurrentRadioInput.attr('id') == 'large_toolbox_above') {
923
- abovecurrentStyle = "horizontal";
924
- abovecurrentType = "addthisButtons";
925
- }
926
- else if(abovecurrentRadioInput.attr('id') == 'fb_tw_p1_sc_above') {
927
- abovecurrentStyle = "horizontal";
928
- abovecurrentType = "thirdPartyButtons";
929
- }
930
- else if(abovecurrentRadioInput.attr('id') == 'small_toolbox_above') {
931
- abovecurrentStyle = "horizontal";
932
- abovecurrentType = "addthisButtons";
933
- }
934
- else if(abovecurrentRadioInput.attr('id') == 'button_above') {
935
- abovecurrentStyle = "";
936
- abovecurrentType = "image";
937
- }
938
 
939
  if(aboveDisableSmartSharing.is(':checked')) {
940
 
941
  if(abovecurrentType === 'addthisButtons' || abovecurrentType === 'thirdPartyButtons') {
942
- aboveButtons.show();
943
  }
944
  else {
945
- aboveButtons.hide();
946
  }
947
 
948
 
@@ -953,13 +953,13 @@
953
  // Updates the personalization UI
954
  self.abovepopulateSharingServices();
955
 
956
- $('.above-smart-sharing-container .selected-services .sortable:visible').trigger('sortupdate');
957
 
958
  }, 0);
959
 
960
  aboveRestoreDefaultOptions.show();
961
 
962
- $('.sharing-buttons-search').val('');
963
 
964
  }
965
 
@@ -969,35 +969,35 @@
969
 
970
  belowDisableSmartSharing.add(belowradioInputs).not('#button_below').bind('click', function() {
971
 
972
- belowcurrentRadioInput = $('input[name="addthis_settings[below]"]:checked');
973
  if(!belowcurrentRadioInput.length) {
974
- belowcurrentRadioInput = $('input[name="addthis_settings[below]"]').first();
975
  }
976
 
977
  if(belowcurrentRadioInput.attr('id') == 'large_toolbox_below') {
978
- belowcurrentStyle = "horizontal";
979
- belowcurrentType = "addthisButtons";
980
- }
981
- else if(belowcurrentRadioInput.attr('id') == 'fb_tw_p1_sc_below') {
982
- belowcurrentStyle = "horizontal";
983
- belowcurrentType = "thirdPartyButtons";
984
- }
985
- else if(belowcurrentRadioInput.attr('id') == 'small_toolbox_below') {
986
- belowcurrentStyle = "horizontal";
987
- belowcurrentType = "addthisButtons";
988
- }
989
- else if(belowcurrentRadioInput.attr('id') == 'button_below') {
990
- belowcurrentStyle = "";
991
- belowcurrentType = "image";
992
- }
993
 
994
  if(belowDisableSmartSharing.is(':checked')) {
995
 
996
  if(belowcurrentType === 'addthisButtons' || belowcurrentType === 'thirdPartyButtons') {
997
- belowButtons.show();
998
  }
999
  else {
1000
- belowButtons.hide();
1001
  }
1002
 
1003
 
@@ -1008,13 +1008,13 @@
1008
  // Updates the personalization UI
1009
  self.belowpopulateSharingServices();
1010
 
1011
- $('.below-smart-sharing-container .selected-services .sortable:visible').trigger('sortupdate');
1012
 
1013
  }, 0);
1014
 
1015
  belowRestoreDefaultOptions.show();
1016
 
1017
- $('.sharing-buttons-search').val('');
1018
 
1019
  }
1020
 
@@ -1022,19 +1022,19 @@
1022
 
1023
  });
1024
 
1025
- $('#button_above').click(function() {
1026
- var self = $(this);
1027
  aboveSmartSharingInnerContainer.hide();
1028
  });
1029
 
1030
- $('#button_below').click(function() {
1031
- var self = $(this);
1032
  belowSmartSharingInnerContainer.hide();
1033
  });
1034
 
1035
  aboveEnableSmartSharing.bind('click', function() {
1036
 
1037
- currentRadioInput = $('input[name="addthis_settings[above]"]:checked');
1038
 
1039
  disableCustomization();
1040
 
@@ -1053,7 +1053,7 @@
1053
 
1054
 
1055
 
1056
- currentRadioInput = $('input[name="addthis_settings[below]"]:checked');
1057
 
1058
  disableCustomization();
1059
 
@@ -1088,7 +1088,7 @@
1088
  setTimeout(function() {
1089
 
1090
  // Makes the new list sortable
1091
- $('.above-smart-sharing-container .sortable').sortable({
1092
 
1093
  placeholder: "sortable-placeholder",
1094
 
@@ -1130,7 +1130,7 @@
1130
  setTimeout(function() {
1131
 
1132
  // Makes the new list sortable
1133
- $('.below-smart-sharing-container .sortable').sortable({
1134
 
1135
  placeholder: "sortable-placeholder",
1136
 
@@ -1167,87 +1167,87 @@
1167
 
1168
  });
1169
 
1170
- $('.above_button_set .selected-services .sortable').bind('sortupdate', function(ev, item) {
1171
 
1172
- if($.isPlainObject(item)) {
1173
  item = item.item.attr('data-service');
1174
  }
1175
 
1176
- if(!$(this).find('li').length) {
1177
- $(this).html('<p class="add-buttons-msg">Add buttons by dragging them in this box.</p>');
1178
- $(this).css('border-style', 'dashed');
1179
- $('.add-buttons-msg').show();
1180
  }
1181
 
1182
  else {
1183
- $(this).css('border-style', 'solid');
1184
  }
1185
 
1186
- var abovesortableList = $('.above-smart-sharing-container .selected-services .sortable:visible');
1187
- abovecurrentRadioInput = $('input[name="addthis_settings[above]"]:checked');
1188
  if(abovecurrentRadioInput.attr('id') == 'large_toolbox_above') {
1189
- buttonstyle = "horizontal";
1190
- buttontype = "addthisButtons";
1191
- buttonsize = "large";
1192
- }
1193
- else if(abovecurrentRadioInput.attr('id') == 'fb_tw_p1_sc_above') {
1194
- buttonstyle = "horizontal";
1195
- buttontype = "thirdPartyButtons";
1196
- buttonsize = "";
1197
- }
1198
- else if(abovecurrentRadioInput.attr('id') == 'small_toolbox_above') {
1199
- buttonstyle = "horizontal";
1200
- buttontype = "addthisButtons";
1201
- buttonsize = "small";
1202
- }
1203
- else if(abovecurrentRadioInput.attr('id') == 'button_above') {
1204
- buttonstyle = "";
1205
- buttontype = "image";
1206
- buttonsize = "";
1207
- }
1208
 
1209
  self.abovesaveOrder({ tool: 'above', type: buttontype, elem: abovesortableList, size: buttonsize, style: buttonstyle, item: item || "" });
1210
 
1211
  });
1212
 
1213
- $('.below_button_set .selected-services .sortable').bind('sortupdate', function(ev, item) {
1214
 
1215
- if($.isPlainObject(item)) {
1216
  item = item.item.attr('data-service');
1217
  }
1218
 
1219
- if(!$(this).find('li').length) {
1220
- $(this).html('<p class="add-buttons-msg">Add buttons by dragging them in this box.</p>');
1221
- $(this).css('border-style', 'dashed');
1222
- $('.add-buttons-msg').show();
1223
  }
1224
 
1225
  else {
1226
- $(this).css('border-style', 'solid');
1227
  }
1228
 
1229
- var belowsortableList = $('.below-smart-sharing-container .selected-services .sortable:visible');
1230
- belowcurrentRadioInput = $('input[name="addthis_settings[below]"]:checked');
1231
  if(belowcurrentRadioInput.attr('id') == 'large_toolbox_below') {
1232
- buttonstyle = "horizontal";
1233
- buttontype = "addthisButtons";
1234
- buttonsize = "large";
1235
- }
1236
- else if(belowcurrentRadioInput.attr('id') == 'fb_tw_p1_sc_below') {
1237
- buttonstyle = "horizontal";
1238
- buttontype = "thirdPartyButtons";
1239
- buttonsize = "";
1240
- }
1241
- else if(belowcurrentRadioInput.attr('id') == 'small_toolbox_below') {
1242
- buttonstyle = "horizontal";
1243
- buttontype = "addthisButtons";
1244
- buttonsize = "small";
1245
- }
1246
- else if(belowcurrentRadioInput.attr('id') == 'button_below') {
1247
- buttonstyle = "";
1248
- buttontype = "image";
1249
- buttonsize = "";
1250
- }
1251
 
1252
  self.belowsaveOrder({ tool: 'below', type: buttontype, elem: belowsortableList, size: buttonsize, style: buttonstyle, item: item || "" });
1253
 
@@ -1259,7 +1259,7 @@
1259
 
1260
  setTimeout(function() {
1261
 
1262
- $('.above-smart-sharing-container .sharing-buttons-search').val('');
1263
 
1264
  aboverestoreToDefault();
1265
 
@@ -1273,7 +1273,7 @@
1273
 
1274
  setTimeout(function() {
1275
 
1276
- $('.below-smart-sharing-container .sharing-buttons-search').val('');
1277
 
1278
  belowrestoreToDefault();
1279
 
@@ -1285,19 +1285,19 @@
1285
 
1286
  'mouseenter': function() {
1287
 
1288
- $(this).find('.close').css('display', 'inline-block');
1289
 
1290
  },
1291
 
1292
  'mouseleave': function() {
1293
 
1294
- $(this).find('.close').hide();
1295
 
1296
  },
1297
 
1298
  'mouseup': function() {
1299
 
1300
- $(this).find('.close').hide();
1301
 
1302
  }
1303
 
@@ -1307,10 +1307,10 @@
1307
 
1308
  'mouseup': function() {
1309
 
1310
- if(!$('.selected-services li:visible').length) {
1311
 
1312
 
1313
- $('.add-buttons-msg').show();
1314
 
1315
  }
1316
 
@@ -1318,11 +1318,11 @@
1318
 
1319
  'mousedown': function() {
1320
 
1321
- $('.add-buttons-msg').hide();
1322
 
1323
- $('.below-smart-sharing-container .horizontal-drag').hide();
1324
 
1325
- $('.above-smart-sharing-container .horizontal-drag').hide();
1326
 
1327
  }
1328
 
@@ -1330,153 +1330,153 @@
1330
 
1331
  sortableListItemsCloseIcons.live('click', function() {
1332
 
1333
- var parent = $(this).parent(),
1334
  isDisabled = parent.hasClass('disabled');
1335
  parent.fadeOut().promise().done(function() {
1336
 
1337
- $('.sharing-buttons .sortable:visible').prepend(parent);
1338
  parent.find('.close').hide().tooltip().tooltip('close');
1339
  parent.fadeIn();
1340
- $('.selected-services .sortable:visible').trigger('sortupdate', parent.attr('data-service'));
1341
 
1342
  });
1343
 
1344
  });
1345
 
1346
- $('.above-smart-sharing-container .sharing-buttons-search').bind('keyup', function(e) {
1347
 
1348
- var currentVal = $(this).val();
1349
 
1350
- $('.above-smart-sharing-container .sharing-buttons .sortable').find('li').each(function() {
1351
- if($(this).text().toLowerCase().search(currentVal.toLowerCase()) === -1) {
1352
- $(this).hide().attr('data-hidden', 'true');
1353
  }
1354
  else {
1355
- $(this).show().removeAttr('data-hidden');
1356
  }
1357
  });
1358
 
1359
  });
1360
 
1361
- $('.below-smart-sharing-container .sharing-buttons-search').bind('keyup', function(e) {
1362
 
1363
- var currentVal = $(this).val();
1364
 
1365
- $('.below-smart-sharing-container .sharing-buttons .sortable').find('li').each(function() {
1366
- if($(this).text().toLowerCase().search(currentVal.toLowerCase()) === -1) {
1367
- $(this).hide().attr('data-hidden', 'true');
1368
  }
1369
  else {
1370
- $(this).show().removeAttr('data-hidden');
1371
  }
1372
  });
1373
 
1374
  });
1375
 
1376
- $('.sharing-buttons-search').bind('click', function() {
1377
  trackPageView('/tracker/gtc/' + (window.page || '') + '/event/search_clicked');
1378
  });
1379
 
1380
- $('.above-smart-sharing-container .sortable').bind('mousedown', function() {
1381
- if($('.above-smart-sharing-container .sharing-buttons-search').is(':focus')) {
1382
- $('.above-smart-sharing-container .sharing-buttons-search').blur();
1383
  }
1384
  });
1385
- $('.below-smart-sharing-container .sortable').bind('mousedown', function() {
1386
- if($('.below-smart-sharing-container .sharing-buttons-search').is(':focus')) {
1387
- $('.below-smart-sharing-container .sharing-buttons-search').blur();
1388
  }
1389
  });
1390
 
1391
- $('.above-smart-sharing-container .selected-services .sortable').bind({
1392
 
1393
  'mouseover': function() {
1394
- if($(this).find('li.enabled:visible').length > 1) {
1395
- $('.above-smart-sharing-container .horizontal-drag').hide();
1396
- $('.above-smart-sharing-container .vertical-drag').show();
1397
  }
1398
  },
1399
  'mouseout': function() {
1400
- $('.above-smart-sharing-container .vertical-drag').hide();
1401
  }
1402
 
1403
  });
1404
 
1405
- $('.below-smart-sharing-container .selected-services .sortable').bind({
1406
 
1407
  'mouseover': function() {
1408
- if($(this).find('li.enabled:visible').length > 1) {
1409
- $('.below-smart-sharing-container .horizontal-drag').hide();
1410
- $('.below-smart-sharing-container .vertical-drag').show();
1411
  }
1412
  },
1413
  'mouseout': function() {
1414
- $('.below-smart-sharing-container .vertical-drag').hide();
1415
  }
1416
 
1417
  });
1418
 
1419
- $('.above-smart-sharing-container .sharing-buttons .sortable').bind({
1420
 
1421
  'mouseover': function() {
1422
- if($(this).find('li.enabled:visible').length) {
1423
- $('.above-smart-sharing-container .vertical-drag').hide();
1424
- $('.above-smart-sharing-container .horizontal-drag').show();
1425
  }
1426
  },
1427
  'mouseout': function() {
1428
- $('.above-smart-sharing-container .horizontal-drag').hide();
1429
  }
1430
 
1431
  });
1432
 
1433
- $('.below-smart-sharing-container .sharing-buttons .sortable').bind({
1434
 
1435
  'mouseover': function() {
1436
- if($(this).find('li.enabled:visible').length) {
1437
- $('.below-smart-sharing-container .vertical-drag').hide();
1438
- $('.below-smart-sharing-container .horizontal-drag').show();
1439
  }
1440
  },
1441
  'mouseout': function() {
1442
- $('.below-smart-sharing-container .horizontal-drag').hide();
1443
  }
1444
 
1445
  });
1446
 
1447
- $('body').bind({
1448
 
1449
  'populatedList': function() {
1450
  setTimeout(function() {
1451
- $('.sortable .disabled, .sortable .close').tooltip({
1452
  position: {
1453
- my: 'left+15 top',
1454
  at: 'right top',
1455
  collision: 'none',
1456
  tooltipClass: 'custom-tooltip-styling'
1457
  }
1458
  });
1459
- $('.above-smart-sharing-container .sortable .disabled').bind('mouseover', function() {
1460
- $('.above-smart-sharing-container .horizontal-drag, .above-smart-sharing-container .vertical-drag').hide();
1461
  });
1462
- $('.above-smart-sharing-container .sharing-buttons .enabled').bind('mouseenter', function() {
1463
- if($(this).parent().parent().hasClass('sharing-buttons')) {
1464
- $('.above-smart-sharing-container .horizontal-drag').show();
1465
  }
1466
  });
1467
- $('.above-smart-sharing-container .selected-services .enabled').bind('mouseenter', function() {
1468
- $('.above-smart-sharing-container .vertical-drag').show();
1469
  });
1470
- $('.below-smart-sharing-container .sortable .disabled').bind('mouseover', function() {
1471
- $('.below-smart-sharing-container .horizontal-drag, .below-smart-sharing-container .vertical-drag').hide();
1472
  });
1473
- $('.below-smart-sharing-container .sharing-buttons .enabled').bind('mouseenter', function() {
1474
- if($(this).parent().parent().hasClass('sharing-buttons')) {
1475
- $('.below-smart-sharing-container .horizontal-drag').show();
1476
  }
1477
  });
1478
- $('.below-smart-sharing-container .selected-services .enabled').bind('mouseenter', function() {
1479
- $('.below-smart-sharing-container .vertical-drag').show();
1480
  });
1481
  },0);
1482
  }
@@ -1502,7 +1502,7 @@
1502
  service,
1503
  thirdPartyButtons = customServicesAPI.thirdPartyButtons.services();
1504
 
1505
- $(function() {
1506
 
1507
  customServicesAPI.addthisButtons.services = serviceList;
1508
  if((response||{}).data) {
@@ -1533,7 +1533,7 @@
1533
 
1534
  } catch(e) {}
1535
 
1536
- customServicesAPI.totalServices = $.merge($.merge([],serviceList), customServicesAPI.thirdPartyButtons.services());
1537
 
1538
  customServicesAPI.disabledServices = _.filter(serviceList, function(service) {
1539
  return !_.where(customServicesAPI.thirdPartyButtons.services(), { 'linkedService': service.service }).length;
@@ -1545,28 +1545,28 @@
1545
 
1546
  };
1547
 
1548
- jQuery(document).ready(function($) {
1549
- if($('#above-disable-smart-sharing').attr('checked')){
1550
  setTimeout(function() {
1551
  window.customServicesAPI.abovepopulateSharingServices();
1552
  }, 0);
1553
- $('.above-smart-sharing-container .restore-default-options').show();
1554
- $('.above-smart-sharing-container .customize-buttons').show();
1555
  setTimeout(function() {
1556
  // Makes the new list sortable
1557
- $('.above-smart-sharing-container .sortable').sortable().disableSelection().sortable('option', 'connectWith', '.sortable');
1558
  }, 0);
1559
  }
1560
 
1561
- if($('#below-disable-smart-sharing').attr('checked')){
1562
  setTimeout(function() {
1563
  window.customServicesAPI.belowpopulateSharingServices();
1564
  }, 0);
1565
- $('.below-smart-sharing-container .restore-default-options').show();
1566
- $('.below-smart-sharing-container .customize-buttons').show();
1567
  setTimeout(function() {
1568
  // Makes the new list sortable
1569
- $('.below-smart-sharing-container .sortable').sortable().disableSelection().sortable('option', 'connectWith', '.sortable');
1570
  }, 0);
1571
  }
1572
  });
18
  * +--------------------------------------------------------------------------+
19
  */
20
 
21
+ (function(jQuery, window, document, undefined) {
22
 
23
+ var aboveshareNamespace = window.addthisnamespaces && window.addthisnamespaces['aboveshare'] ? addthisnamespaces['aboveshare']: 'addthis-share-above';
24
+ var belowshareNamespace = window.addthisnamespaces && window.addthisnamespaces['belowshare'] ? addthisnamespaces['belowshare']: 'addthis-share-below';
25
 
26
  /* Event Tracking */
27
  function trackPageView(p) {
29
  }
30
 
31
  // jQuery ready event
32
+ jQuery(function() {
33
 
34
+ jQuery('.above-smart-sharing-container .restore-default-options').hide();
35
+ jQuery('.below-smart-sharing-container .restore-default-options').hide();
36
+ jQuery('#below').tooltip({ position: { my: "left+15 center", at: "right center" } });
37
+ jQuery('.sortable .disabled').tooltip({ position: { my: "left+15 center", at: "right center" } });
38
+ jQuery('.sortable .close').tooltip({ position: { my: "left+10 center", at: "right center" } });
39
  setTimeout(function() {
40
 
41
  window.customServicesAPI.events().fetchServices();
47
  // API for the custom service UI
48
  window.customServicesAPI = {
49
 
50
+ 'loadDeferred': jQuery.Deferred(),
51
 
52
  'scriptIncluded': false,
53
 
211
  'fetchServices': function() {
212
 
213
  var self = this,
214
+ def = jQuery.Deferred();
215
 
216
  if(self.scriptIncluded) {
217
  def.resolve(self.addthisButtons.services);
237
  'abovepopulateSharingServices': function(restoreDefaults, pageload) {
238
 
239
  var self = this,
240
+ def = jQuery.Deferred(),
241
  defaults,
242
  services,
243
  currentType,
245
  thirdPartyMappedDefaults,
246
  addthisServices,
247
  thirdPartyServices,
248
+ abovesharingSortable = jQuery('.above-smart-sharing-container .sharing-buttons .sortable'),
249
+ aboveselectedSortable = jQuery('.above-smart-sharing-container .selected-services .sortable');
250
 
251
  self.fetchServices().done(function(services) {
252
 
262
 
263
  defaults = restoreDefaults ? self.defaults: obj.rememberedDefaults;
264
 
265
+ abovecurrentType = jQuery('input[name="addthis_settings[above]"]:checked');
266
 
267
  if(!abovecurrentType.length) {
268
+ abovecurrentType = jQuery('input[name="addthis_settings[above]"]:visible').first();
269
  }
270
 
271
  if(abovecurrentType.length) {
272
 
273
+ if(abovecurrentType.attr('id') == 'large_toolbox_above') {
274
+ style = "horizontal";
275
+ abovecurrentType = "addthisButtons";
276
+ }
277
+ else if(abovecurrentType.attr('id') == 'fb_tw_p1_sc_above') {
278
+ style = "horizontal";
279
+ abovecurrentType = "thirdPartyButtons";
280
+ }
281
+ else if(abovecurrentType.attr('id') == 'small_toolbox_above') {
282
+ style = "horizontal";
283
+ abovecurrentType = "addthisButtons";
284
+ }
285
+ else if(abovecurrentType.attr('id') == 'button_above') {
286
+ style = "";
287
+ abovecurrentType = "image";
288
+ }
289
 
290
 
291
 
328
 
329
  }
330
 
331
+ jQuery('body').trigger('populatedList');
332
  def.resolve();
333
 
334
  }
335
 
336
  else {
337
+ jQuery('body').trigger('populatedList');
338
  def.resolve();
339
  }
340
  });
350
  'belowpopulateSharingServices': function(restoreDefaults, pageload) {
351
 
352
  var self = this,
353
+ def = jQuery.Deferred(),
354
  defaults,
355
  services,
356
  currentType,
358
  thirdPartyMappedDefaults,
359
  addthisServices,
360
  thirdPartyServices,
361
+ belowsharingSortable = jQuery('.below-smart-sharing-container .sharing-buttons .sortable'),
362
+ belowselectedSortable = jQuery('.below-smart-sharing-container .selected-services .sortable');
363
 
364
  self.fetchServices().done(function(services) {
365
 
376
  defaults = restoreDefaults ? self.defaults: obj.rememberedDefaults;
377
 
378
 
379
+ belowcurrentType = jQuery('input[name="addthis_settings[below]"]:checked');
380
 
381
  if(!belowcurrentType.length) {
382
+ belowcurrentType = jQuery('input[name="addthis_settings[above]"]:visible').first();
383
  }
384
 
385
  if(belowcurrentType.length) {
386
 
387
+ if(belowcurrentType.attr('id') == 'large_toolbox_below') {
388
+ style = "horizontal";
389
+ belowcurrentType = "addthisButtons";
390
+ }
391
+ else if(belowcurrentType.attr('id') == 'fb_tw_p1_sc_below') {
392
+ style = "horizontal";
393
+ belowcurrentType = "thirdPartyButtons";
394
+ }
395
+ else if(belowcurrentType.attr('id') == 'small_toolbox_below') {
396
+ style = "horizontal";
397
+ belowcurrentType = "addthisButtons";
398
+ }
399
+ else if(belowcurrentType.attr('id') == 'button_below') {
400
+ style = "";
401
+ belowcurrentType = "image";
402
+ }
403
+
404
+ addthisMappedDefaults = _.map(defaults, function(value) {
405
  var service = _.where(self.thirdPartyButtons.services(), { 'service': value });
406
  if(service.length) {
407
  return service[0].linkedService;
427
  thirdPartyServices = self.sort({ defaults: thirdPartyMappedDefaults, services: self.totalServices });
428
 
429
  if(belowcurrentType === 'addthisButtons') {
430
+ self.populateList({ elem: belowsharingSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'sharing-buttons', buttonType: 'addthisButtons' });
431
 
432
  self.populateList({ elem: belowselectedSortable, services: addthisServices, exclude: self.addthisButtons.exclude, defaults: addthisMappedDefaults, type: 'selected-services', buttonType: 'addthisButtons' });
433
  }
441
 
442
  }
443
  else {
444
+ jQuery('body').trigger('populatedList');
445
  def.resolve();
446
  }
447
 
461
  whereInArray,
462
  currentService,
463
  defaults = obj.defaults,
464
+ services = jQuery.merge([], obj.services);
465
 
466
  // Sorts the addthis button list in the correct order
467
+ jQuery.each(services, function(iterator, value) {
468
  currentService = value.service;
469
+ whereInArray = jQuery.inArray(currentService, defaults);
470
  if(whereInArray !== -1) {
471
  copiedItem = services[whereInArray];
472
  services[whereInArray] = value;
503
  }
504
  else {
505
  arr = _.filter(self.thirdPartyButtons.exclude[style], function(value) {
506
+ return jQuery.inArray(value, defaults) === -1;
507
  }), disabledArr = [], serviceObj = {};
508
  _.each(arr, function(value) {
509
  serviceObj = _.where(self.thirdPartyButtons.services(), { service: value });
514
  }
515
  return disabledArr;
516
  }()),
517
+ disabledServices = (buttonType === 'addthisButtons' || type === 'selected-services') ? []: jQuery.merge(jQuery.merge([], self.disabledServices), thirdPartyDisabled),
518
  selectedDefaults = [],
519
  isDuplicate = false,
520
  isDefault = false,
529
  service = (value.service) || key;
530
  name = value.name;
531
  iconService = value.icon;
532
+ isDuplicate = jQuery.inArray(service, duplicates) !== -1,
533
+ isDefault = jQuery.inArray(service, defaults) !== -1,
534
+ isExcluded = jQuery.inArray(service, excludeList) !== -1;
535
  containsService = _.where(buttonServices , { 'service': service }).length;
536
 
537
  if(!isDuplicate) {
575
  }
576
 
577
  if(disabledServices.length) {
578
+ jQuery.each(disabledServices, function(iterator, disabledService) {
579
  var service = disabledService.service,
580
  iconService = disabledService.icon,
581
  name = disabledService['name'];
647
 
648
  'abovesaveOrder': function(obj) {
649
 
650
+ var self = this,
651
  defaults = [],
652
  dynamicObj = {},
653
  size = obj['size'],
664
  removed = true;
665
 
666
  serviceItems.each(function(iterator) {
667
+ currentService = jQuery(this).attr('data-service');
668
  defaults.push(currentService);
669
  if(currentService === updatedItem) {
670
  removed = false;
671
  }
672
+ if(jQuery(this).hasClass('enabled')) {
673
  enabledDefaults.push(currentService);
674
  }
675
  });
688
  commonMethods.localStorageSettings({ namespace: aboveshareNamespace, method: 'set', data: dynamicObj });
689
  setTimeout(function() {
690
 
691
+ self.aboveupdatePreview({ size: size, services: enabledDefaults, type: type, style: style, location: location });
692
 
693
  }, 1000);
694
 
700
 
701
  'belowsaveOrder': function(obj) {
702
 
703
+ var self = this,
704
  defaults = [],
705
  dynamicObj = {},
706
  size = obj['size'],
717
  removed = true;
718
 
719
  serviceItems.each(function(iterator) {
720
+ currentService = jQuery(this).attr('data-service');
721
  defaults.push(currentService);
722
  if(currentService === updatedItem) {
723
  removed = false;
724
  }
725
+ if(jQuery(this).hasClass('enabled')) {
726
  enabledDefaults.push(currentService);
727
  }
728
  });
741
  commonMethods.localStorageSettings({ namespace: belowshareNamespace, method: 'set', data: dynamicObj });
742
  setTimeout(function() {
743
 
744
+ self.belowupdatePreview({ size: size, services: enabledDefaults, type: type, style: style, location: location });
745
 
746
  }, 1000);
747
 
753
 
754
  'aboveupdatePreview': function(obj) {
755
 
756
+ var self = this,
757
  size = obj['size'],
758
  style = obj['style'],
759
  services = obj.services,
760
  type = obj['type'],
761
  buttons = '';
762
+ if (size == "large") {
763
+ buttons += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
764
+ jQuery('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
765
+ jQuery(this).find('li').each(function(){
766
+ if(jQuery(this).hasClass('enabled')) {
767
+ buttons += '<span class="at300bs at15nc at15t_'+jQuery(this).attr('data-service')+' at16t_'+jQuery(this).attr('data-service')+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
768
+ if(jQuery(this).attr('data-service') == 'compact') {
769
+ buttons += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block;float: left;" href="#" tabindex="0"></a>';
770
+ }
771
+ }
772
+ });
773
+ });
774
+ buttons += '</div>';
775
+ }
776
+ else if (size == "small") {
777
+ jQuery('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
778
+ jQuery(this).find('li').each(function(){
779
+ if(jQuery(this).hasClass('enabled')) {
780
+ buttons += '<span class="at300bs at15nc at15t_'+jQuery(this).attr('data-service')+' at16t_'+jQuery(this).attr('data-service')+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
781
+ if(jQuery(this).attr('data-service') == 'compact') {
782
+ buttons += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block;float: left;" href="#" tabindex="0"></a>';
783
+ }
784
+ }
785
+ });
786
+ });
787
+ }
788
+ else {
789
+ jQuery('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
790
+ jQuery(this).find('li').each(function(){
791
+ if(jQuery(this).hasClass('enabled')) {
792
+ if(jQuery(this).attr('data-service') == 'compact') {
793
+ buttons += '<img src="'+addthis_params.img_base+'addthis_pill_style.png">';
794
+ }
795
+ else {
796
+ buttons += '<img src="'+addthis_params.img_base+jQuery(this).attr('data-service')+'.png">';
797
+ }
798
+ }
799
+ });
800
+ });
801
+ }
802
 
803
  },
804
 
805
 
806
  'belowupdatePreview': function(obj) {
807
 
808
+ var self = this,
809
  size = obj['size'],
810
  style = obj['style'],
811
  services = obj.services,
812
  type = obj['type'],
813
  buttons = '';
814
+ if (size == "large") {
815
+ buttons += '<div class="addthis_toolbox addthis_default_style addthis_32x32_style">';
816
+ jQuery('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
817
+ jQuery(this).find('li').each(function(){
818
+ if(jQuery(this).hasClass('enabled')) {
819
+ buttons += '<span class="at300bs at15nc at15t_'+jQuery(this).attr('data-service')+' at16t_'+jQuery(this).attr('data-service')+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
820
+ if(jQuery(this).attr('data-service') == 'compact') {
821
+ buttons += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
822
+ }
823
+ }
824
+ });
825
+ });
826
+ buttons += '</div>';
827
+ }
828
+ else if (size == "small") {
829
+ jQuery('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
830
+ jQuery(this).find('li').each(function(){
831
+ if(jQuery(this).hasClass('enabled')) {
832
+ buttons += '<span class="at300bs at15nc at15t_'+jQuery(this).attr('data-service')+' at16t_'+jQuery(this).attr('data-service')+'" style="display:inline-block;padding-right:4px;vertical-align:middle;"></span>';
833
+ if(jQuery(this).attr('data-service') == 'compact') {
834
+ buttons += '<a class="addthis_counter addthis_bubble_style" style="display: inline-block; float: left;" href="#" tabindex="0"></a>';
835
+ }
836
+ }
837
+ });
838
+ });
839
+ }
840
+ else {
841
+ jQuery('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
842
+ jQuery(this).find('li').each(function(){
843
+ if(jQuery(this).hasClass('enabled')) {
844
+ if(jQuery(this).attr('data-service') == 'compact') {
845
+ buttons += '<img src="'+addthis_params.img_base+'addthis_pill_style.png">';
846
+ }
847
+ else {
848
+ buttons += '<img src="'+addthis_params.img_base+jQuery(this).attr('data-service')+'.png">';
849
+ }
850
+ }
851
+ });
852
+ });
853
+ }
854
  },
855
 
856
  'events': function() {
857
 
858
  var self = this,
859
+ aboveEnableSmartSharing = jQuery('#above-enable-smart-sharing'),
860
+ aboveDisableSmartSharing = jQuery('#above-disable-smart-sharing'),
861
+ belowEnableSmartSharing = jQuery('#below-enable-smart-sharing'),
862
+ belowDisableSmartSharing = jQuery('#below-disable-smart-sharing'),
863
 
864
  sortableContainer,
865
+ aboveradioInputs = jQuery('input[name="addthis_settings[above]"]'),
866
+ belowradioInputs = jQuery('input[name="addthis_settings[below]"]'),
867
  abovecurrentRadioInput,
868
  belowcurrentRadioInput,
869
  abovecurrentType,
871
  abovecurrentStyle,
872
  belowcurrentStyle,
873
  excludeList,
874
+ whereInputs = jQuery('input[name=where]'),
875
+ aboveSmartSharingContainer = jQuery('.above-smart-sharing-container'),
876
+ aboveSmartSharingInnerContainer = jQuery('.above-smart-sharing-container .smart-sharing-inner-container'),
877
+ aboveCustomizeButtons = jQuery('.above-smart-sharing-container .customize-buttons'),
878
+ aboveButtons = jQuery('.above-smart-sharing-container .customize-buttons'),
879
+ belowSmartSharingContainer = jQuery('.below-smart-sharing-container'),
880
+ belowSmartSharingInnerContainer = jQuery('.below-smart-sharing-container .smart-sharing-inner-container'),
881
+ belowCustomizeButtons = jQuery('.below-smart-sharing-container .customize-buttons'),
882
+ belowButtons = jQuery('.below-smart-sharing-container .customize-buttons'),
883
  defaults,
884
  buttontype,
885
  buttonsize,
886
  buttonstyle,
887
+ sortableLists = jQuery('.sortable'),
888
  sortableListItems = sortableLists.find('li'),
889
+ sortableSelectedListItems = jQuery('.selected-services').find('li'),
890
  sortableListItemsCloseIcons = sortableSelectedListItems.find('.close'),
891
+ aboveRestoreDefaultOptions = jQuery('.above-smart-sharing-container .restore-default-options'),
892
+ belowRestoreDefaultOptions = jQuery('.below-smart-sharing-container .restore-default-options'),
893
  aboverestoreToDefault = _.debounce(function() {
894
  // Updates the personalization UI
895
+ self.abovepopulateSharingServices(true);
896
+ jQuery('.above-smart-sharing-container .selected-services .sortable:visible').trigger('sortupdate');
897
  commonMethods.localStorageSettings({ method: "remove", namespace: aboveshareNamespace });
898
  }, 1000, true),
899
  belowrestoreToDefault = _.debounce(function() {
900
  // Updates the personalization UI
901
+ self.belowpopulateSharingServices(true);
902
+ jQuery('.below-smart-sharing-container .selected-services .sortable:visible').trigger('sortupdate');
903
  commonMethods.localStorageSettings({ method: "remove", namespace: belowshareNamespace });
904
  }, 1000, true),
905
  aboveEnableCustomization = _.debounce(function() {
914
 
915
  aboveDisableSmartSharing.add(aboveradioInputs).not('#button_above').bind('click', function() {
916
 
917
+ abovecurrentRadioInput = jQuery('input[name="addthis_settings[above]"]:checked');
918
  if(!abovecurrentRadioInput.length) {
919
+ abovecurrentRadioInput = jQuery('input[name="addthis_settings[above]"]').first();
920
  }
921
 
922
  if(abovecurrentRadioInput.attr('id') == 'large_toolbox_above') {
923
+ abovecurrentStyle = "horizontal";
924
+ abovecurrentType = "addthisButtons";
925
+ }
926
+ else if(abovecurrentRadioInput.attr('id') == 'fb_tw_p1_sc_above') {
927
+ abovecurrentStyle = "horizontal";
928
+ abovecurrentType = "thirdPartyButtons";
929
+ }
930
+ else if(abovecurrentRadioInput.attr('id') == 'small_toolbox_above') {
931
+ abovecurrentStyle = "horizontal";
932
+ abovecurrentType = "addthisButtons";
933
+ }
934
+ else if(abovecurrentRadioInput.attr('id') == 'button_above') {
935
+ abovecurrentStyle = "";
936
+ abovecurrentType = "image";
937
+ }
938
 
939
  if(aboveDisableSmartSharing.is(':checked')) {
940
 
941
  if(abovecurrentType === 'addthisButtons' || abovecurrentType === 'thirdPartyButtons') {
942
+ aboveButtons.show();
943
  }
944
  else {
945
+ aboveButtons.hide();
946
  }
947
 
948
 
953
  // Updates the personalization UI
954
  self.abovepopulateSharingServices();
955
 
956
+ jQuery('.above-smart-sharing-container .selected-services .sortable:visible').trigger('sortupdate');
957
 
958
  }, 0);
959
 
960
  aboveRestoreDefaultOptions.show();
961
 
962
+ jQuery('.sharing-buttons-search').val('');
963
 
964
  }
965
 
969
 
970
  belowDisableSmartSharing.add(belowradioInputs).not('#button_below').bind('click', function() {
971
 
972
+ belowcurrentRadioInput = jQuery('input[name="addthis_settings[below]"]:checked');
973
  if(!belowcurrentRadioInput.length) {
974
+ belowcurrentRadioInput = jQuery('input[name="addthis_settings[below]"]').first();
975
  }
976
 
977
  if(belowcurrentRadioInput.attr('id') == 'large_toolbox_below') {
978
+ belowcurrentStyle = "horizontal";
979
+ belowcurrentType = "addthisButtons";
980
+ }
981
+ else if(belowcurrentRadioInput.attr('id') == 'fb_tw_p1_sc_below') {
982
+ belowcurrentStyle = "horizontal";
983
+ belowcurrentType = "thirdPartyButtons";
984
+ }
985
+ else if(belowcurrentRadioInput.attr('id') == 'small_toolbox_below') {
986
+ belowcurrentStyle = "horizontal";
987
+ belowcurrentType = "addthisButtons";
988
+ }
989
+ else if(belowcurrentRadioInput.attr('id') == 'button_below') {
990
+ belowcurrentStyle = "";
991
+ belowcurrentType = "image";
992
+ }
993
 
994
  if(belowDisableSmartSharing.is(':checked')) {
995
 
996
  if(belowcurrentType === 'addthisButtons' || belowcurrentType === 'thirdPartyButtons') {
997
+ belowButtons.show();
998
  }
999
  else {
1000
+ belowButtons.hide();
1001
  }
1002
 
1003
 
1008
  // Updates the personalization UI
1009
  self.belowpopulateSharingServices();
1010
 
1011
+ jQuery('.below-smart-sharing-container .selected-services .sortable:visible').trigger('sortupdate');
1012
 
1013
  }, 0);
1014
 
1015
  belowRestoreDefaultOptions.show();
1016
 
1017
+ jQuery('.sharing-buttons-search').val('');
1018
 
1019
  }
1020
 
1022
 
1023
  });
1024
 
1025
+ jQuery('#button_above').click(function() {
1026
+ var self = jQuery(this);
1027
  aboveSmartSharingInnerContainer.hide();
1028
  });
1029
 
1030
+ jQuery('#button_below').click(function() {
1031
+ var self = jQuery(this);
1032
  belowSmartSharingInnerContainer.hide();
1033
  });
1034
 
1035
  aboveEnableSmartSharing.bind('click', function() {
1036
 
1037
+ currentRadioInput = jQuery('input[name="addthis_settings[above]"]:checked');
1038
 
1039
  disableCustomization();
1040
 
1053
 
1054
 
1055
 
1056
+ currentRadioInput = jQuery('input[name="addthis_settings[below]"]:checked');
1057
 
1058
  disableCustomization();
1059
 
1088
  setTimeout(function() {
1089
 
1090
  // Makes the new list sortable
1091
+ jQuery('.above-smart-sharing-container .sortable').sortable({
1092
 
1093
  placeholder: "sortable-placeholder",
1094
 
1130
  setTimeout(function() {
1131
 
1132
  // Makes the new list sortable
1133
+ jQuery('.below-smart-sharing-container .sortable').sortable({
1134
 
1135
  placeholder: "sortable-placeholder",
1136
 
1167
 
1168
  });
1169
 
1170
+ jQuery('.above_button_set .selected-services .sortable').bind('sortupdate', function(ev, item) {
1171
 
1172
+ if(jQuery.isPlainObject(item)) {
1173
  item = item.item.attr('data-service');
1174
  }
1175
 
1176
+ if(!jQuery(this).find('li').length) {
1177
+ jQuery(this).html('<p class="add-buttons-msg">Add buttons by dragging them in this box.</p>');
1178
+ jQuery(this).css('border-style', 'dashed');
1179
+ jQuery('.add-buttons-msg').show();
1180
  }
1181
 
1182
  else {
1183
+ jQuery(this).css('border-style', 'solid');
1184
  }
1185
 
1186
+ var abovesortableList = jQuery('.above-smart-sharing-container .selected-services .sortable:visible');
1187
+ abovecurrentRadioInput = jQuery('input[name="addthis_settings[above]"]:checked');
1188
  if(abovecurrentRadioInput.attr('id') == 'large_toolbox_above') {
1189
+ buttonstyle = "horizontal";
1190
+ buttontype = "addthisButtons";
1191
+ buttonsize = "large";
1192
+ }
1193
+ else if(abovecurrentRadioInput.attr('id') == 'fb_tw_p1_sc_above') {
1194
+ buttonstyle = "horizontal";
1195
+ buttontype = "thirdPartyButtons";
1196
+ buttonsize = "";
1197
+ }
1198
+ else if(abovecurrentRadioInput.attr('id') == 'small_toolbox_above') {
1199
+ buttonstyle = "horizontal";
1200
+ buttontype = "addthisButtons";
1201
+ buttonsize = "small";
1202
+ }
1203
+ else if(abovecurrentRadioInput.attr('id') == 'button_above') {
1204
+ buttonstyle = "";
1205
+ buttontype = "image";
1206
+ buttonsize = "";
1207
+ }
1208
 
1209
  self.abovesaveOrder({ tool: 'above', type: buttontype, elem: abovesortableList, size: buttonsize, style: buttonstyle, item: item || "" });
1210
 
1211
  });
1212
 
1213
+ jQuery('.below_button_set .selected-services .sortable').bind('sortupdate', function(ev, item) {
1214
 
1215
+ if(jQuery.isPlainObject(item)) {
1216
  item = item.item.attr('data-service');
1217
  }
1218
 
1219
+ if(!jQuery(this).find('li').length) {
1220
+ jQuery(this).html('<p class="add-buttons-msg">Add buttons by dragging them in this box.</p>');
1221
+ jQuery(this).css('border-style', 'dashed');
1222
+ jQuery('.add-buttons-msg').show();
1223
  }
1224
 
1225
  else {
1226
+ jQuery(this).css('border-style', 'solid');
1227
  }
1228
 
1229
+ var belowsortableList = jQuery('.below-smart-sharing-container .selected-services .sortable:visible');
1230
+ belowcurrentRadioInput = jQuery('input[name="addthis_settings[below]"]:checked');
1231
  if(belowcurrentRadioInput.attr('id') == 'large_toolbox_below') {
1232
+ buttonstyle = "horizontal";
1233
+ buttontype = "addthisButtons";
1234
+ buttonsize = "large";
1235
+ }
1236
+ else if(belowcurrentRadioInput.attr('id') == 'fb_tw_p1_sc_below') {
1237
+ buttonstyle = "horizontal";
1238
+ buttontype = "thirdPartyButtons";
1239
+ buttonsize = "";
1240
+ }
1241
+ else if(belowcurrentRadioInput.attr('id') == 'small_toolbox_below') {
1242
+ buttonstyle = "horizontal";
1243
+ buttontype = "addthisButtons";
1244
+ buttonsize = "small";
1245
+ }
1246
+ else if(belowcurrentRadioInput.attr('id') == 'button_below') {
1247
+ buttonstyle = "";
1248
+ buttontype = "image";
1249
+ buttonsize = "";
1250
+ }
1251
 
1252
  self.belowsaveOrder({ tool: 'below', type: buttontype, elem: belowsortableList, size: buttonsize, style: buttonstyle, item: item || "" });
1253
 
1259
 
1260
  setTimeout(function() {
1261
 
1262
+ jQuery('.above-smart-sharing-container .sharing-buttons-search').val('');
1263
 
1264
  aboverestoreToDefault();
1265
 
1273
 
1274
  setTimeout(function() {
1275
 
1276
+ jQuery('.below-smart-sharing-container .sharing-buttons-search').val('');
1277
 
1278
  belowrestoreToDefault();
1279
 
1285
 
1286
  'mouseenter': function() {
1287
 
1288
+ jQuery(this).find('.close').css('display', 'inline-block');
1289
 
1290
  },
1291
 
1292
  'mouseleave': function() {
1293
 
1294
+ jQuery(this).find('.close').hide();
1295
 
1296
  },
1297
 
1298
  'mouseup': function() {
1299
 
1300
+ jQuery(this).find('.close').hide();
1301
 
1302
  }
1303
 
1307
 
1308
  'mouseup': function() {
1309
 
1310
+ if(!jQuery('.selected-services li:visible').length) {
1311
 
1312
 
1313
+ jQuery('.add-buttons-msg').show();
1314
 
1315
  }
1316
 
1318
 
1319
  'mousedown': function() {
1320
 
1321
+ jQuery('.add-buttons-msg').hide();
1322
 
1323
+ jQuery('.below-smart-sharing-container .horizontal-drag').hide();
1324
 
1325
+ jQuery('.above-smart-sharing-container .horizontal-drag').hide();
1326
 
1327
  }
1328
 
1330
 
1331
  sortableListItemsCloseIcons.live('click', function() {
1332
 
1333
+ var parent = jQuery(this).parent(),
1334
  isDisabled = parent.hasClass('disabled');
1335
  parent.fadeOut().promise().done(function() {
1336
 
1337
+ jQuery('.sharing-buttons .sortable:visible').prepend(parent);
1338
  parent.find('.close').hide().tooltip().tooltip('close');
1339
  parent.fadeIn();
1340
+ jQuery('.selected-services .sortable:visible').trigger('sortupdate', parent.attr('data-service'));
1341
 
1342
  });
1343
 
1344
  });
1345
 
1346
+ jQuery('.above-smart-sharing-container .sharing-buttons-search').bind('keyup', function(e) {
1347
 
1348
+ var currentVal = jQuery(this).val();
1349
 
1350
+ jQuery('.above-smart-sharing-container .sharing-buttons .sortable').find('li').each(function() {
1351
+ if(jQuery(this).text().toLowerCase().search(currentVal.toLowerCase()) === -1) {
1352
+ jQuery(this).hide().attr('data-hidden', 'true');
1353
  }
1354
  else {
1355
+ jQuery(this).show().removeAttr('data-hidden');
1356
  }
1357
  });
1358
 
1359
  });
1360
 
1361
+ jQuery('.below-smart-sharing-container .sharing-buttons-search').bind('keyup', function(e) {
1362
 
1363
+ var currentVal = jQuery(this).val();
1364
 
1365
+ jQuery('.below-smart-sharing-container .sharing-buttons .sortable').find('li').each(function() {
1366
+ if(jQuery(this).text().toLowerCase().search(currentVal.toLowerCase()) === -1) {
1367
+ jQuery(this).hide().attr('data-hidden', 'true');
1368
  }
1369
  else {
1370
+ jQuery(this).show().removeAttr('data-hidden');
1371
  }
1372
  });
1373
 
1374
  });
1375
 
1376
+ jQuery('.sharing-buttons-search').bind('click', function() {
1377
  trackPageView('/tracker/gtc/' + (window.page || '') + '/event/search_clicked');
1378
  });
1379
 
1380
+ jQuery('.above-smart-sharing-container .sortable').bind('mousedown', function() {
1381
+ if(jQuery('.above-smart-sharing-container .sharing-buttons-search').is(':focus')) {
1382
+ jQuery('.above-smart-sharing-container .sharing-buttons-search').blur();
1383
  }
1384
  });
1385
+ jQuery('.below-smart-sharing-container .sortable').bind('mousedown', function() {
1386
+ if(jQuery('.below-smart-sharing-container .sharing-buttons-search').is(':focus')) {
1387
+ jQuery('.below-smart-sharing-container .sharing-buttons-search').blur();
1388
  }
1389
  });
1390
 
1391
+ jQuery('.above-smart-sharing-container .selected-services .sortable').bind({
1392
 
1393
  'mouseover': function() {
1394
+ if(jQuery(this).find('li.enabled:visible').length > 1) {
1395
+ jQuery('.above-smart-sharing-container .horizontal-drag').hide();
1396
+ jQuery('.above-smart-sharing-container .vertical-drag').show();
1397
  }
1398
  },
1399
  'mouseout': function() {
1400
+ jQuery('.above-smart-sharing-container .vertical-drag').hide();
1401
  }
1402
 
1403
  });
1404
 
1405
+ jQuery('.below-smart-sharing-container .selected-services .sortable').bind({
1406
 
1407
  'mouseover': function() {
1408
+ if(jQuery(this).find('li.enabled:visible').length > 1) {
1409
+ jQuery('.below-smart-sharing-container .horizontal-drag').hide();
1410
+ jQuery('.below-smart-sharing-container .vertical-drag').show();
1411
  }
1412
  },
1413
  'mouseout': function() {
1414
+ jQuery('.below-smart-sharing-container .vertical-drag').hide();
1415
  }
1416
 
1417
  });
1418
 
1419
+ jQuery('.above-smart-sharing-container .sharing-buttons .sortable').bind({
1420
 
1421
  'mouseover': function() {
1422
+ if(jQuery(this).find('li.enabled:visible').length) {
1423
+ jQuery('.above-smart-sharing-container .vertical-drag').hide();
1424
+ jQuery('.above-smart-sharing-container .horizontal-drag').show();
1425
  }
1426
  },
1427
  'mouseout': function() {
1428
+ jQuery('.above-smart-sharing-container .horizontal-drag').hide();
1429
  }
1430
 
1431
  });
1432
 
1433
+ jQuery('.below-smart-sharing-container .sharing-buttons .sortable').bind({
1434
 
1435
  'mouseover': function() {
1436
+ if(jQuery(this).find('li.enabled:visible').length) {
1437
+ jQuery('.below-smart-sharing-container .vertical-drag').hide();
1438
+ jQuery('.below-smart-sharing-container .horizontal-drag').show();
1439
  }
1440
  },
1441
  'mouseout': function() {
1442
+ jQuery('.below-smart-sharing-container .horizontal-drag').hide();
1443
  }
1444
 
1445
  });
1446
 
1447
+ jQuery('body').bind({
1448
 
1449
  'populatedList': function() {
1450
  setTimeout(function() {
1451
+ jQuery('.sortable .disabled, .sortable .close').tooltip({
1452
  position: {
1453
+ my: 'left+15 top',
1454
  at: 'right top',
1455
  collision: 'none',
1456
  tooltipClass: 'custom-tooltip-styling'
1457
  }
1458
  });
1459
+ jQuery('.above-smart-sharing-container .sortable .disabled').bind('mouseover', function() {
1460
+ jQuery('.above-smart-sharing-container .horizontal-drag, .above-smart-sharing-container .vertical-drag').hide();
1461
  });
1462
+ jQuery('.above-smart-sharing-container .sharing-buttons .enabled').bind('mouseenter', function() {
1463
+ if(jQuery(this).parent().parent().hasClass('sharing-buttons')) {
1464
+ jQuery('.above-smart-sharing-container .horizontal-drag').show();
1465
  }
1466
  });
1467
+ jQuery('.above-smart-sharing-container .selected-services .enabled').bind('mouseenter', function() {
1468
+ jQuery('.above-smart-sharing-container .vertical-drag').show();
1469
  });
1470
+ jQuery('.below-smart-sharing-container .sortable .disabled').bind('mouseover', function() {
1471
+ jQuery('.below-smart-sharing-container .horizontal-drag, .below-smart-sharing-container .vertical-drag').hide();
1472
  });
1473
+ jQuery('.below-smart-sharing-container .sharing-buttons .enabled').bind('mouseenter', function() {
1474
+ if(jQuery(this).parent().parent().hasClass('sharing-buttons')) {
1475
+ jQuery('.below-smart-sharing-container .horizontal-drag').show();
1476
  }
1477
  });
1478
+ jQuery('.below-smart-sharing-container .selected-services .enabled').bind('mouseenter', function() {
1479
+ jQuery('.below-smart-sharing-container .vertical-drag').show();
1480
  });
1481
  },0);
1482
  }
1502
  service,
1503
  thirdPartyButtons = customServicesAPI.thirdPartyButtons.services();
1504
 
1505
+ jQuery(function() {
1506
 
1507
  customServicesAPI.addthisButtons.services = serviceList;
1508
  if((response||{}).data) {
1533
 
1534
  } catch(e) {}
1535
 
1536
+ customServicesAPI.totalServices = jQuery.merge(jQuery.merge([],serviceList), customServicesAPI.thirdPartyButtons.services());
1537
 
1538
  customServicesAPI.disabledServices = _.filter(serviceList, function(service) {
1539
  return !_.where(customServicesAPI.thirdPartyButtons.services(), { 'linkedService': service.service }).length;
1545
 
1546
  };
1547
 
1548
+ jQuery(document).ready(function(jQuery) {
1549
+ if(jQuery('#above-disable-smart-sharing').attr('checked')){
1550
  setTimeout(function() {
1551
  window.customServicesAPI.abovepopulateSharingServices();
1552
  }, 0);
1553
+ jQuery('.above-smart-sharing-container .restore-default-options').show();
1554
+ jQuery('.above-smart-sharing-container .customize-buttons').show();
1555
  setTimeout(function() {
1556
  // Makes the new list sortable
1557
+ jQuery('.above-smart-sharing-container .sortable').sortable().disableSelection().sortable('option', 'connectWith', '.sortable');
1558
  }, 0);
1559
  }
1560
 
1561
+ if(jQuery('#below-disable-smart-sharing').attr('checked')){
1562
  setTimeout(function() {
1563
  window.customServicesAPI.belowpopulateSharingServices();
1564
  }, 0);
1565
+ jQuery('.below-smart-sharing-container .restore-default-options').show();
1566
+ jQuery('.below-smart-sharing-container .customize-buttons').show();
1567
  setTimeout(function() {
1568
  // Makes the new list sortable
1569
+ jQuery('.below-smart-sharing-container .sortable').sortable().disableSelection().sortable('option', 'connectWith', '.sortable');
1570
  }, 0);
1571
  }
1572
  });
js/gtc.cover.js CHANGED
@@ -34,15 +34,15 @@ window.commonMethods = {
34
 
35
  }
36
 
37
- else if(obj.method.toLowerCase() === "set" && obj.data != null && $.isPlainObject(obj.data)) {
38
 
39
- tempObj = $.extend({}, JSON.parse(window.localStorage.getItem(obj.namespace)), obj.data);
40
 
41
  return window.localStorage.setItem(obj.namespace, JSON.stringify(tempObj));
42
 
43
  }
44
 
45
- else if(obj.method.toLowerCase() === "set" && obj.data != null && $.isArray(obj.data)) {
46
 
47
  return window.localStorage.setItem(obj.namespace, JSON.stringify(obj.data));
48
 
@@ -65,9 +65,9 @@ window.commonMethods = {
65
 
66
  for(var x in obj) {
67
 
68
- if($(x).is(':checkbox') || $(x).is(':radio')) $(x).prop('checked', obj[x]).change();
69
 
70
- else $(x).val(obj[x]).change().keyup();
71
 
72
  }
73
 
@@ -91,15 +91,15 @@ window.commonMethods = {
91
 
92
  for(var x in obj) {
93
 
94
- if($(x).is(':checkbox') || $(x).is(':radio')) {
95
 
96
- $(x).prop('checked', obj[x]).val(obj[x]);
97
 
98
- if($(x).is(':checked')) $(x).trigger('auto-dismiss');
99
 
100
  }
101
 
102
- else $(x).val(obj[x]).attr("data-updated", "updated");
103
 
104
  }
105
 
@@ -114,10 +114,6 @@ window.commonMethods = {
114
  };
115
 
116
  window.addthisnamespaces = {
117
- aboveshare: 'addthis-share-above',
118
- belowshare: 'addthis-share-below'
119
  };
120
-
121
- $(function() {
122
-
123
- });
34
 
35
  }
36
 
37
+ else if(obj.method.toLowerCase() === "set" && obj.data != null && jQuery.isPlainObject(obj.data)) {
38
 
39
+ tempObj = jQuery.extend({}, JSON.parse(window.localStorage.getItem(obj.namespace)), obj.data);
40
 
41
  return window.localStorage.setItem(obj.namespace, JSON.stringify(tempObj));
42
 
43
  }
44
 
45
+ else if(obj.method.toLowerCase() === "set" && obj.data != null && jQuery.isArray(obj.data)) {
46
 
47
  return window.localStorage.setItem(obj.namespace, JSON.stringify(obj.data));
48
 
65
 
66
  for(var x in obj) {
67
 
68
+ if(jQuery(x).is(':checkbox') || jQuery(x).is(':radio')) jQuery(x).prop('checked', obj[x]).change();
69
 
70
+ else jQuery(x).val(obj[x]).change().keyup();
71
 
72
  }
73
 
91
 
92
  for(var x in obj) {
93
 
94
+ if(jQuery(x).is(':checkbox') || jQuery(x).is(':radio')) {
95
 
96
+ jQuery(x).prop('checked', obj[x]).val(obj[x]);
97
 
98
+ if(jQuery(x).is(':checked')) jQuery(x).trigger('auto-dismiss');
99
 
100
  }
101
 
102
+ else jQuery(x).val(obj[x]).attr("data-updated", "updated");
103
 
104
  }
105
 
114
  };
115
 
116
  window.addthisnamespaces = {
117
+ aboveshare: 'addthis-share-above',
118
+ belowshare: 'addthis-share-below'
119
  };
 
 
 
 
js/jqueryui.sortable.js DELETED
@@ -1,5 +0,0 @@
1
- /* jQuery UI - v1.10.2 - 2013-03-15
2
- * http://jqueryui.com
3
- * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.sortable.js, jquery.ui.tooltip.js
4
- * Copyright 2013 jQuery Foundation and other contributors Licensed MIT */
5
- (function(b,f){var a=0,e=/^ui-id-\d+$/;b.ui=b.ui||{};b.extend(b.ui,{version:"1.10.2",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}});b.fn.extend({focus:(function(g){return function(h,i){return typeof h==="number"?this.each(function(){var j=this;setTimeout(function(){b(j).focus();if(i){i.call(j)}},h)}):g.apply(this,arguments)}})(b.fn.focus),scrollParent:function(){var g;if((b.ui.ie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){g=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(b.css(this,"position"))&&(/(auto|scroll)/).test(b.css(this,"overflow")+b.css(this,"overflow-y")+b.css(this,"overflow-x"))}).eq(0)}else{g=this.parents().filter(function(){return(/(auto|scroll)/).test(b.css(this,"overflow")+b.css(this,"overflow-y")+b.css(this,"overflow-x"))}).eq(0)}return(/fixed/).test(this.css("position"))||!g.length?b(document):g},zIndex:function(j){if(j!==f){return this.css("zIndex",j)}if(this.length){var h=b(this[0]),g,i;while(h.length&&h[0]!==document){g=h.css("position");if(g==="absolute"||g==="relative"||g==="fixed"){i=parseInt(h.css("zIndex"),10);if(!isNaN(i)&&i!==0){return i}}h=h.parent()}}return 0},uniqueId:function(){return this.each(function(){if(!this.id){this.id="ui-id-"+(++a)}})},removeUniqueId:function(){return this.each(function(){if(e.test(this.id)){b(this).removeAttr("id")}})}});function d(i,g){var k,j,h,l=i.nodeName.toLowerCase();if("area"===l){k=i.parentNode;j=k.name;if(!i.href||!j||k.nodeName.toLowerCase()!=="map"){return false}h=b("img[usemap=#"+j+"]")[0];return !!h&&c(h)}return(/input|select|textarea|button|object/.test(l)?!i.disabled:"a"===l?i.href||g:g)&&c(i)}function c(g){return b.expr.filters.visible(g)&&!b(g).parents().addBack().filter(function(){return b.css(this,"visibility")==="hidden"}).length}b.extend(b.expr[":"],{data:b.expr.createPseudo?b.expr.createPseudo(function(g){return function(h){return !!b.data(h,g)}}):function(j,h,g){return !!b.data(j,g[3])},focusable:function(g){return d(g,!isNaN(b.attr(g,"tabindex")))},tabbable:function(i){var g=b.attr(i,"tabindex"),h=isNaN(g);return(h||g>=0)&&d(i,!h)}});if(!b("<a>").outerWidth(1).jquery){b.each(["Width","Height"],function(j,g){var h=g==="Width"?["Left","Right"]:["Top","Bottom"],k=g.toLowerCase(),m={innerWidth:b.fn.innerWidth,innerHeight:b.fn.innerHeight,outerWidth:b.fn.outerWidth,outerHeight:b.fn.outerHeight};function l(o,n,i,p){b.each(h,function(){n-=parseFloat(b.css(o,"padding"+this))||0;if(i){n-=parseFloat(b.css(o,"border"+this+"Width"))||0}if(p){n-=parseFloat(b.css(o,"margin"+this))||0}});return n}b.fn["inner"+g]=function(i){if(i===f){return m["inner"+g].call(this)}return this.each(function(){b(this).css(k,l(this,i)+"px")})};b.fn["outer"+g]=function(i,n){if(typeof i!=="number"){return m["outer"+g].call(this,i)}return this.each(function(){b(this).css(k,l(this,i,true,n)+"px")})}})}if(!b.fn.addBack){b.fn.addBack=function(g){return this.add(g==null?this.prevObject:this.prevObject.filter(g))}}if(b("<a>").data("a-b","a").removeData("a-b").data("a-b")){b.fn.removeData=(function(g){return function(h){if(arguments.length){return g.call(this,b.camelCase(h))}else{return g.call(this)}}})(b.fn.removeData)}b.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());b.support.selectstart="onselectstart" in document.createElement("div");b.fn.extend({disableSelection:function(){return this.bind((b.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(g){g.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});b.extend(b.ui,{plugin:{add:function(h,j,l){var g,k=b.ui[h].prototype;for(g in l){k.plugins[g]=k.plugins[g]||[];k.plugins[g].push([j,l[g]])}},call:function(g,j,h){var k,l=g.plugins[j];if(!l||!g.element[0].parentNode||g.element[0].parentNode.nodeType===11){return}for(k=0;k<l.length;k++){if(g.options[l[k][0]]){l[k][1].apply(g.element,h)}}}},hasScroll:function(j,h){if(b(j).css("overflow")==="hidden"){return false}var g=(h&&h==="left")?"scrollLeft":"scrollTop",i=false;if(j[g]>0){return true}j[g]=1;i=(j[g]>0);j[g]=0;return i}})})(jQuery);(function(b,e){var a=0,d=Array.prototype.slice,c=b.cleanData;b.cleanData=function(f){for(var g=0,h;(h=f[g])!=null;g++){try{b(h).triggerHandler("remove")}catch(j){}}c(f)};b.widget=function(f,g,n){var k,l,i,m,h={},j=f.split(".")[0];f=f.split(".")[1];k=j+"-"+f;if(!n){n=g;g=b.Widget}b.expr[":"][k.toLowerCase()]=function(o){return !!b.data(o,k)};b[j]=b[j]||{};l=b[j][f];i=b[j][f]=function(o,p){if(!this._createWidget){return new i(o,p)}if(arguments.length){this._createWidget(o,p)}};b.extend(i,l,{version:n.version,_proto:b.extend({},n),_childConstructors:[]});m=new g();m.options=b.widget.extend({},m.options);b.each(n,function(p,o){if(!b.isFunction(o)){h[p]=o;return}h[p]=(function(){var q=function(){return g.prototype[p].apply(this,arguments)},r=function(s){return g.prototype[p].apply(this,s)};return function(){var u=this._super,s=this._superApply,t;this._super=q;this._superApply=r;t=o.apply(this,arguments);this._super=u;this._superApply=s;return t}})()});i.prototype=b.widget.extend(m,{widgetEventPrefix:l?m.widgetEventPrefix:f},h,{constructor:i,namespace:j,widgetName:f,widgetFullName:k});if(l){b.each(l._childConstructors,function(p,q){var o=q.prototype;b.widget(o.namespace+"."+o.widgetName,i,q._proto)});delete l._childConstructors}else{g._childConstructors.push(i)}b.widget.bridge(f,i)};b.widget.extend=function(k){var g=d.call(arguments,1),j=0,f=g.length,h,i;for(;j<f;j++){for(h in g[j]){i=g[j][h];if(g[j].hasOwnProperty(h)&&i!==e){if(b.isPlainObject(i)){k[h]=b.isPlainObject(k[h])?b.widget.extend({},k[h],i):b.widget.extend({},i)}else{k[h]=i}}}}return k};b.widget.bridge=function(g,f){var h=f.prototype.widgetFullName||g;b.fn[g]=function(k){var i=typeof k==="string",j=d.call(arguments,1),l=this;k=!i&&j.length?b.widget.extend.apply(null,[k].concat(j)):k;if(i){this.each(function(){var n,m=b.data(this,h);if(!m){return b.error("cannot call methods on "+g+" prior to initialization; attempted to call method '"+k+"'")}if(!b.isFunction(m[k])||k.charAt(0)==="_"){return b.error("no such method '"+k+"' for "+g+" widget instance")}n=m[k].apply(m,j);if(n!==m&&n!==e){l=n&&n.jquery?l.pushStack(n.get()):n;return false}})}else{this.each(function(){var m=b.data(this,h);if(m){m.option(k||{})._init()}else{b.data(this,h,new f(k,this))}})}return l}};b.Widget=function(){};b.Widget._childConstructors=[];b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:false,create:null},_createWidget:function(f,g){g=b(g||this.defaultElement||this)[0];this.element=b(g);this.uuid=a++;this.eventNamespace="."+this.widgetName+this.uuid;this.options=b.widget.extend({},this.options,this._getCreateOptions(),f);this.bindings=b();this.hoverable=b();this.focusable=b();if(g!==this){b.data(g,this.widgetFullName,this);this._on(true,this.element,{remove:function(h){if(h.target===g){this.destroy()}}});this.document=b(g.style?g.ownerDocument:g.document||g);this.window=b(this.document[0].defaultView||this.document[0].parentWindow)}this._create();this._trigger("create",null,this._getCreateEventData());this._init()},_getCreateOptions:b.noop,_getCreateEventData:b.noop,_create:b.noop,_init:b.noop,destroy:function(){this._destroy();this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(b.camelCase(this.widgetFullName));this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled");this.bindings.unbind(this.eventNamespace);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")},_destroy:b.noop,widget:function(){return this.element},option:function(j,k){var f=j,l,h,g;if(arguments.length===0){return b.widget.extend({},this.options)}if(typeof j==="string"){f={};l=j.split(".");j=l.shift();if(l.length){h=f[j]=b.widget.extend({},this.options[j]);for(g=0;g<l.length-1;g++){h[l[g]]=h[l[g]]||{};h=h[l[g]]}j=l.pop();if(k===e){return h[j]===e?null:h[j]}h[j]=k}else{if(k===e){return this.options[j]===e?null:this.options[j]}f[j]=k}}this._setOptions(f);return this},_setOptions:function(f){var g;for(g in f){this._setOption(g,f[g])}return this},_setOption:function(f,g){this.options[f]=g;if(f==="disabled"){this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!g).attr("aria-disabled",g);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_on:function(i,h,g){var j,f=this;if(typeof i!=="boolean"){g=h;h=i;i=false}if(!g){g=h;h=this.element;j=this.widget()}else{h=j=b(h);this.bindings=this.bindings.add(h)}b.each(g,function(p,o){function m(){if(!i&&(f.options.disabled===true||b(this).hasClass("ui-state-disabled"))){return}return(typeof o==="string"?f[o]:o).apply(f,arguments)}if(typeof o!=="string"){m.guid=o.guid=o.guid||m.guid||b.guid++}var n=p.match(/^(\w+)\s*(.*)$/),l=n[1]+f.eventNamespace,k=n[2];if(k){j.delegate(k,l,m)}else{h.bind(l,m)}})},_off:function(g,f){f=(f||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace;g.unbind(f).undelegate(f)},_delay:function(i,h){function g(){return(typeof i==="string"?f[i]:i).apply(f,arguments)}var f=this;return setTimeout(g,h||0)},_hoverable:function(f){this.hoverable=this.hoverable.add(f);this._on(f,{mouseenter:function(g){b(g.currentTarget).addClass("ui-state-hover")},mouseleave:function(g){b(g.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(f){this.focusable=this.focusable.add(f);this._on(f,{focusin:function(g){b(g.currentTarget).addClass("ui-state-focus")},focusout:function(g){b(g.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(f,g,h){var k,j,i=this.options[f];h=h||{};g=b.Event(g);g.type=(f===this.widgetEventPrefix?f:this.widgetEventPrefix+f).toLowerCase();g.target=this.element[0];j=g.originalEvent;if(j){for(k in j){if(!(k in g)){g[k]=j[k]}}}this.element.trigger(g,h);return !(b.isFunction(i)&&i.apply(this.element[0],[g].concat(h))===false||g.isDefaultPrevented())}};b.each({show:"fadeIn",hide:"fadeOut"},function(g,f){b.Widget.prototype["_"+g]=function(j,i,l){if(typeof i==="string"){i={effect:i}}var k,h=!i?g:i===true||typeof i==="number"?f:i.effect||f;i=i||{};if(typeof i==="number"){i={duration:i}}k=!b.isEmptyObject(i);i.complete=l;if(i.delay){j.delay(i.delay)}if(k&&b.effects&&b.effects.effect[h]){j[g](i)}else{if(h!==g&&j[h]){j[h](i.duration,i.easing,l)}else{j.queue(function(m){b(this)[g]();if(l){l.call(j[0])}m()})}}}})})(jQuery);(function(b,c){var a=false;b(document).mouseup(function(){a=false});b.widget("ui.mouse",{version:"1.10.2",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var d=this;this.element.bind("mousedown."+this.widgetName,function(e){return d._mouseDown(e)}).bind("click."+this.widgetName,function(e){if(true===b.data(e.target,d.widgetName+".preventClickEvent")){b.removeData(e.target,d.widgetName+".preventClickEvent");e.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);if(this._mouseMoveDelegate){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)}},_mouseDown:function(f){if(a){return}(this._mouseStarted&&this._mouseUp(f));this._mouseDownEvent=f;var e=this,g=(f.which===1),d=(typeof this.options.cancel==="string"&&f.target.nodeName?b(f.target).closest(this.options.cancel).length:false);if(!g||d||!this._mouseCapture(f)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f)){this._mouseStarted=(this._mouseStart(f)!==false);if(!this._mouseStarted){f.preventDefault();return true}}if(true===b.data(f.target,this.widgetName+".preventClickEvent")){b.removeData(f.target,this.widgetName+".preventClickEvent")}this._mouseMoveDelegate=function(h){return e._mouseMove(h)};this._mouseUpDelegate=function(h){return e._mouseUp(h)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);f.preventDefault();a=true;return true},_mouseMove:function(d){if(b.ui.ie&&(!document.documentMode||document.documentMode<9)&&!d.button){return this._mouseUp(d)}if(this._mouseStarted){this._mouseDrag(d);return d.preventDefault()}if(this._mouseDistanceMet(d)&&this._mouseDelayMet(d)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,d)!==false);(this._mouseStarted?this._mouseDrag(d):this._mouseUp(d))}return !this._mouseStarted},_mouseUp:function(d){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(d.target===this._mouseDownEvent.target){b.data(d.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(d)}return false},_mouseDistanceMet:function(d){return(Math.max(Math.abs(this._mouseDownEvent.pageX-d.pageX),Math.abs(this._mouseDownEvent.pageY-d.pageY))>=this.options.distance)},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);(function(e,c){e.ui=e.ui||{};var j,k=Math.max,o=Math.abs,m=Math.round,d=/left|center|right/,h=/top|center|bottom/,a=/[\+\-]\d+(\.[\d]+)?%?/,l=/^\w+/,b=/%$/,g=e.fn.position;function n(r,q,p){return[parseFloat(r[0])*(b.test(r[0])?q/100:1),parseFloat(r[1])*(b.test(r[1])?p/100:1)]}function i(p,q){return parseInt(e.css(p,q),10)||0}function f(q){var p=q[0];if(p.nodeType===9){return{width:q.width(),height:q.height(),offset:{top:0,left:0}}}if(e.isWindow(p)){return{width:q.width(),height:q.height(),offset:{top:q.scrollTop(),left:q.scrollLeft()}}}if(p.preventDefault){return{width:0,height:0,offset:{top:p.pageY,left:p.pageX}}}return{width:q.outerWidth(),height:q.outerHeight(),offset:q.offset()}}e.position={scrollbarWidth:function(){if(j!==c){return j}var q,p,s=e("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),r=s.children()[0];e("body").append(s);q=r.offsetWidth;s.css("overflow","scroll");p=r.offsetWidth;if(q===p){p=s[0].clientWidth}s.remove();return(j=q-p)},getScrollInfo:function(t){var s=t.isWindow?"":t.element.css("overflow-x"),r=t.isWindow?"":t.element.css("overflow-y"),q=s==="scroll"||(s==="auto"&&t.width<t.element[0].scrollWidth),p=r==="scroll"||(r==="auto"&&t.height<t.element[0].scrollHeight);return{width:p?e.position.scrollbarWidth():0,height:q?e.position.scrollbarWidth():0}},getWithinInfo:function(q){var r=e(q||window),p=e.isWindow(r[0]);return{element:r,isWindow:p,offset:r.offset()||{left:0,top:0},scrollLeft:r.scrollLeft(),scrollTop:r.scrollTop(),width:p?r.width():r.outerWidth(),height:p?r.height():r.outerHeight()}}};e.fn.position=function(z){if(!z||!z.of){return g.apply(this,arguments)}z=e.extend({},z);var A,w,u,y,t,p,v=e(z.of),s=e.position.getWithinInfo(z.within),q=e.position.getScrollInfo(s),x=(z.collision||"flip").split(" "),r={};p=f(v);if(v[0].preventDefault){z.at="left top"}w=p.width;u=p.height;y=p.offset;t=e.extend({},y);e.each(["my","at"],function(){var D=(z[this]||"").split(" "),C,B;if(D.length===1){D=d.test(D[0])?D.concat(["center"]):h.test(D[0])?["center"].concat(D):["center","center"]}D[0]=d.test(D[0])?D[0]:"center";D[1]=h.test(D[1])?D[1]:"center";C=a.exec(D[0]);B=a.exec(D[1]);r[this]=[C?C[0]:0,B?B[0]:0];z[this]=[l.exec(D[0])[0],l.exec(D[1])[0]]});if(x.length===1){x[1]=x[0]}if(z.at[0]==="right"){t.left+=w}else{if(z.at[0]==="center"){t.left+=w/2}}if(z.at[1]==="bottom"){t.top+=u}else{if(z.at[1]==="center"){t.top+=u/2}}A=n(r.at,w,u);t.left+=A[0];t.top+=A[1];return this.each(function(){var C,L,E=e(this),G=E.outerWidth(),D=E.outerHeight(),F=i(this,"marginLeft"),B=i(this,"marginTop"),K=G+F+i(this,"marginRight")+q.width,J=D+B+i(this,"marginBottom")+q.height,H=e.extend({},t),I=n(r.my,E.outerWidth(),E.outerHeight());if(z.my[0]==="right"){H.left-=G}else{if(z.my[0]==="center"){H.left-=G/2}}if(z.my[1]==="bottom"){H.top-=D}else{if(z.my[1]==="center"){H.top-=D/2}}H.left+=I[0];H.top+=I[1];if(!e.support.offsetFractions){H.left=m(H.left);H.top=m(H.top)}C={marginLeft:F,marginTop:B};e.each(["left","top"],function(N,M){if(e.ui.position[x[N]]){e.ui.position[x[N]][M](H,{targetWidth:w,targetHeight:u,elemWidth:G,elemHeight:D,collisionPosition:C,collisionWidth:K,collisionHeight:J,offset:[A[0]+I[0],A[1]+I[1]],my:z.my,at:z.at,within:s,elem:E})}});if(z.using){L=function(P){var R=y.left-H.left,O=R+w-G,Q=y.top-H.top,N=Q+u-D,M={target:{element:v,left:y.left,top:y.top,width:w,height:u},element:{element:E,left:H.left,top:H.top,width:G,height:D},horizontal:O<0?"left":R>0?"right":"center",vertical:N<0?"top":Q>0?"bottom":"middle"};if(w<G&&o(R+O)<w){M.horizontal="center"}if(u<D&&o(Q+N)<u){M.vertical="middle"}if(k(o(R),o(O))>k(o(Q),o(N))){M.important="horizontal"}else{M.important="vertical"}z.using.call(this,P,M)}}E.offset(e.extend(H,{using:L}))})};e.ui.position={fit:{left:function(t,s){var r=s.within,v=r.isWindow?r.scrollLeft:r.offset.left,x=r.width,u=t.left-s.collisionPosition.marginLeft,w=v-u,q=u+s.collisionWidth-x-v,p;if(s.collisionWidth>x){if(w>0&&q<=0){p=t.left+w+s.collisionWidth-x-v;t.left+=w-p}else{if(q>0&&w<=0){t.left=v}else{if(w>q){t.left=v+x-s.collisionWidth}else{t.left=v}}}}else{if(w>0){t.left+=w}else{if(q>0){t.left-=q}else{t.left=k(t.left-u,t.left)}}}},top:function(s,r){var q=r.within,w=q.isWindow?q.scrollTop:q.offset.top,x=r.within.height,u=s.top-r.collisionPosition.marginTop,v=w-u,t=u+r.collisionHeight-x-w,p;if(r.collisionHeight>x){if(v>0&&t<=0){p=s.top+v+r.collisionHeight-x-w;s.top+=v-p}else{if(t>0&&v<=0){s.top=w}else{if(v>t){s.top=w+x-r.collisionHeight}else{s.top=w}}}}else{if(v>0){s.top+=v}else{if(t>0){s.top-=t}else{s.top=k(s.top-u,s.top)}}}}},flip:{left:function(v,u){var t=u.within,z=t.offset.left+t.scrollLeft,C=t.width,r=t.isWindow?t.scrollLeft:t.offset.left,w=v.left-u.collisionPosition.marginLeft,A=w-r,q=w+u.collisionWidth-C-r,y=u.my[0]==="left"?-u.elemWidth:u.my[0]==="right"?u.elemWidth:0,B=u.at[0]==="left"?u.targetWidth:u.at[0]==="right"?-u.targetWidth:0,s=-2*u.offset[0],p,x;if(A<0){p=v.left+y+B+s+u.collisionWidth-C-z;if(p<0||p<o(A)){v.left+=y+B+s}}else{if(q>0){x=v.left-u.collisionPosition.marginLeft+y+B+s-r;if(x>0||o(x)<q){v.left+=y+B+s}}}},top:function(u,t){var s=t.within,B=s.offset.top+s.scrollTop,C=s.height,p=s.isWindow?s.scrollTop:s.offset.top,w=u.top-t.collisionPosition.marginTop,y=w-p,v=w+t.collisionHeight-C-p,z=t.my[1]==="top",x=z?-t.elemHeight:t.my[1]==="bottom"?t.elemHeight:0,D=t.at[1]==="top"?t.targetHeight:t.at[1]==="bottom"?-t.targetHeight:0,r=-2*t.offset[1],A,q;if(y<0){q=u.top+x+D+r+t.collisionHeight-C-B;if((u.top+x+D+r)>y&&(q<0||q<o(y))){u.top+=x+D+r}}else{if(v>0){A=u.top-t.collisionPosition.marginTop+x+D+r-p;if((u.top+x+D+r)>v&&(A>0||o(A)<v)){u.top+=x+D+r}}}}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments);e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments);e.ui.position.fit.top.apply(this,arguments)}}};(function(){var t,v,q,s,r,p=document.getElementsByTagName("body")[0],u=document.createElement("div");t=document.createElement(p?"div":"body");q={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};if(p){e.extend(q,{position:"absolute",left:"-1000px",top:"-1000px"})}for(r in q){t.style[r]=q[r]}t.appendChild(u);v=p||document.documentElement;v.insertBefore(t,v.firstChild);u.style.cssText="position: absolute; left: 10.7432222px;";s=e(u).offset().left;e.support.offsetFractions=s>10&&s<11;t.innerHTML="";v.removeChild(t)})()}(jQuery));(function(a,b){a.widget("ui.draggable",a.ui.mouse,{version:"1.10.2",widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false,drag:null,start:null,stop:null},_create:function(){if(this.options.helper==="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}if(this.options.addClasses){this.element.addClass("ui-draggable")}if(this.options.disabled){this.element.addClass("ui-draggable-disabled")}this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(c){var d=this.options;if(this.helper||d.disabled||a(c.target).closest(".ui-resizable-handle").length>0){return false}this.handle=this._getHandle(c);if(!this.handle){return false}a(d.iframeFix===true?"iframe":d.iframeFix).each(function(){a("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")});return true},_mouseStart:function(c){var d=this.options;this.helper=this._createHelper(c);this.helper.addClass("ui-draggable-dragging");this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:c.pageX-this.offset.left,top:c.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(c);this.originalPageX=c.pageX;this.originalPageY=c.pageY;(d.cursorAt&&this._adjustOffsetFromHelper(d.cursorAt));if(d.containment){this._setContainment()}if(this._trigger("start",c)===false){this._clear();return false}this._cacheHelperProportions();if(a.ui.ddmanager&&!d.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,c)}this._mouseDrag(c,true);if(a.ui.ddmanager){a.ui.ddmanager.dragStart(this,c)}return true},_mouseDrag:function(c,e){this.position=this._generatePosition(c);this.positionAbs=this._convertPositionTo("absolute");if(!e){var d=this._uiHash();if(this._trigger("drag",c,d)===false){this._mouseUp({});return false}this.position=d.position}if(!this.options.axis||this.options.axis!=="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!=="x"){this.helper[0].style.top=this.position.top+"px"}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,c)}return false},_mouseStop:function(e){var c,d=this,g=false,f=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){f=a.ui.ddmanager.drop(this,e)}if(this.dropped){f=this.dropped;this.dropped=false}c=this.element[0];while(c&&(c=c.parentNode)){if(c===document){g=true}}if(!g&&this.options.helper==="original"){return false}if((this.options.revert==="invalid"&&!f)||(this.options.revert==="valid"&&f)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,f))){a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){if(d._trigger("stop",e)!==false){d._clear()}})}else{if(this._trigger("stop",e)!==false){this._clear()}}return false},_mouseUp:function(c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});if(a.ui.ddmanager){a.ui.ddmanager.dragStop(this,c)}return a.ui.mouse.prototype._mouseUp.call(this,c)},cancel:function(){if(this.helper.is(".ui-draggable-dragging")){this._mouseUp({})}else{this._clear()}return this},_getHandle:function(c){return this.options.handle?!!a(c.target).closest(this.element.find(this.options.handle)).length:true},_createHelper:function(d){var e=this.options,c=a.isFunction(e.helper)?a(e.helper.apply(this.element[0],[d])):(e.helper==="clone"?this.element.clone().removeAttr("id"):this.element);if(!c.parents("body").length){c.appendTo((e.appendTo==="parent"?this.element[0].parentNode:e.appendTo))}if(c[0]!==this.element[0]&&!(/(fixed|absolute)/).test(c.css("position"))){c.css("position","absolute")}return c},_adjustOffsetFromHelper:function(c){if(typeof c==="string"){c=c.split(" ")}if(a.isArray(c)){c={left:+c[0],top:+c[1]||0}}if("left" in c){this.offset.click.left=c.left+this.margins.left}if("right" in c){this.offset.click.left=this.helperProportions.width-c.right+this.margins.left}if("top" in c){this.offset.click.top=c.top+this.margins.top}if("bottom" in c){this.offset.click.top=this.helperProportions.height-c.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var c=this.offsetParent.offset();if(this.cssPosition==="absolute"&&this.scrollParent[0]!==document&&a.contains(this.scrollParent[0],this.offsetParent[0])){c.left+=this.scrollParent.scrollLeft();c.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]===document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==="html"&&a.ui.ie)){c={top:0,left:0}}return{top:c.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:c.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition==="relative"){var c=this.element.position();return{top:c.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:c.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0),right:(parseInt(this.element.css("marginRight"),10)||0),bottom:(parseInt(this.element.css("marginBottom"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,g,d,f=this.options;if(f.containment==="parent"){f.containment=this.helper[0].parentNode}if(f.containment==="document"||f.containment==="window"){this.containment=[f.containment==="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,f.containment==="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(f.containment==="document"?0:a(window).scrollLeft())+a(f.containment==="document"?document:window).width()-this.helperProportions.width-this.margins.left,(f.containment==="document"?0:a(window).scrollTop())+(a(f.containment==="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(f.containment)&&f.containment.constructor!==Array){g=a(f.containment);d=g[0];if(!d){return}e=(a(d).css("overflow")!=="hidden");this.containment=[(parseInt(a(d).css("borderLeftWidth"),10)||0)+(parseInt(a(d).css("paddingLeft"),10)||0),(parseInt(a(d).css("borderTopWidth"),10)||0)+(parseInt(a(d).css("paddingTop"),10)||0),(e?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(a(d).css("borderRightWidth"),10)||0)-(parseInt(a(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(a(d).css("borderBottomWidth"),10)||0)-(parseInt(a(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=g}else{if(f.containment.constructor===Array){this.containment=f.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var e=f==="absolute"?1:-1,c=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==document&&a.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(c[0].tagName);return{top:(h.top+this.offset.relative.top*e+this.offset.parent.top*e-((this.cssPosition==="fixed"?-this.scrollParent.scrollTop():(g?0:c.scrollTop()))*e)),left:(h.left+this.offset.relative.left*e+this.offset.parent.left*e-((this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():g?0:c.scrollLeft())*e))}},_generatePosition:function(d){var c,j,k,f,e=this.options,l=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==document&&a.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(l[0].tagName),h=d.pageX,g=d.pageY;if(this.originalPosition){if(this.containment){if(this.relative_container){j=this.relative_container.offset();c=[this.containment[0]+j.left,this.containment[1]+j.top,this.containment[2]+j.left,this.containment[3]+j.top]}else{c=this.containment}if(d.pageX-this.offset.click.left<c[0]){h=c[0]+this.offset.click.left}if(d.pageY-this.offset.click.top<c[1]){g=c[1]+this.offset.click.top}if(d.pageX-this.offset.click.left>c[2]){h=c[2]+this.offset.click.left}if(d.pageY-this.offset.click.top>c[3]){g=c[3]+this.offset.click.top}}if(e.grid){k=e.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/e.grid[1])*e.grid[1]:this.originalPageY;g=c?((k-this.offset.click.top>=c[1]||k-this.offset.click.top>c[3])?k:((k-this.offset.click.top>=c[1])?k-e.grid[1]:k+e.grid[1])):k;f=e.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/e.grid[0])*e.grid[0]:this.originalPageX;h=c?((f-this.offset.click.left>=c[0]||f-this.offset.click.left>c[2])?f:((f-this.offset.click.left>=c[0])?f-e.grid[0]:f+e.grid[0])):f}}return{top:(g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+((this.cssPosition==="fixed"?-this.scrollParent.scrollTop():(i?0:l.scrollTop())))),left:(h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+((this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():i?0:l.scrollLeft())))}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!==this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_trigger:function(c,d,e){e=e||this._uiHash();a.ui.plugin.call(this,c,[d,e]);if(c==="drag"){this.positionAbs=this._convertPositionTo("absolute")}return a.Widget.prototype._trigger.call(this,c,d,e)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});a.ui.plugin.add("draggable","connectToSortable",{start:function(d,f){var e=a(this).data("ui-draggable"),g=e.options,c=a.extend({},f,{item:e.element});e.sortables=[];a(g.connectToSortable).each(function(){var h=a.data(this,"ui-sortable");if(h&&!h.options.disabled){e.sortables.push({instance:h,shouldRevert:h.options.revert});h.refreshPositions();h._trigger("activate",d,c)}})},stop:function(d,f){var e=a(this).data("ui-draggable"),c=a.extend({},f,{item:e.element});a.each(e.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;e.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=this.shouldRevert}this.instance._mouseStop(d);this.instance.options.helper=this.instance.options._helper;if(e.options.helper==="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",d,c)}})},drag:function(d,f){var e=a(this).data("ui-draggable"),c=this;a.each(e.sortables,function(){var g=false,h=this;this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;this.instance.offset.click=e.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){g=true;a.each(e.sortables,function(){this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;this.instance.offset.click=e.offset.click;if(this!==h&&this.instance._intersectsWith(this.instance.containerCache)&&a.contains(h.instance.element[0],this.instance.element[0])){g=false}return g})}if(g){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=a(c).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return f.helper[0]};d.target=this.instance.currentItem[0];this.instance._mouseCapture(d,true);this.instance._mouseStart(d,true,true);this.instance.offset.click.top=e.offset.click.top;this.instance.offset.click.left=e.offset.click.left;this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;e._trigger("toSortable",d);e.dropped=this.instance.element;e.currentItem=e.element;this.instance.fromOutside=e}if(this.instance.currentItem){this.instance._mouseDrag(d)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",d,this.instance._uiHash(this.instance));this.instance._mouseStop(d,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}e._trigger("fromSortable",d);e.dropped=false}}})}});a.ui.plugin.add("draggable","cursor",{start:function(){var c=a("body"),d=a(this).data("ui-draggable").options;if(c.css("cursor")){d._cursor=c.css("cursor")}c.css("cursor",d.cursor)},stop:function(){var c=a(this).data("ui-draggable").options;if(c._cursor){a("body").css("cursor",c._cursor)}}});a.ui.plugin.add("draggable","opacity",{start:function(d,e){var c=a(e.helper),f=a(this).data("ui-draggable").options;if(c.css("opacity")){f._opacity=c.css("opacity")}c.css("opacity",f.opacity)},stop:function(c,d){var e=a(this).data("ui-draggable").options;if(e._opacity){a(d.helper).css("opacity",e._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(){var c=a(this).data("ui-draggable");if(c.scrollParent[0]!==document&&c.scrollParent[0].tagName!=="HTML"){c.overflowOffset=c.scrollParent.offset()}},drag:function(e){var d=a(this).data("ui-draggable"),f=d.options,c=false;if(d.scrollParent[0]!==document&&d.scrollParent[0].tagName!=="HTML"){if(!f.axis||f.axis!=="x"){if((d.overflowOffset.top+d.scrollParent[0].offsetHeight)-e.pageY<f.scrollSensitivity){d.scrollParent[0].scrollTop=c=d.scrollParent[0].scrollTop+f.scrollSpeed}else{if(e.pageY-d.overflowOffset.top<f.scrollSensitivity){d.scrollParent[0].scrollTop=c=d.scrollParent[0].scrollTop-f.scrollSpeed}}}if(!f.axis||f.axis!=="y"){if((d.overflowOffset.left+d.scrollParent[0].offsetWidth)-e.pageX<f.scrollSensitivity){d.scrollParent[0].scrollLeft=c=d.scrollParent[0].scrollLeft+f.scrollSpeed}else{if(e.pageX-d.overflowOffset.left<f.scrollSensitivity){d.scrollParent[0].scrollLeft=c=d.scrollParent[0].scrollLeft-f.scrollSpeed}}}}else{if(!f.axis||f.axis!=="x"){if(e.pageY-a(document).scrollTop()<f.scrollSensitivity){c=a(document).scrollTop(a(document).scrollTop()-f.scrollSpeed)}else{if(a(window).height()-(e.pageY-a(document).scrollTop())<f.scrollSensitivity){c=a(document).scrollTop(a(document).scrollTop()+f.scrollSpeed)}}}if(!f.axis||f.axis!=="y"){if(e.pageX-a(document).scrollLeft()<f.scrollSensitivity){c=a(document).scrollLeft(a(document).scrollLeft()-f.scrollSpeed)}else{if(a(window).width()-(e.pageX-a(document).scrollLeft())<f.scrollSensitivity){c=a(document).scrollLeft(a(document).scrollLeft()+f.scrollSpeed)}}}}if(c!==false&&a.ui.ddmanager&&!f.dropBehaviour){a.ui.ddmanager.prepareOffsets(d,e)}}});a.ui.plugin.add("draggable","snap",{start:function(){var c=a(this).data("ui-draggable"),d=c.options;c.snapElements=[];a(d.snap.constructor!==String?(d.snap.items||":data(ui-draggable)"):d.snap).each(function(){var f=a(this),e=f.offset();if(this!==c.element[0]){c.snapElements.push({item:this,width:f.outerWidth(),height:f.outerHeight(),top:e.top,left:e.left})}})},drag:function(u,p){var c,z,j,k,s,n,m,A,v,h,g=a(this).data("ui-draggable"),q=g.options,y=q.snapTolerance,x=p.offset.left,w=x+g.helperProportions.width,f=p.offset.top,e=f+g.helperProportions.height;for(v=g.snapElements.length-1;v>=0;v--){s=g.snapElements[v].left;n=s+g.snapElements[v].width;m=g.snapElements[v].top;A=m+g.snapElements[v].height;if(!((s-y<x&&x<n+y&&m-y<f&&f<A+y)||(s-y<x&&x<n+y&&m-y<e&&e<A+y)||(s-y<w&&w<n+y&&m-y<f&&f<A+y)||(s-y<w&&w<n+y&&m-y<e&&e<A+y))){if(g.snapElements[v].snapping){(g.options.snap.release&&g.options.snap.release.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=false;continue}if(q.snapMode!=="inner"){c=Math.abs(m-e)<=y;z=Math.abs(A-f)<=y;j=Math.abs(s-w)<=y;k=Math.abs(n-x)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m-g.helperProportions.height,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s-g.helperProportions.width}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n}).left-g.margins.left}}h=(c||z||j||k);if(q.snapMode!=="outer"){c=Math.abs(m-f)<=y;z=Math.abs(A-e)<=y;j=Math.abs(s-x)<=y;k=Math.abs(n-w)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A-g.helperProportions.height,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n-g.helperProportions.width}).left-g.margins.left}}if(!g.snapElements[v].snapping&&(c||z||j||k||h)){(g.options.snap.snap&&g.options.snap.snap.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=(c||z||j||k||h)}}});a.ui.plugin.add("draggable","stack",{start:function(){var c,e=this.data("ui-draggable").options,d=a.makeArray(a(e.stack)).sort(function(g,f){return(parseInt(a(g).css("zIndex"),10)||0)-(parseInt(a(f).css("zIndex"),10)||0)});if(!d.length){return}c=parseInt(a(d[0]).css("zIndex"),10)||0;a(d).each(function(f){a(this).css("zIndex",c+f)});this.css("zIndex",(c+d.length))}});a.ui.plugin.add("draggable","zIndex",{start:function(d,e){var c=a(e.helper),f=a(this).data("ui-draggable").options;if(c.css("zIndex")){f._zIndex=c.css("zIndex")}c.css("zIndex",f.zIndex)},stop:function(c,d){var e=a(this).data("ui-draggable").options;if(e._zIndex){a(d.helper).css("zIndex",e._zIndex)}}})})(jQuery);(function(b,c){function a(e,d,f){return(e>d)&&(e<(d+f))}b.widget("ui.droppable",{version:"1.10.2",widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e=this.options,d=e.accept;this.isover=false;this.isout=true;this.accept=b.isFunction(d)?d:function(f){return f.is(d)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};b.ui.ddmanager.droppables[e.scope]=b.ui.ddmanager.droppables[e.scope]||[];b.ui.ddmanager.droppables[e.scope].push(this);(e.addClasses&&this.element.addClass("ui-droppable"))},_destroy:function(){var e=0,d=b.ui.ddmanager.droppables[this.options.scope];for(;e<d.length;e++){if(d[e]===this){d.splice(e,1)}}this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(d,e){if(d==="accept"){this.accept=b.isFunction(e)?e:function(f){return f.is(e)}}b.Widget.prototype._setOption.apply(this,arguments)},_activate:function(e){var d=b.ui.ddmanager.current;if(this.options.activeClass){this.element.addClass(this.options.activeClass)}if(d){this._trigger("activate",e,this.ui(d))}},_deactivate:function(e){var d=b.ui.ddmanager.current;if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(d){this._trigger("deactivate",e,this.ui(d))}},_over:function(e){var d=b.ui.ddmanager.current;if(!d||(d.currentItem||d.element)[0]===this.element[0]){return}if(this.accept.call(this.element[0],(d.currentItem||d.element))){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)}this._trigger("over",e,this.ui(d))}},_out:function(e){var d=b.ui.ddmanager.current;if(!d||(d.currentItem||d.element)[0]===this.element[0]){return}if(this.accept.call(this.element[0],(d.currentItem||d.element))){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("out",e,this.ui(d))}},_drop:function(e,f){var d=f||b.ui.ddmanager.current,g=false;if(!d||(d.currentItem||d.element)[0]===this.element[0]){return false}this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var h=b.data(this,"ui-droppable");if(h.options.greedy&&!h.options.disabled&&h.options.scope===d.options.scope&&h.accept.call(h.element[0],(d.currentItem||d.element))&&b.ui.intersect(d,b.extend(h,{offset:h.element.offset()}),h.options.tolerance)){g=true;return false}});if(g){return false}if(this.accept.call(this.element[0],(d.currentItem||d.element))){if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("drop",e,this.ui(d));return this.element}return false},ui:function(d){return{draggable:(d.currentItem||d.element),helper:d.helper,position:d.position,offset:d.positionAbs}}});b.ui.intersect=function(q,j,o){if(!j.offset){return false}var h,i,f=(q.positionAbs||q.position.absolute).left,e=f+q.helperProportions.width,n=(q.positionAbs||q.position.absolute).top,m=n+q.helperProportions.height,g=j.offset.left,d=g+j.proportions.width,p=j.offset.top,k=p+j.proportions.height;switch(o){case"fit":return(g<=f&&e<=d&&p<=n&&m<=k);case"intersect":return(g<f+(q.helperProportions.width/2)&&e-(q.helperProportions.width/2)<d&&p<n+(q.helperProportions.height/2)&&m-(q.helperProportions.height/2)<k);case"pointer":h=((q.positionAbs||q.position.absolute).left+(q.clickOffset||q.offset.click).left);i=((q.positionAbs||q.position.absolute).top+(q.clickOffset||q.offset.click).top);return a(i,p,j.proportions.height)&&a(h,g,j.proportions.width);case"touch":return((n>=p&&n<=k)||(m>=p&&m<=k)||(n<p&&m>k))&&((f>=g&&f<=d)||(e>=g&&e<=d)||(f<g&&e>d));default:return false}};b.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(g,k){var f,e,d=b.ui.ddmanager.droppables[g.options.scope]||[],h=k?k.type:null,l=(g.currentItem||g.element).find(":data(ui-droppable)").addBack();droppablesLoop:for(f=0;f<d.length;f++){if(d[f].options.disabled||(g&&!d[f].accept.call(d[f].element[0],(g.currentItem||g.element)))){continue}for(e=0;e<l.length;e++){if(l[e]===d[f].element[0]){d[f].proportions.height=0;continue droppablesLoop}}d[f].visible=d[f].element.css("display")!=="none";if(!d[f].visible){continue}if(h==="mousedown"){d[f]._activate.call(d[f],k)}d[f].offset=d[f].element.offset();d[f].proportions={width:d[f].element[0].offsetWidth,height:d[f].element[0].offsetHeight}}},drop:function(d,e){var f=false;b.each((b.ui.ddmanager.droppables[d.options.scope]||[]).slice(),function(){if(!this.options){return}if(!this.options.disabled&&this.visible&&b.ui.intersect(d,this,this.options.tolerance)){f=this._drop.call(this,e)||f}if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],(d.currentItem||d.element))){this.isout=true;this.isover=false;this._deactivate.call(this,e)}});return f},dragStart:function(d,e){d.element.parentsUntil("body").bind("scroll.droppable",function(){if(!d.options.refreshPositions){b.ui.ddmanager.prepareOffsets(d,e)}})},drag:function(d,e){if(d.options.refreshPositions){b.ui.ddmanager.prepareOffsets(d,e)}b.each(b.ui.ddmanager.droppables[d.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible){return}var i,g,f,h=b.ui.intersect(d,this,this.options.tolerance),j=!h&&this.isover?"isout":(h&&!this.isover?"isover":null);if(!j){return}if(this.options.greedy){g=this.options.scope;f=this.element.parents(":data(ui-droppable)").filter(function(){return b.data(this,"ui-droppable").options.scope===g});if(f.length){i=b.data(f[0],"ui-droppable");i.greedyChild=(j==="isover")}}if(i&&j==="isover"){i.isover=false;i.isout=true;i._out.call(i,e)}this[j]=true;this[j==="isout"?"isover":"isout"]=false;this[j==="isover"?"_over":"_out"].call(this,e);if(i&&j==="isout"){i.isout=false;i.isover=true;i._over.call(i,e)}})},dragStop:function(d,e){d.element.parentsUntil("body").unbind("scroll.droppable");if(!d.options.refreshPositions){b.ui.ddmanager.prepareOffsets(d,e)}}}})(jQuery);(function(b,d){function a(f,e,g){return(f>e)&&(f<(e+g))}function c(e){return(/left|right/).test(e.css("float"))||(/inline|table-cell/).test(e.css("display"))}b.widget("ui.sortable",b.ui.mouse,{version:"1.10.2",widgetEventPrefix:"sort",ready:false,options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var e=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?e.axis==="x"||c(this.items[0].item):false;this.offset=this.element.offset();this._mouseInit();this.ready=true},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled");this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--){this.items[e].item.removeData(this.widgetName+"-item")}return this},_setOption:function(e,f){if(e==="disabled"){this.options[e]=f;this.widget().toggleClass("ui-sortable-disabled",!!f)}else{b.Widget.prototype._setOption.apply(this,arguments)}},_mouseCapture:function(g,h){var e=null,i=false,f=this;if(this.reverting){return false}if(this.options.disabled||this.options.type==="static"){return false}this._refreshItems(g);b(g.target).parents().each(function(){if(b.data(this,f.widgetName+"-item")===f){e=b(this);return false}});if(b.data(g.target,f.widgetName+"-item")===f){e=b(g.target)}if(!e){return false}if(this.options.handle&&!h){b(this.options.handle,e).find("*").addBack().each(function(){if(this===g.target){i=true}});if(!i){return false}}this.currentItem=e;this._removeCurrentsFromItems();return true},_mouseStart:function(h,j,f){var g,e,k=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(h);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};b.extend(this.offset,{click:{left:h.pageX-this.offset.left,top:h.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");this.originalPosition=this._generatePosition(h);this.originalPageX=h.pageX;this.originalPageY=h.pageY;(k.cursorAt&&this._adjustOffsetFromHelper(k.cursorAt));this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!==this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(k.containment){this._setContainment()}if(k.cursor&&k.cursor!=="auto"){e=this.document.find("body");this.storedCursor=e.css("cursor");e.css("cursor",k.cursor);this.storedStylesheet=b("<style>*{ cursor: "+k.cursor+" !important; }</style>").appendTo(e)}if(k.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",k.opacity)}if(k.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",k.zIndex)}if(this.scrollParent[0]!==document&&this.scrollParent[0].tagName!=="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",h,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!f){for(g=this.containers.length-1;g>=0;g--){this.containers[g]._trigger("activate",h,this._uiHash(this))}}if(b.ui.ddmanager){b.ui.ddmanager.current=this}if(b.ui.ddmanager&&!k.dropBehaviour){b.ui.ddmanager.prepareOffsets(this,h)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(h);return true},_mouseDrag:function(j){var g,h,f,l,k=this.options,e=false;this.position=this._generatePosition(j);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){if(this.scrollParent[0]!==document&&this.scrollParent[0].tagName!=="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-j.pageY<k.scrollSensitivity){this.scrollParent[0].scrollTop=e=this.scrollParent[0].scrollTop+k.scrollSpeed}else{if(j.pageY-this.overflowOffset.top<k.scrollSensitivity){this.scrollParent[0].scrollTop=e=this.scrollParent[0].scrollTop-k.scrollSpeed}}if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-j.pageX<k.scrollSensitivity){this.scrollParent[0].scrollLeft=e=this.scrollParent[0].scrollLeft+k.scrollSpeed}else{if(j.pageX-this.overflowOffset.left<k.scrollSensitivity){this.scrollParent[0].scrollLeft=e=this.scrollParent[0].scrollLeft-k.scrollSpeed}}}else{if(j.pageY-b(document).scrollTop()<k.scrollSensitivity){e=b(document).scrollTop(b(document).scrollTop()-k.scrollSpeed)}else{if(b(window).height()-(j.pageY-b(document).scrollTop())<k.scrollSensitivity){e=b(document).scrollTop(b(document).scrollTop()+k.scrollSpeed)}}if(j.pageX-b(document).scrollLeft()<k.scrollSensitivity){e=b(document).scrollLeft(b(document).scrollLeft()-k.scrollSpeed)}else{if(b(window).width()-(j.pageX-b(document).scrollLeft())<k.scrollSensitivity){e=b(document).scrollLeft(b(document).scrollLeft()+k.scrollSpeed)}}}if(e!==false&&b.ui.ddmanager&&!k.dropBehaviour){b.ui.ddmanager.prepareOffsets(this,j)}}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!=="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!=="x"){this.helper[0].style.top=this.position.top+"px"}for(g=this.items.length-1;g>=0;g--){h=this.items[g];f=h.item[0];l=this._intersectsWithPointer(h);if(!l){continue}if(h.instance!==this.currentContainer){continue}if(f!==this.currentItem[0]&&this.placeholder[l===1?"next":"prev"]()[0]!==f&&!b.contains(this.placeholder[0],f)&&(this.options.type==="semi-dynamic"?!b.contains(this.element[0],f):true)){this.direction=l===1?"down":"up";if(this.options.tolerance==="pointer"||this._intersectsWithSides(h)){this._rearrange(j,h)}else{break}this._trigger("change",j,this._uiHash());break}}this._contactContainers(j);if(b.ui.ddmanager){b.ui.ddmanager.drag(this,j)}this._trigger("sort",j,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(g,i){if(!g){return}if(b.ui.ddmanager&&!this.options.dropBehaviour){b.ui.ddmanager.drop(this,g)}if(this.options.revert){var f=this,j=this.placeholder.offset(),e=this.options.axis,h={};if(!e||e==="x"){h.left=j.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)}if(!e||e==="y"){h.top=j.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)}this.reverting=true;b(this.helper).animate(h,parseInt(this.options.revert,10)||500,function(){f._clear(g)})}else{this._clear(g,i)}return false},cancel:function(){if(this.dragging){this._mouseUp({target:null});if(this.options.helper==="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var e=this.containers.length-1;e>=0;e--){this.containers[e]._trigger("deactivate",null,this._uiHash(this));if(this.containers[e].containerCache.over){this.containers[e]._trigger("out",null,this._uiHash(this));this.containers[e].containerCache.over=0}}}if(this.placeholder){if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!=="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}b.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){b(this.domPosition.prev).after(this.currentItem)}else{b(this.domPosition.parent).prepend(this.currentItem)}}return this},serialize:function(g){var e=this._getItemsAsjQuery(g&&g.connected),f=[];g=g||{};b(e).each(function(){var h=(b(g.item||this).attr(g.attribute||"id")||"").match(g.expression||(/(.+)[\-=_](.+)/));if(h){f.push((g.key||h[1]+"[]")+"="+(g.key&&g.expression?h[1]:h[2]))}});if(!f.length&&g.key){f.push(g.key+"=")}return f.join("&")},toArray:function(g){var e=this._getItemsAsjQuery(g&&g.connected),f=[];g=g||{};e.each(function(){f.push(b(g.item||this).attr(g.attribute||"id")||"")});return f},_intersectsWith:function(o){var g=this.positionAbs.left,f=g+this.helperProportions.width,n=this.positionAbs.top,m=n+this.helperProportions.height,h=o.left,e=h+o.width,p=o.top,k=p+o.height,q=this.offset.click.top,j=this.offset.click.left,i=(n+q)>p&&(n+q)<k&&(g+j)>h&&(g+j)<e;if(this.options.tolerance==="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!=="pointer"&&this.helperProportions[this.floating?"width":"height"]>o[this.floating?"width":"height"])){return i}else{return(h<g+(this.helperProportions.width/2)&&f-(this.helperProportions.width/2)<e&&p<n+(this.helperProportions.height/2)&&m-(this.helperProportions.height/2)<k)}},_intersectsWithPointer:function(g){var h=(this.options.axis==="x")||a(this.positionAbs.top+this.offset.click.top,g.top,g.height),f=(this.options.axis==="y")||a(this.positionAbs.left+this.offset.click.left,g.left,g.width),j=h&&f,e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection();if(!j){return false}return this.floating?(((i&&i==="right")||e==="down")?2:1):(e&&(e==="down"?2:1))},_intersectsWithSides:function(h){var f=a(this.positionAbs.top+this.offset.click.top,h.top+(h.height/2),h.height),g=a(this.positionAbs.left+this.offset.click.left,h.left+(h.width/2),h.width),e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection();if(this.floating&&i){return((i==="right"&&g)||(i==="left"&&!g))}else{return e&&((e==="down"&&f)||(e==="up"&&!f))}},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return e!==0&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return e!==0&&(e>0?"right":"left")},refresh:function(e){this._refreshItems(e);this.refreshPositions();return this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(l){var h,g,n,m,e=[],f=[],k=this._connectWith();if(k&&l){for(h=k.length-1;h>=0;h--){n=b(k[h]);for(g=n.length-1;g>=0;g--){m=b.data(n[g],this.widgetFullName);if(m&&m!==this&&!m.options.disabled){f.push([b.isFunction(m.options.items)?m.options.items.call(m.element):b(m.options.items,m.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),m])}}}}f.push([b.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):b(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(h=f.length-1;h>=0;h--){f[h][0].each(function(){e.push(this)})}return b(e)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=b.grep(this.items,function(g){for(var f=0;f<e.length;f++){if(e[f]===g.item[0]){return false}}return true})},_refreshItems:function(e){this.items=[];this.containers=[this];var k,g,p,l,o,f,r,q,m=this.items,h=[[b.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):b(this.options.items,this.element),this]],n=this._connectWith();if(n&&this.ready){for(k=n.length-1;k>=0;k--){p=b(n[k]);for(g=p.length-1;g>=0;g--){l=b.data(p[g],this.widgetFullName);if(l&&l!==this&&!l.options.disabled){h.push([b.isFunction(l.options.items)?l.options.items.call(l.element[0],e,{item:this.currentItem}):b(l.options.items,l.element),l]);this.containers.push(l)}}}}for(k=h.length-1;k>=0;k--){o=h[k][1];f=h[k][0];for(g=0,q=f.length;g<q;g++){r=b(f[g]);r.data(this.widgetName+"-item",o);m.push({item:r,instance:o,width:0,height:0,left:0,top:0})}}},refreshPositions:function(e){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}var g,h,f,j;for(g=this.items.length-1;g>=0;g--){h=this.items[g];if(h.instance!==this.currentContainer&&this.currentContainer&&h.item[0]!==this.currentItem[0]){continue}f=this.options.toleranceElement?b(this.options.toleranceElement,h.item):h.item;if(h.item.css("display")==="none"){h.width=0;h.height=0}else{h.width=f.outerWidth();h.height=f.outerHeight()}j=f.offset();h.left=j.left;h.top=j.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(g=this.containers.length-1;g>=0;g--){j=this.containers[g].element.offset();this.containers[g].containerCache.left=j.left;this.containers[g].containerCache.top=j.top;this.containers[g].containerCache.width=this.containers[g].element.outerWidth();this.containers[g].containerCache.height=this.containers[g].element.outerHeight()}}return this},_createPlaceholder:function(f){f=f||this;var e,g=f.options;if(!g.placeholder||g.placeholder.constructor===String){e=g.placeholder;g.placeholder={element:function(){var i=f.currentItem[0].nodeName.toLowerCase(),h=b(f.document[0].createElement(i)).addClass(e||f.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");if(i==="tr"){h.append("<td colspan='99'>&#160;</td>")}else{if(i==="img"){h.attr("src",f.currentItem.attr("src"))}}if(!e){h.css("visibility","hidden")}return h},update:function(h,i){if(e&&!g.forcePlaceholderSize){return}if(!i.height()){i.height(f.currentItem.innerHeight()-parseInt(f.currentItem.css("paddingTop")||0,10)-parseInt(f.currentItem.css("paddingBottom")||0,10))}if(!i.width()){i.width(f.currentItem.innerWidth()-parseInt(f.currentItem.css("paddingLeft")||0,10)-parseInt(f.currentItem.css("paddingRight")||0,10))}}}}f.placeholder=b(g.placeholder.element.call(f.element,f.currentItem));f.currentItem.after(f.placeholder);g.placeholder.update(f,f.placeholder)},_contactContainers:function(e){var l,h,p,m,n,r,f,s,k,o,g=null,q=null;for(l=this.containers.length-1;l>=0;l--){if(b.contains(this.currentItem[0],this.containers[l].element[0])){continue}if(this._intersectsWith(this.containers[l].containerCache)){if(g&&b.contains(this.containers[l].element[0],g.element[0])){continue}g=this.containers[l];q=l}else{if(this.containers[l].containerCache.over){this.containers[l]._trigger("out",e,this._uiHash(this));this.containers[l].containerCache.over=0}}}if(!g){return}if(this.containers.length===1){if(!this.containers[q].containerCache.over){this.containers[q]._trigger("over",e,this._uiHash(this));this.containers[q].containerCache.over=1}}else{p=10000;m=null;o=g.floating||c(this.currentItem);n=o?"left":"top";r=o?"width":"height";f=this.positionAbs[n]+this.offset.click[n];for(h=this.items.length-1;h>=0;h--){if(!b.contains(this.containers[q].element[0],this.items[h].item[0])){continue}if(this.items[h].item[0]===this.currentItem[0]){continue}if(o&&!a(this.positionAbs.top+this.offset.click.top,this.items[h].top,this.items[h].height)){continue}s=this.items[h].item.offset()[n];k=false;if(Math.abs(s-f)>Math.abs(s+this.items[h][r]-f)){k=true;s+=this.items[h][r]}if(Math.abs(s-f)<p){p=Math.abs(s-f);m=this.items[h];this.direction=k?"up":"down"}}if(!m&&!this.options.dropOnEmpty){return}if(this.currentContainer===this.containers[q]){return}m?this._rearrange(e,m,null,true):this._rearrange(e,null,this.containers[q].element,true);this._trigger("change",e,this._uiHash());this.containers[q]._trigger("change",e,this._uiHash(this));this.currentContainer=this.containers[q];this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[q]._trigger("over",e,this._uiHash(this));this.containers[q].containerCache.over=1}},_createHelper:function(f){var g=this.options,e=b.isFunction(g.helper)?b(g.helper.apply(this.element[0],[f,this.currentItem])):(g.helper==="clone"?this.currentItem.clone():this.currentItem);if(!e.parents("body").length){b(g.appendTo!=="parent"?g.appendTo:this.currentItem[0].parentNode)[0].appendChild(e[0])}if(e[0]===this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(!e[0].style.width||g.forceHelperSize){e.width(this.currentItem.width())}if(!e[0].style.height||g.forceHelperSize){e.height(this.currentItem.height())}return e},_adjustOffsetFromHelper:function(e){if(typeof e==="string"){e=e.split(" ")}if(b.isArray(e)){e={left:+e[0],top:+e[1]||0}}if("left" in e){this.offset.click.left=e.left+this.margins.left}if("right" in e){this.offset.click.left=this.helperProportions.width-e.right+this.margins.left}if("top" in e){this.offset.click.top=e.top+this.margins.top}if("bottom" in e){this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();if(this.cssPosition==="absolute"&&this.scrollParent[0]!==document&&b.contains(this.scrollParent[0],this.offsetParent[0])){e.left+=this.scrollParent.scrollLeft();e.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]===document.body||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==="html"&&b.ui.ie)){e={top:0,left:0}}return{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition==="relative"){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var f,h,e,g=this.options;if(g.containment==="parent"){g.containment=this.helper[0].parentNode}if(g.containment==="document"||g.containment==="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,b(g.containment==="document"?document:window).width()-this.helperProportions.width-this.margins.left,(b(g.containment==="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(g.containment)){f=b(g.containment)[0];h=b(g.containment).offset();e=(b(f).css("overflow")!=="hidden");this.containment=[h.left+(parseInt(b(f).css("borderLeftWidth"),10)||0)+(parseInt(b(f).css("paddingLeft"),10)||0)-this.margins.left,h.top+(parseInt(b(f).css("borderTopWidth"),10)||0)+(parseInt(b(f).css("paddingTop"),10)||0)-this.margins.top,h.left+(e?Math.max(f.scrollWidth,f.offsetWidth):f.offsetWidth)-(parseInt(b(f).css("borderLeftWidth"),10)||0)-(parseInt(b(f).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,h.top+(e?Math.max(f.scrollHeight,f.offsetHeight):f.offsetHeight)-(parseInt(b(f).css("borderTopWidth"),10)||0)-(parseInt(b(f).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(g,i){if(!i){i=this.position}var f=g==="absolute"?1:-1,e=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==document&&b.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,h=(/(html|body)/i).test(e[0].tagName);return{top:(i.top+this.offset.relative.top*f+this.offset.parent.top*f-((this.cssPosition==="fixed"?-this.scrollParent.scrollTop():(h?0:e.scrollTop()))*f)),left:(i.left+this.offset.relative.left*f+this.offset.parent.left*f-((this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():h?0:e.scrollLeft())*f))}},_generatePosition:function(h){var j,i,k=this.options,g=h.pageX,f=h.pageY,e=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==document&&b.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,l=(/(html|body)/i).test(e[0].tagName);if(this.cssPosition==="relative"&&!(this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}if(this.originalPosition){if(this.containment){if(h.pageX-this.offset.click.left<this.containment[0]){g=this.containment[0]+this.offset.click.left}if(h.pageY-this.offset.click.top<this.containment[1]){f=this.containment[1]+this.offset.click.top}if(h.pageX-this.offset.click.left>this.containment[2]){g=this.containment[2]+this.offset.click.left}if(h.pageY-this.offset.click.top>this.containment[3]){f=this.containment[3]+this.offset.click.top}}if(k.grid){j=this.originalPageY+Math.round((f-this.originalPageY)/k.grid[1])*k.grid[1];f=this.containment?((j-this.offset.click.top>=this.containment[1]&&j-this.offset.click.top<=this.containment[3])?j:((j-this.offset.click.top>=this.containment[1])?j-k.grid[1]:j+k.grid[1])):j;i=this.originalPageX+Math.round((g-this.originalPageX)/k.grid[0])*k.grid[0];g=this.containment?((i-this.offset.click.left>=this.containment[0]&&i-this.offset.click.left<=this.containment[2])?i:((i-this.offset.click.left>=this.containment[0])?i-k.grid[0]:i+k.grid[0])):i}}return{top:(f-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+((this.cssPosition==="fixed"?-this.scrollParent.scrollTop():(l?0:e.scrollTop())))),left:(g-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+((this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():l?0:e.scrollLeft())))}},_rearrange:function(j,h,f,g){f?f[0].appendChild(this.placeholder[0]):h.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction==="down"?h.item[0]:h.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var e=this.counter;this._delay(function(){if(e===this.counter){this.refreshPositions(!g)}})},_clear:function(f,g){this.reverting=false;var e,h=[];if(!this._noFinalSort&&this.currentItem.parent().length){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]===this.currentItem[0]){for(e in this._storedCSS){if(this._storedCSS[e]==="auto"||this._storedCSS[e]==="static"){this._storedCSS[e]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!g){h.push(function(i){this._trigger("receive",i,this._uiHash(this.fromOutside))})}if((this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!g){h.push(function(i){this._trigger("update",i,this._uiHash())})}if(this!==this.currentContainer){if(!g){h.push(function(i){this._trigger("remove",i,this._uiHash())});h.push((function(i){return function(j){i._trigger("receive",j,this._uiHash(this))}}).call(this,this.currentContainer));h.push((function(i){return function(j){i._trigger("update",j,this._uiHash(this))}}).call(this,this.currentContainer))}}for(e=this.containers.length-1;e>=0;e--){if(!g){h.push((function(i){return function(j){i._trigger("deactivate",j,this._uiHash(this))}}).call(this,this.containers[e]))}if(this.containers[e].containerCache.over){h.push((function(i){return function(j){i._trigger("out",j,this._uiHash(this))}}).call(this,this.containers[e]));this.containers[e].containerCache.over=0}}if(this.storedCursor){this.document.find("body").css("cursor",this.storedCursor);this.storedStylesheet.remove()}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex==="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!g){this._trigger("beforeStop",f,this._uiHash());for(e=0;e<h.length;e++){h[e].call(this,f)}this._trigger("stop",f,this._uiHash())}this.fromOutside=false;return false}if(!g){this._trigger("beforeStop",f,this._uiHash())}this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!==this.currentItem[0]){this.helper.remove()}this.helper=null;if(!g){for(e=0;e<h.length;e++){h[e].call(this,f)}this._trigger("stop",f,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){if(b.Widget.prototype._trigger.apply(this,arguments)===false){this.cancel()}},_uiHash:function(e){var f=e||this;return{helper:f.helper,placeholder:f.placeholder||b([]),position:f.position,originalPosition:f.originalPosition,offset:f.positionAbs,item:f.currentItem,sender:e?e.element:null}}})})(jQuery);(function(d){var b=0;function c(f,g){var e=(f.attr("aria-describedby")||"").split(/\s+/);e.push(g);f.data("ui-tooltip-id",g).attr("aria-describedby",d.trim(e.join(" ")))}function a(g){var h=g.data("ui-tooltip-id"),f=(g.attr("aria-describedby")||"").split(/\s+/),e=d.inArray(h,f);if(e!==-1){f.splice(e,1)}g.removeData("ui-tooltip-id");f=d.trim(f.join(" "));if(f){g.attr("aria-describedby",f)}else{g.removeAttr("aria-describedby")}}d.widget("ui.tooltip",{version:"1.10.2",options:{content:function(){var e=d(this).attr("title")||"";return d("<a>").text(e).html()},hide:true,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:true,tooltipClass:null,track:false,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"});this.tooltips={};this.parents={};if(this.options.disabled){this._disable()}},_setOption:function(e,g){var f=this;if(e==="disabled"){this[g?"_disable":"_enable"]();this.options[e]=g;return}this._super(e,g);if(e==="content"){d.each(this.tooltips,function(i,h){f._updateContent(h)})}},_disable:function(){var e=this;d.each(this.tooltips,function(h,f){var g=d.Event("blur");g.target=g.currentTarget=f[0];e.close(g,true)});this.element.find(this.options.items).addBack().each(function(){var f=d(this);if(f.is("[title]")){f.data("ui-tooltip-title",f.attr("title")).attr("title","")}})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var e=d(this);if(e.data("ui-tooltip-title")){e.attr("title",e.data("ui-tooltip-title"))}})},open:function(f){var e=this,g=d(f?f.target:this.element).closest(this.options.items);if(!g.length||g.data("ui-tooltip-id")){return}if(g.attr("title")){g.data("ui-tooltip-title",g.attr("title"))}g.data("ui-tooltip-open",true);if(f&&f.type==="mouseover"){g.parents().each(function(){var i=d(this),h;if(i.data("ui-tooltip-open")){h=d.Event("blur");h.target=h.currentTarget=this;e.close(h,true)}if(i.attr("title")){i.uniqueId();e.parents[this.id]={element:this,title:i.attr("title")};i.attr("title","")}})}this._updateContent(g,f)},_updateContent:function(j,i){var h,e=this.options.content,g=this,f=i?i.type:null;if(typeof e==="string"){return this._open(i,j,e)}h=e.call(j[0],function(k){if(!j.data("ui-tooltip-open")){return}g._delay(function(){if(i){i.type=f}this._open(i,j,k)})});if(h){this._open(i,j,h)}},_open:function(i,k,h){var j,g,f,l=d.extend({},this.options.position);if(!h){return}j=this._find(k);if(j.length){j.find(".ui-tooltip-content").html(h);return}if(k.is("[title]")){if(i&&i.type==="mouseover"){k.attr("title","")}else{k.removeAttr("title")}}j=this._tooltip(k);c(k,j.attr("id"));j.find(".ui-tooltip-content").html(h);function e(m){l.of=m;if(j.is(":hidden")){return}j.position(l)}if(this.options.track&&i&&/^mouse/.test(i.type)){this._on(this.document,{mousemove:e});e(i)}else{j.position(d.extend({of:k},this.options.position))}j.hide();this._show(j,this.options.show);if(this.options.show&&this.options.show.delay){f=this.delayedShow=setInterval(function(){if(j.is(":visible")){e(l.of);clearInterval(f)}},d.fx.interval)}this._trigger("open",i,{tooltip:j});g={keyup:function(m){if(m.keyCode===d.ui.keyCode.ESCAPE){var n=d.Event(m);n.currentTarget=k[0];this.close(n,true)}},remove:function(){this._removeTooltip(j)}};if(!i||i.type==="mouseover"){g.mouseleave="close"}if(!i||i.type==="focusin"){g.focusout="close"}this._on(true,k,g)},close:function(f){var e=this,h=d(f?f.currentTarget:this.element),g=this._find(h);if(this.closing){return}clearInterval(this.delayedShow);if(h.data("ui-tooltip-title")){h.attr("title",h.data("ui-tooltip-title"))}a(h);g.stop(true);this._hide(g,this.options.hide,function(){e._removeTooltip(d(this))});h.removeData("ui-tooltip-open");this._off(h,"mouseleave focusout keyup");if(h[0]!==this.element[0]){this._off(h,"remove")}this._off(this.document,"mousemove");if(f&&f.type==="mouseleave"){d.each(this.parents,function(j,i){d(i.element).attr("title",i.title);delete e.parents[j]})}this.closing=true;this._trigger("close",f,{tooltip:g});this.closing=false},_tooltip:function(e){var g="ui-tooltip-"+b++,f=d("<div>").attr({id:g,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));d("<div>").addClass("ui-tooltip-content").appendTo(f);f.appendTo(this.document[0].body);this.tooltips[g]=e;return f},_find:function(e){var f=e.data("ui-tooltip-id");return f?d("#"+f):d()},_removeTooltip:function(e){e.remove();delete this.tooltips[e.attr("id")]},_destroy:function(){var e=this;d.each(this.tooltips,function(h,f){var g=d.Event("blur");g.target=g.currentTarget=f[0];e.close(g,true);d("#"+h).remove();if(f.data("ui-tooltip-title")){f.attr("title",f.data("ui-tooltip-title"));f.removeData("ui-tooltip-title")}})}})}(jQuery));
 
 
 
 
 
js/lr.js CHANGED
@@ -1 +1 @@
1
- $(function(){var c={},a=false,f;$.each(document.cookie.split(";"),function(h,g){var e=$.trim(g.substr(0,g.indexOf("=")));var j=$.trim(g.substr(g.indexOf("=")+1));c[e]=j});if(typeof(c.at_le)!="undefined"){a=c.at_le;f="login"}else{if(typeof(c.at_re)!="undefined"){a=c.at_re;f="reg"}}if(a!=false){a=unescape(a);var d=$.trim(a.substr(0,a.indexOf("?")));var b=$.trim(a.substr(a.indexOf("?")+1));if(b!="password"&&b!="facebook"&&b!="openid"&&b!="google"&&b!="twitter"){return}if(d!="page"&&d!="get-full"&&d!="get-simple"){return}if(typeof _gaq!="undefined"){_gaq.push(["_trackEvent",f,d,b]);if(document.cookie){document.cookie="at_le=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/;"}if(document.cookie){document.cookie="at_re=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/;"}}}});
1
+ jQuery(function(){var c={},a=false,f;jQuery.each(document.cookie.split(";"),function(h,g){var e=jQuery.trim(g.substr(0,g.indexOf("=")));var j=jQuery.trim(g.substr(g.indexOf("=")+1));c[e]=j});if(typeof(c.at_le)!="undefined"){a=c.at_le;f="login"}else{if(typeof(c.at_re)!="undefined"){a=c.at_re;f="reg"}}if(a!=false){a=unescape(a);var d=jQuery.trim(a.substr(0,a.indexOf("?")));var b=jQuery.trim(a.substr(a.indexOf("?")+1));if(b!="password"&&b!="facebook"&&b!="openid"&&b!="google"&&b!="twitter"){return}if(d!="page"&&d!="get-full"&&d!="get-simple"){return}if(typeof _gaq!="undefined"){_gaq.push(["_trackEvent",f,d,b]);if(document.cookie){document.cookie="at_le=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/;"}if(document.cookie){document.cookie="at_re=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/;"}}}});
js/options-page.32.js CHANGED
@@ -18,76 +18,76 @@
18
  * +--------------------------------------------------------------------------+
19
  */
20
 
21
- jQuery(document).ready(function($) {
22
- $( "#config-error" ).hide();
23
- $( "#share-error" ).hide();
24
- $( "#tabs" ).tabs();
25
- $( "#Card-above-post" ).tabs();
26
- $( "#Card-below-post" ).tabs();
27
- $( "#Card-side-sharing" ).tabs();
28
 
29
  var thickDims, tbWidth, tbHeight, img = '';
30
 
31
  thickDims = function() {
32
- var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
33
 
34
  w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90;
35
  h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60;
36
  if ( tbWindow.size() ) {
37
  tbWindow.width(w).height(h);
38
- $('#TB_iframeContent').width(w).height(h - 27);
39
  tbWindow.css({'margin-left': '-' + parseInt((w / 2),10) + 'px'});
40
  if ( typeof document.body.style.maxWidth != 'undefined' )
41
  tbWindow.css({'top':'30px','margin-top':'0'});
42
  }
43
  };
44
 
45
- $('#addthis_rating_thank_you').hide()
46
- switch($('#addthis_rate_us').val()) {
47
  case 'dislike':
48
- $('#addthis_like_us_answers').hide();
49
- $('#addthis_dislike').show();
50
- $('#addthis_like').hide();
51
  break;
52
  case 'like':
53
- $('#addthis_like_us_answers').hide();
54
- $('#addthis_dislike').hide();
55
- $('#addthis_like').show();
56
  break;
57
  case 'will not rate':
58
  case 'rated':
59
- $('#addthis_do_you_like_us').hide()
60
  break;
61
  default:
62
- $('#addthis_dislike').hide();
63
- $('#addthis_like').hide();
64
  }
65
 
66
- $('#addthis_dislike_confirm').click(function() {
67
- $('#addthis_like_us_answers').hide();
68
- $('#addthis_dislike').show();
69
- $('#addthis_rate_us').val('dislike')
70
  });
71
- $('#addthis_like_confirm').click(function() {
72
- $('#addthis_like_us_answers').hide();
73
- $('#addthis_like').show();
74
- $('#addthis_rate_us').val('like')
75
  });
76
- $('#addthis_not_rating').click(function() {
77
- $('#addthis_do_you_like_us').hide()
78
- $('#addthis_rate_us').val('will not rate')
79
  });
80
- $('#addthis_rating').click(function() {
81
- $('#addthis_rating_thank_you').show()
82
- $('#addthis_rate_us').val('rated')
83
  });
84
 
85
- $('a.thickbox-preview').click( function() {
86
 
87
  var previewLink = this;
88
 
89
  var values = {};
90
- $.each($('#addthis-settings').serializeArray(), function(i, field) {
91
 
92
  var thisName = field.name
93
  if (thisName.indexOf("addthis_settings[") != -1 )
@@ -99,7 +99,7 @@ jQuery(document).ready(function($) {
99
  values[thisName] = field.value;
100
  });
101
 
102
- var stuff = $.param(values, true);
103
 
104
  var data = {
105
  action: 'at_save_transient',
@@ -110,79 +110,79 @@ jQuery(document).ready(function($) {
110
  jQuery.post(ajaxurl, data, function(response) {
111
 
112
  // Fix for WP 2.9's version of lightbox
113
- if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
114
  {
115
  tb_click.call(previewLink);
116
  }
117
- var href = $(previewLink).attr('href');
118
  var link = '';
119
 
120
 
121
  if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
122
  tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
123
  else
124
- tbWidth = $(window).width() - 90;
125
 
126
  if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
127
  tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
128
  else
129
- tbHeight = $(window).height() - 60;
130
 
131
- $('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
132
- $('#TB_closeAjaxWindow').css({'float':'left'});
133
- $('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
134
- $('#TB_iframeContent').width('100%');
135
  thickDims();
136
 
137
  });
138
  return false;
139
  });
140
 
141
- var aboveCustom = $('#above_custom_button');
142
  var aboveCustomShow = function(){
143
  if ( aboveCustom.is(':checked'))
144
  {
145
- $('.above_option_custom').removeClass('hidden');
146
  }
147
  else
148
  {
149
- $('.above_option_custom').addClass('hidden');
150
  }
151
  };
152
 
153
- var belowCustom = $('#below_custom_button');
154
  var belowCustomShow = function(){
155
  if ( belowCustom.is(':checked'))
156
  {
157
- $('.below_option_custom').removeClass('hidden');
158
  }
159
  else
160
  {
161
- $('.below_option_custom').addClass('hidden');
162
  }
163
  };
164
 
165
- var aboveCustomString = $('#above_custom_string');
166
  var aboveCustomStringShow = function(){
167
  if ( aboveCustomString.is(':checked'))
168
  {
169
- $('.above_custom_string_input').removeClass('hidden');
170
  }
171
  else
172
  {
173
- $('.above_custom_string_input').addClass('hidden');
174
  }
175
  };
176
 
177
- var belowCustomString = $('#below_custom_string');
178
  var belowCustomStringShow = function(){
179
  if ( belowCustomString.is(':checked'))
180
  {
181
- $('.below_custom_string_input').removeClass('hidden');
182
  }
183
  else
184
  {
185
- $('.below_custom_string_input').addClass('hidden');
186
  }
187
  };
188
 
@@ -191,8 +191,8 @@ jQuery(document).ready(function($) {
191
  aboveCustomStringShow();
192
  belowCustomStringShow();
193
 
194
- $('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow(); aboveCustomStringShow();} );
195
- $('input[name="addthis_settings[below]"]').change( function(){belowCustomStringShow();} );
196
 
197
  /**
198
  * Hide Theming and branding options when user selects version 3.0 or above
@@ -202,47 +202,47 @@ jQuery(document).ready(function($) {
202
  var MANUAL_UPDATE = -1;
203
  var AUTO_UPDATE = 0;
204
  var REVERTED = 1;
205
- var atVersionUpdateStatus = $("#addthis_atversion_update_status").val();
206
  if (atVersionUpdateStatus == REVERTED) {
207
- $(".classicFeature").show();
208
  } else {
209
- $(".classicFeature").hide();
210
  }
211
 
212
  /**
213
  * Revert to older version after the user upgrades
214
  */
215
- $(".addthis-revert-atversion").click(function(){
216
- $("#addthis_atversion_update_status").val(REVERTED);
217
- $("#addthis_atversion_hidden").val(ATVERSION_250);
218
- $(this).closest("form").submit();
219
  return false;
220
  });
221
  /**
222
  * Update to a newer version
223
  */
224
- $(".addthis-update-atversion").click(function(){
225
- $("#addthis_atversion_update_status").val(MANUAL_UPDATE);
226
- $("#addthis_atversion_hidden").val(AT_VERSION_300);
227
- $(this).closest("form").submit();
228
  return false;
229
  });
230
 
231
- var addthis_credential_validation_status = $("#addthis_credential_validation_status");
232
- var addthis_validation_message = $("#addthis-credential-validation-message");
233
- var addthis_profile_validation_message = $("#addthis-profile-validation-message");
234
  //Validate the Addthis credentials
235
  window.skipValidationInternalError = false;
236
  function validate_addthis_credentials() {
237
- $.ajax(
238
  {"url" : addthis_option_params.wp_ajax_url,
239
  "type" : "post",
240
  "data" : {"action" : addthis_option_params.addthis_validate_action,
241
- "addthis_profile" : $("#addthis_profile").val()
242
  },
243
  "dataType" : "json",
244
  "beforeSend" : function() {
245
- $(".addthis-admin-loader").show();
246
  addthis_validation_message.html("").next().hide();
247
  addthis_profile_validation_message.html("").next().hide();
248
  },
@@ -256,18 +256,18 @@ jQuery(document).ready(function($) {
256
  } else {
257
  window.skipValidationInternalError = true;
258
  }
259
- $("#addthis-settings").submit();
260
  } else {
261
  addthis_validation_message.html(data.credentialmessage);
262
  addthis_profile_validation_message.html(data.profilemessage);
263
  if (data.profilemessage != "") {
264
- $('html, body').animate({"scrollTop":0}, 'slow');
265
  }
266
  }
267
 
268
  },
269
  "complete" :function(data) {
270
- $(".addthis-admin-loader").hide();
271
  },
272
  "error" : function(jqXHR, textStatus, errorThrown) {
273
  console.log(textStatus, errorThrown);
@@ -275,72 +275,101 @@ jQuery(document).ready(function($) {
275
  });
276
  }
277
 
278
- $("#addthis_profile").change(function(){
279
  addthis_credential_validation_status.val(0);
280
- if($.trim($("#addthis_profile").val()) == "") {
281
  addthis_profile_validation_message.next().hide();
282
  }
283
  });
284
 
285
- $('#addthis_config_json').focusout(function() {
286
  var error = 0;
287
- if ($('#addthis_config_json').val() != " ") {
288
  try {
289
- var addthis_config_json = jQuery.parseJSON($('#addthis_config_json').val());
290
  }
291
  catch (e) {
292
- $('#config-error').show();
293
  error = 1;
294
  }
295
  }
296
  if (error == 0) {
297
- $('#config-error').hide();
298
  return true;
299
  } else {
300
- $('#config-error').show();
301
  return false;
302
  }
303
  });
304
 
305
- $('#addthis_share_json').focusout(function() {
306
  var error = 0;
307
- if ($('#addthis_share_json').val() != " ") {
308
  try {
309
- var addthis_share_json = jQuery.parseJSON($('#addthis_share_json').val());
310
  }
311
  catch (e) {
312
- $('#share-error').show();
313
  error = 1;
314
  }
315
  }
316
  if (error == 0) {
317
- $('#share-error').hide();
318
  return true;
319
  } else {
320
- $('#share-error').show();
321
  return false;
322
  }
323
  });
324
 
325
- $('.addthis-submit-button').click(function() {
326
- $('#config-error').hide();
327
- $('#share-error').hide();
328
  var error = 0;
329
- if ($('#addthis-config-json').val() != " ") {
330
  try {
331
- var addthis_config_json = jQuery.parseJSON($('#addthis-config-json').val());
332
  }
333
  catch (e) {
334
- $('#config-error').show();
335
  error = 1;
336
  }
337
  }
338
- if ($('#addthis_share_json').val() != " ") {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  try {
340
- var addthis_share_json = jQuery.parseJSON($('#addthis_share_json').val());
341
  }
342
  catch (e) {
343
- $('#share-error').show();
344
  error = 1;
345
  }
346
  }
@@ -354,7 +383,7 @@ jQuery(document).ready(function($) {
354
 
355
  //preview box
356
  function rewriteServices(posn) {
357
- var services = $('#'+posn+'-chosen-list').val();
358
  var service = services.split(', ');
359
  var i;
360
  var newservice = '';
@@ -386,7 +415,7 @@ jQuery(document).ready(function($) {
386
  }
387
 
388
  function revertServices(posn) {
389
- var services = $('#'+posn+'-chosen-list').val();
390
  var service = services.split(', ');
391
  var i;
392
  var newservice = '';
@@ -417,153 +446,153 @@ jQuery(document).ready(function($) {
417
  return newservices;
418
  }
419
 
420
- if($('#large_toolbox_above').is(':checked')) {
421
- $('.above_button_set').show();
422
- } else if($('#fb_tw_p1_sc_above').is(':checked')) {
423
- $('.above_button_set').show();
424
- } else if($('#small_toolbox_above').is(':checked')) {
425
- $('.above_button_set').show();
426
- } else if($('#button_above').is(':checked')) {
427
- $('.above_button_set').hide();
428
- } else if($('#above_custom_string').is(':checked')) {
429
- $('.above_button_set').hide();
430
  }
431
 
432
- if($('#large_toolbox_below').is(':checked')) {
433
- $('.below_button_set').show();
434
- } else if($('#fb_tw_p1_sc_below').is(':checked')) {
435
- $('.below_button_set').show();
436
- } else if($('#small_toolbox_below').is(':checked')) {
437
- $('.below_button_set').show();
438
- } else if($('#button_below').is(':checked')) {
439
- $('.below_button_set').hide();
440
- } else if($('#below_custom_string').is(':checked')) {
441
- $('.below_button_set').hide();
442
  }
443
 
444
- $("#large_toolbox_above").click( function() {
445
- if($('#above-chosen-list').val() != '') {
446
  var newserv = revertServices('above');
447
- $('#above-chosen-list').val(newserv);
448
  }
449
- $('.above_button_set').show();
450
  });
451
 
452
- $("#large_toolbox_below").click( function() {
453
- if($('#below-chosen-list').val() != '') {
454
  var newserv = revertServices('below');
455
- $('#below-chosen-list').val(newserv);
456
  }
457
- $('.below_button_set').show();
458
  });
459
 
460
- $("#fb_tw_p1_sc_above").click( function() {
461
- if($('#above-chosen-list').val() != '') {
462
  var newserv = rewriteServices('above');
463
- $('#above-chosen-list').val(newserv);
464
  }
465
- $('.above_button_set').show();
466
  });
467
 
468
- $("#fb_tw_p1_sc_below").click( function() {
469
- if($('#below-chosen-list').val() != '') {
470
  var newserv = rewriteServices('below');
471
- $('#below-chosen-list').val(newserv);
472
  }
473
- $('.below_button_set').show();
474
  });
475
 
476
- $("#small_toolbox_above").click( function() {
477
- if($('#above-chosen-list').val() != '') {
478
  var newserv = revertServices('above');
479
- $('#above-chosen-list').val(newserv);
480
  }
481
- $('.above_button_set').show();
482
  });
483
 
484
- $("#small_toolbox_below").click( function() {
485
- if($('#below-chosen-list').val() != '') {
486
  var newserv = revertServices('below');
487
- $('#below-chosen-list').val(newserv);
488
  }
489
- $('.below_button_set').show();
490
  });
491
 
492
- $("#button_above").click( function() {
493
- $('.above_button_set').show();
494
  });
495
 
496
- $("#above_custom_string").click( function() {
497
- if($(this).is(':checked')){
498
- $('.above_button_set').hide();
499
  } else {
500
- $('.above_button_set').show();
501
  }
502
  });
503
 
504
- $("#button_below").click( function() {
505
- $('.below_button_set').show();
506
  });
507
 
508
- $("#below_custom_string").click( function() {
509
- if($(this).is(':checked')){
510
- $('.below_button_set').hide();
511
  } else {
512
- $('.below_button_set').show();
513
  }
514
  });
515
 
516
- $('.addthis-submit-button').click(function() {
517
- if($('#above-disable-smart-sharing').is(':checked')) {
518
- if($('#button_above').is(':checked')) {
519
- $('#above-chosen-list').val('');
520
  } else {
521
  var list = [];
522
- $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
523
  var service = '';
524
- $(this).find('li').each(function(){
525
- if($(this).hasClass('enabled')) {
526
- list.push($(this).attr('data-service'));
527
- if($(this).attr('data-service') == 'compact') {
528
  list.push('counter');
529
  }
530
  }
531
  });
532
  });
533
  var aboveservices = list.join(', ');
534
- $('#above-chosen-list').val(aboveservices);
535
  }
536
  }
537
- if($('#button_above').is(':checked')) {
538
- $('#above-chosen-list').val('');
539
  }
540
 
541
- if($('#below-disable-smart-sharing').is(':checked')) {
542
- if($('#button_below').is(':checked')) {
543
- $('#below-chosen-list').val('');
544
  } else {
545
  var list = [];
546
- $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
547
  var service = '';
548
- $(this).find('li').each(function(){
549
- if($(this).hasClass('enabled')) {
550
- list.push($(this).attr('data-service'));
551
- if($(this).attr('data-service') == 'compact') {
552
  list.push('counter');
553
  }
554
  }
555
  });
556
  });
557
  var belowservices = list.join(', ');
558
- $('#below-chosen-list').val(belowservices);
559
  }
560
  }
561
- if($('#button_below').is(':checked')) {
562
- $('#below-chosen-list').val('');
563
  }
564
 
565
- if($("#tabs .ui-state-active > a").html() == "Mode") {
566
- $( "#tabs" ).tabs("option", "active", 0);
567
  }
568
 
569
  });
@@ -576,34 +605,34 @@ jQuery(document).ready(function($) {
576
  var popoverHeight = 0;
577
  var parent;
578
  var me;
579
- $('.row-right a').mouseover(function(){
580
- me = $(this);
581
- parent = $(me).parent();
582
 
583
- dataContent = $(parent).attr('data-content');
584
- dataTitle = $(parent).attr('data-original-title');
585
  innerContent = "<div class='popover fade right in' style='display: block;'><div class='arrow'></div><h3 class='popover-title'>";
586
  innerContent = innerContent + dataTitle;
587
  innerContent = innerContent + "</h3><div class='popover-content'>";
588
  innerContent = innerContent + dataContent;
589
  innerContent = innerContent + "</div></div>";
590
- $(parent).append(innerContent);
591
 
592
- popoverHeight = $(parent).find('.popover').height();
593
- left = $(me).position().left + 15;
594
- top = $(me).position().top - (popoverHeight/2) + 8;
595
 
596
- $(parent).find('.popover').css({
597
  'left': left+'px',
598
  'top': top+'px'
599
  });
600
  });
601
- $('.row-right a').mouseout(function(){
602
- $('.popover').remove();
603
  });
604
 
605
  //Keep the user in current tab
606
- $(function() {
607
  var index = 'key';
608
  var dataStore = window.sessionStorage;
609
  try {
@@ -611,7 +640,7 @@ jQuery(document).ready(function($) {
611
  } catch(e) {
612
  var oldIndex = 0;
613
  }
614
- $('#tabs').tabs({
615
  active : oldIndex,
616
  activate : function( event, ui ){
617
  var newIndex = ui.newTab.parent().children().index(ui.newTab);
@@ -621,38 +650,38 @@ jQuery(document).ready(function($) {
621
  });
622
 
623
  //Setting checkbox checked
624
- $('.addthis-switch').click(function()
625
  {
626
- $(this).toggleClass("addthis-switchOn");
627
- var id = $(this).attr('id').replace('_switch','');
628
- if($('#'+id).attr('checked')){
629
- $('#'+id).prop('checked', false);
630
- $("."+id+'_overlay').css('pointer-events', 'none');
631
- $("."+id+'_overlay').css('opacity', '0.5');
632
  } else {
633
- $('#'+id).prop('checked', true);
634
- $("."+id+'_overlay').css('opacity', '1');
635
- $("."+id+'_overlay').css('pointer-events', 'auto');
636
  }
637
  });
638
 
639
  //Default overlay - disabled tools
640
- $('.addthis-toggle-cb').each(function() {
641
- var id = $(this).attr('id');
642
- if(!$('#'+id).attr('checked')){
643
- $("."+id+'_overlay').css('pointer-events', 'none');
644
- $("."+id+'_overlay').css('opacity', '0.5');
645
  }
646
  });
647
 
648
  //Show sidebar preview based on the user selected
649
- $('[id^=sbpreview_]').hide();
650
- var current_sbpreview_id = "sbpreview_"+$('#addthis_sidebar_theme').val();
651
- $('#'+current_sbpreview_id).show();
652
- $('#addthis_sidebar_theme').on('change', function() {
653
- var preview_id = "sbpreview_"+$('#addthis_sidebar_theme option:selected').val();
654
- $('[id^=sbpreview_]').hide();
655
- $('#'+preview_id).show();
656
  });
657
 
658
  });
18
  * +--------------------------------------------------------------------------+
19
  */
20
 
21
+ jQuery(document).ready(function(jQuery) {
22
+ jQuery( "#config-error" ).hide();
23
+ jQuery( "#share-error" ).hide();
24
+ jQuery( "#tabs" ).tabs();
25
+ jQuery( "#Card-above-post" ).tabs();
26
+ jQuery( "#Card-below-post" ).tabs();
27
+ jQuery( "#Card-side-sharing" ).tabs();
28
 
29
  var thickDims, tbWidth, tbHeight, img = '';
30
 
31
  thickDims = function() {
32
+ var tbWindow = jQuery('#TB_window'), H = jQuery(window).height(), W = jQuery(window).width(), w, h;
33
 
34
  w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90;
35
  h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60;
36
  if ( tbWindow.size() ) {
37
  tbWindow.width(w).height(h);
38
+ jQuery('#TB_iframeContent').width(w).height(h - 27);
39
  tbWindow.css({'margin-left': '-' + parseInt((w / 2),10) + 'px'});
40
  if ( typeof document.body.style.maxWidth != 'undefined' )
41
  tbWindow.css({'top':'30px','margin-top':'0'});
42
  }
43
  };
44
 
45
+ jQuery('#addthis_rating_thank_you').hide()
46
+ switch(jQuery('#addthis_rate_us').val()) {
47
  case 'dislike':
48
+ jQuery('#addthis_like_us_answers').hide();
49
+ jQuery('#addthis_dislike').show();
50
+ jQuery('#addthis_like').hide();
51
  break;
52
  case 'like':
53
+ jQuery('#addthis_like_us_answers').hide();
54
+ jQuery('#addthis_dislike').hide();
55
+ jQuery('#addthis_like').show();
56
  break;
57
  case 'will not rate':
58
  case 'rated':
59
+ jQuery('#addthis_do_you_like_us').hide()
60
  break;
61
  default:
62
+ jQuery('#addthis_dislike').hide();
63
+ jQuery('#addthis_like').hide();
64
  }
65
 
66
+ jQuery('#addthis_dislike_confirm').click(function() {
67
+ jQuery('#addthis_like_us_answers').hide();
68
+ jQuery('#addthis_dislike').show();
69
+ jQuery('#addthis_rate_us').val('dislike')
70
  });
71
+ jQuery('#addthis_like_confirm').click(function() {
72
+ jQuery('#addthis_like_us_answers').hide();
73
+ jQuery('#addthis_like').show();
74
+ jQuery('#addthis_rate_us').val('like')
75
  });
76
+ jQuery('#addthis_not_rating').click(function() {
77
+ jQuery('#addthis_do_you_like_us').hide()
78
+ jQuery('#addthis_rate_us').val('will not rate')
79
  });
80
+ jQuery('#addthis_rating').click(function() {
81
+ jQuery('#addthis_rating_thank_you').show()
82
+ jQuery('#addthis_rate_us').val('rated')
83
  });
84
 
85
+ jQuery('a.thickbox-preview').click( function() {
86
 
87
  var previewLink = this;
88
 
89
  var values = {};
90
+ jQuery.each(jQuery('#addthis-settings').serializeArray(), function(i, field) {
91
 
92
  var thisName = field.name
93
  if (thisName.indexOf("addthis_settings[") != -1 )
99
  values[thisName] = field.value;
100
  });
101
 
102
+ var stuff = jQuery.param(values, true);
103
 
104
  var data = {
105
  action: 'at_save_transient',
110
  jQuery.post(ajaxurl, data, function(response) {
111
 
112
  // Fix for WP 2.9's version of lightbox
113
+ if ( typeof tb_click != 'undefined' && jQuery.isFunction(tb_click.call))
114
  {
115
  tb_click.call(previewLink);
116
  }
117
+ var href = jQuery(previewLink).attr('href');
118
  var link = '';
119
 
120
 
121
  if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
122
  tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
123
  else
124
+ tbWidth = jQuery(window).width() - 90;
125
 
126
  if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
127
  tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
128
  else
129
+ tbHeight = jQuery(window).height() - 60;
130
 
131
+ jQuery('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
132
+ jQuery('#TB_closeAjaxWindow').css({'float':'left'});
133
+ jQuery('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
134
+ jQuery('#TB_iframeContent').width('100%');
135
  thickDims();
136
 
137
  });
138
  return false;
139
  });
140
 
141
+ var aboveCustom = jQuery('#above_custom_button');
142
  var aboveCustomShow = function(){
143
  if ( aboveCustom.is(':checked'))
144
  {
145
+ jQuery('.above_option_custom').removeClass('hidden');
146
  }
147
  else
148
  {
149
+ jQuery('.above_option_custom').addClass('hidden');
150
  }
151
  };
152
 
153
+ var belowCustom = jQuery('#below_custom_button');
154
  var belowCustomShow = function(){
155
  if ( belowCustom.is(':checked'))
156
  {
157
+ jQuery('.below_option_custom').removeClass('hidden');
158
  }
159
  else
160
  {
161
+ jQuery('.below_option_custom').addClass('hidden');
162
  }
163
  };
164
 
165
+ var aboveCustomString = jQuery('#above_custom_string');
166
  var aboveCustomStringShow = function(){
167
  if ( aboveCustomString.is(':checked'))
168
  {
169
+ jQuery('.above_custom_string_input').removeClass('hidden');
170
  }
171
  else
172
  {
173
+ jQuery('.above_custom_string_input').addClass('hidden');
174
  }
175
  };
176
 
177
+ var belowCustomString = jQuery('#below_custom_string');
178
  var belowCustomStringShow = function(){
179
  if ( belowCustomString.is(':checked'))
180
  {
181
+ jQuery('.below_custom_string_input').removeClass('hidden');
182
  }
183
  else
184
  {
185
+ jQuery('.below_custom_string_input').addClass('hidden');
186
  }
187
  };
188
 
191
  aboveCustomStringShow();
192
  belowCustomStringShow();
193
 
194
+ jQuery('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow(); aboveCustomStringShow();} );
195
+ jQuery('input[name="addthis_settings[below]"]').change( function(){belowCustomStringShow();} );
196
 
197
  /**
198
  * Hide Theming and branding options when user selects version 3.0 or above
202
  var MANUAL_UPDATE = -1;
203
  var AUTO_UPDATE = 0;
204
  var REVERTED = 1;
205
+ var atVersionUpdateStatus = jQuery("#addthis_atversion_update_status").val();
206
  if (atVersionUpdateStatus == REVERTED) {
207
+ jQuery(".classicFeature").show();
208
  } else {
209
+ jQuery(".classicFeature").hide();
210
  }
211
 
212
  /**
213
  * Revert to older version after the user upgrades
214
  */
215
+ jQuery(".addthis-revert-atversion").click(function(){
216
+ jQuery("#addthis_atversion_update_status").val(REVERTED);
217
+ jQuery("#addthis_atversion_hidden").val(ATVERSION_250);
218
+ jQuery(this).closest("form").submit();
219
  return false;
220
  });
221
  /**
222
  * Update to a newer version
223
  */
224
+ jQuery(".addthis-update-atversion").click(function(){
225
+ jQuery("#addthis_atversion_update_status").val(MANUAL_UPDATE);
226
+ jQuery("#addthis_atversion_hidden").val(AT_VERSION_300);
227
+ jQuery(this).closest("form").submit();
228
  return false;
229
  });
230
 
231
+ var addthis_credential_validation_status = jQuery("#addthis_credential_validation_status");
232
+ var addthis_validation_message = jQuery("#addthis-credential-validation-message");
233
+ var addthis_profile_validation_message = jQuery("#addthis-profile-validation-message");
234
  //Validate the Addthis credentials
235
  window.skipValidationInternalError = false;
236
  function validate_addthis_credentials() {
237
+ jQuery.ajax(
238
  {"url" : addthis_option_params.wp_ajax_url,
239
  "type" : "post",
240
  "data" : {"action" : addthis_option_params.addthis_validate_action,
241
+ "addthis_profile" : jQuery("#addthis_profile").val()
242
  },
243
  "dataType" : "json",
244
  "beforeSend" : function() {
245
+ jQuery(".addthis-admin-loader").show();
246
  addthis_validation_message.html("").next().hide();
247
  addthis_profile_validation_message.html("").next().hide();
248
  },
256
  } else {
257
  window.skipValidationInternalError = true;
258
  }
259
+ jQuery("#addthis-settings").submit();
260
  } else {
261
  addthis_validation_message.html(data.credentialmessage);
262
  addthis_profile_validation_message.html(data.profilemessage);
263
  if (data.profilemessage != "") {
264
+ jQuery('html, body').animate({"scrollTop":0}, 'slow');
265
  }
266
  }
267
 
268
  },
269
  "complete" :function(data) {
270
+ jQuery(".addthis-admin-loader").hide();
271
  },
272
  "error" : function(jqXHR, textStatus, errorThrown) {
273
  console.log(textStatus, errorThrown);
275
  });
276
  }
277
 
278
+ jQuery("#addthis_profile").change(function(){
279
  addthis_credential_validation_status.val(0);
280
+ if(jQuery.trim(jQuery("#addthis_profile").val()) == "") {
281
  addthis_profile_validation_message.next().hide();
282
  }
283
  });
284
 
285
+ jQuery('#addthis_config_json').focusout(function() {
286
  var error = 0;
287
+ if (jQuery('#addthis_config_json').val() != " ") {
288
  try {
289
+ var addthis_config_json = jQuery.parseJSON(jQuery('#addthis_config_json').val());
290
  }
291
  catch (e) {
292
+ jQuery('#config-error').show();
293
  error = 1;
294
  }
295
  }
296
  if (error == 0) {
297
+ jQuery('#config-error').hide();
298
  return true;
299
  } else {
300
+ jQuery('#config-error').show();
301
  return false;
302
  }
303
  });
304
 
305
+ jQuery('#addthis_share_json').focusout(function() {
306
  var error = 0;
307
+ if (jQuery('#addthis_share_json').val() != " ") {
308
  try {
309
+ var addthis_share_json = jQuery.parseJSON(jQuery('#addthis_share_json').val());
310
  }
311
  catch (e) {
312
+ jQuery('#share-error').show();
313
  error = 1;
314
  }
315
  }
316
  if (error == 0) {
317
+ jQuery('#share-error').hide();
318
  return true;
319
  } else {
320
+ jQuery('#share-error').show();
321
  return false;
322
  }
323
  });
324
 
325
+ jQuery('#addthis_layers_json').focusout(function() {
 
 
326
  var error = 0;
327
+ if (jQuery('#addthis_layers_json').val() != " ") {
328
  try {
329
+ var addthis_layers_json = jQuery.parseJSON(jQuery('#addthis_layers_json').val());
330
  }
331
  catch (e) {
332
+ jQuery('#layers-error').show();
333
  error = 1;
334
  }
335
  }
336
+ if (error == 0) {
337
+ jQuery('#layers-error').hide();
338
+ return true;
339
+ } else {
340
+ jQuery('#layers-error').show();
341
+ return false;
342
+ }
343
+ });
344
+
345
+ jQuery('.addthis-submit-button').click(function() {
346
+ jQuery('#config-error').hide();
347
+ jQuery('#share-error').hide();
348
+ var error = 0;
349
+ if (jQuery('#addthis_config_json').val() != " ") {
350
+ try {
351
+ var addthis_config_json = jQuery.parseJSON(jQuery('#addthis_config_json').val());
352
+ }
353
+ catch (e) {
354
+ jQuery('#config-error').show();
355
+ error = 1;
356
+ }
357
+ }
358
+ if (jQuery('#addthis_share_json').val() != " ") {
359
+ try {
360
+ var addthis_share_json = jQuery.parseJSON(jQuery('#addthis_share_json').val());
361
+ }
362
+ catch (e) {
363
+ jQuery('#share-error').show();
364
+ error = 1;
365
+ }
366
+ }
367
+ if (jQuery('#addthis_layers_json').val() != " ") {
368
  try {
369
+ var addthis_layers_json = jQuery.parseJSON(jQuery('#addthis_layers_json').val());
370
  }
371
  catch (e) {
372
+ jQuery('#layers-error').show();
373
  error = 1;
374
  }
375
  }
383
 
384
  //preview box
385
  function rewriteServices(posn) {
386
+ var services = jQuery('#'+posn+'-chosen-list').val();
387
  var service = services.split(', ');
388
  var i;
389
  var newservice = '';
415
  }
416
 
417
  function revertServices(posn) {
418
+ var services = jQuery('#'+posn+'-chosen-list').val();
419
  var service = services.split(', ');
420
  var i;
421
  var newservice = '';
446
  return newservices;
447
  }
448
 
449
+ if(jQuery('#large_toolbox_above').is(':checked')) {
450
+ jQuery('.above_button_set').show();
451
+ } else if(jQuery('#fb_tw_p1_sc_above').is(':checked')) {
452
+ jQuery('.above_button_set').show();
453
+ } else if(jQuery('#small_toolbox_above').is(':checked')) {
454
+ jQuery('.above_button_set').show();
455
+ } else if(jQuery('#button_above').is(':checked')) {
456
+ jQuery('.above_button_set').hide();
457
+ } else if(jQuery('#above_custom_string').is(':checked')) {
458
+ jQuery('.above_button_set').hide();
459
  }
460
 
461
+ if(jQuery('#large_toolbox_below').is(':checked')) {
462
+ jQuery('.below_button_set').show();
463
+ } else if(jQuery('#fb_tw_p1_sc_below').is(':checked')) {
464
+ jQuery('.below_button_set').show();
465
+ } else if(jQuery('#small_toolbox_below').is(':checked')) {
466
+ jQuery('.below_button_set').show();
467
+ } else if(jQuery('#button_below').is(':checked')) {
468
+ jQuery('.below_button_set').hide();
469
+ } else if(jQuery('#below_custom_string').is(':checked')) {
470
+ jQuery('.below_button_set').hide();
471
  }
472
 
473
+ jQuery("#large_toolbox_above").click( function() {
474
+ if(jQuery('#above-chosen-list').val() != '') {
475
  var newserv = revertServices('above');
476
+ jQuery('#above-chosen-list').val(newserv);
477
  }
478
+ jQuery('.above_button_set').show();
479
  });
480
 
481
+ jQuery("#large_toolbox_below").click( function() {
482
+ if(jQuery('#below-chosen-list').val() != '') {
483
  var newserv = revertServices('below');
484
+ jQuery('#below-chosen-list').val(newserv);
485
  }
486
+ jQuery('.below_button_set').show();
487
  });
488
 
489
+ jQuery("#fb_tw_p1_sc_above").click( function() {
490
+ if(jQuery('#above-chosen-list').val() != '') {
491
  var newserv = rewriteServices('above');
492
+ jQuery('#above-chosen-list').val(newserv);
493
  }
494
+ jQuery('.above_button_set').show();
495
  });
496
 
497
+ jQuery("#fb_tw_p1_sc_below").click( function() {
498
+ if(jQuery('#below-chosen-list').val() != '') {
499
  var newserv = rewriteServices('below');
500
+ jQuery('#below-chosen-list').val(newserv);
501
  }
502
+ jQuery('.below_button_set').show();
503
  });
504
 
505
+ jQuery("#small_toolbox_above").click( function() {
506
+ if(jQuery('#above-chosen-list').val() != '') {
507
  var newserv = revertServices('above');
508
+ jQuery('#above-chosen-list').val(newserv);
509
  }
510
+ jQuery('.above_button_set').show();
511
  });
512
 
513
+ jQuery("#small_toolbox_below").click( function() {
514
+ if(jQuery('#below-chosen-list').val() != '') {
515
  var newserv = revertServices('below');
516
+ jQuery('#below-chosen-list').val(newserv);
517
  }
518
+ jQuery('.below_button_set').show();
519
  });
520
 
521
+ jQuery("#button_above").click( function() {
522
+ jQuery('.above_button_set').show();
523
  });
524
 
525
+ jQuery("#above_custom_string").click( function() {
526
+ if(jQuery(this).is(':checked')){
527
+ jQuery('.above_button_set').hide();
528
  } else {
529
+ jQuery('.above_button_set').show();
530
  }
531
  });
532
 
533
+ jQuery("#button_below").click( function() {
534
+ jQuery('.below_button_set').show();
535
  });
536
 
537
+ jQuery("#below_custom_string").click( function() {
538
+ if(jQuery(this).is(':checked')){
539
+ jQuery('.below_button_set').hide();
540
  } else {
541
+ jQuery('.below_button_set').show();
542
  }
543
  });
544
 
545
+ jQuery('.addthis-submit-button').click(function() {
546
+ if(jQuery('#above-disable-smart-sharing').is(':checked')) {
547
+ if(jQuery('#button_above').is(':checked')) {
548
+ jQuery('#above-chosen-list').val('');
549
  } else {
550
  var list = [];
551
+ jQuery('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
552
  var service = '';
553
+ jQuery(this).find('li').each(function(){
554
+ if(jQuery(this).hasClass('enabled')) {
555
+ list.push(jQuery(this).attr('data-service'));
556
+ if(jQuery(this).attr('data-service') == 'compact') {
557
  list.push('counter');
558
  }
559
  }
560
  });
561
  });
562
  var aboveservices = list.join(', ');
563
+ jQuery('#above-chosen-list').val(aboveservices);
564
  }
565
  }
566
+ if(jQuery('#button_above').is(':checked')) {
567
+ jQuery('#above-chosen-list').val('');
568
  }
569
 
570
+ if(jQuery('#below-disable-smart-sharing').is(':checked')) {
571
+ if(jQuery('#button_below').is(':checked')) {
572
+ jQuery('#below-chosen-list').val('');
573
  } else {
574
  var list = [];
575
+ jQuery('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
576
  var service = '';
577
+ jQuery(this).find('li').each(function(){
578
+ if(jQuery(this).hasClass('enabled')) {
579
+ list.push(jQuery(this).attr('data-service'));
580
+ if(jQuery(this).attr('data-service') == 'compact') {
581
  list.push('counter');
582
  }
583
  }
584
  });
585
  });
586
  var belowservices = list.join(', ');
587
+ jQuery('#below-chosen-list').val(belowservices);
588
  }
589
  }
590
+ if(jQuery('#button_below').is(':checked')) {
591
+ jQuery('#below-chosen-list').val('');
592
  }
593
 
594
+ if(jQuery("#tabs .ui-state-active > a").html() == "Mode") {
595
+ jQuery( "#tabs" ).tabs("option", "active", 0);
596
  }
597
 
598
  });
605
  var popoverHeight = 0;
606
  var parent;
607
  var me;
608
+ jQuery('.row-right a').mouseover(function(){
609
+ me = jQuery(this);
610
+ parent = jQuery(me).parent();
611
 
612
+ dataContent = jQuery(parent).attr('data-content');
613
+ dataTitle = jQuery(parent).attr('data-original-title');
614
  innerContent = "<div class='popover fade right in' style='display: block;'><div class='arrow'></div><h3 class='popover-title'>";
615
  innerContent = innerContent + dataTitle;
616
  innerContent = innerContent + "</h3><div class='popover-content'>";
617
  innerContent = innerContent + dataContent;
618
  innerContent = innerContent + "</div></div>";
619
+ jQuery(parent).append(innerContent);
620
 
621
+ popoverHeight = jQuery(parent).find('.popover').height();
622
+ left = jQuery(me).position().left + 15;
623
+ top = jQuery(me).position().top - (popoverHeight/2) + 8;
624
 
625
+ jQuery(parent).find('.popover').css({
626
  'left': left+'px',
627
  'top': top+'px'
628
  });
629
  });
630
+ jQuery('.row-right a').mouseout(function(){
631
+ jQuery('.popover').remove();
632
  });
633
 
634
  //Keep the user in current tab
635
+ jQuery(function() {
636
  var index = 'key';
637
  var dataStore = window.sessionStorage;
638
  try {
640
  } catch(e) {
641
  var oldIndex = 0;
642
  }
643
+ jQuery('#tabs').tabs({
644
  active : oldIndex,
645
  activate : function( event, ui ){
646
  var newIndex = ui.newTab.parent().children().index(ui.newTab);
650
  });
651
 
652
  //Setting checkbox checked
653
+ jQuery('.addthis-switch').click(function()
654
  {
655
+ jQuery(this).toggleClass("addthis-switchOn");
656
+ var id = jQuery(this).attr('id').replace('_switch','');
657
+ if(jQuery('#'+id).attr('checked')){
658
+ jQuery('#'+id).prop('checked', false);
659
+ jQuery("."+id+'_overlay').css('pointer-events', 'none');
660
+ jQuery("."+id+'_overlay').css('opacity', '0.5');
661
  } else {
662
+ jQuery('#'+id).prop('checked', true);
663
+ jQuery("."+id+'_overlay').css('opacity', '1');
664
+ jQuery("."+id+'_overlay').css('pointer-events', 'auto');
665
  }
666
  });
667
 
668
  //Default overlay - disabled tools
669
+ jQuery('.addthis-toggle-cb').each(function() {
670
+ var id = jQuery(this).attr('id');
671
+ if(!jQuery('#'+id).attr('checked')){
672
+ jQuery("."+id+'_overlay').css('pointer-events', 'none');
673
+ jQuery("."+id+'_overlay').css('opacity', '0.5');
674
  }
675
  });
676
 
677
  //Show sidebar preview based on the user selected
678
+ jQuery('[id^=sbpreview_]').hide();
679
+ var current_sbpreview_id = "sbpreview_"+jQuery('#addthis_sidebar_theme').val();
680
+ jQuery('#'+current_sbpreview_id).show();
681
+ jQuery('#addthis_sidebar_theme').on('change', function() {
682
+ var preview_id = "sbpreview_"+jQuery('#addthis_sidebar_theme option:selected').val();
683
+ jQuery('[id^=sbpreview_]').hide();
684
+ jQuery('#'+preview_id).show();
685
  });
686
 
687
  });
js/options-page.js CHANGED
@@ -18,74 +18,74 @@
18
  * +--------------------------------------------------------------------------+
19
  */
20
 
21
- jQuery(document).ready(function($) {
22
- $( "#config-error" ).hide();
23
- $( "#share-error" ).hide();
24
- $( "#tabs" ).tabs();
25
 
26
  var thickDims, tbWidth, tbHeight, img = '';
27
 
28
  thickDims = function() {
29
- var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
30
 
31
  w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90;
32
  h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60;
33
  if ( tbWindow.size() ) {
34
  tbWindow.width(w).height(h);
35
- $('#TB_iframeContent').width(w).height(h - 27);
36
  tbWindow.css({'margin-left': '-' + parseInt((w / 2),10) + 'px'});
37
  if ( typeof document.body.style.maxWidth != 'undefined' )
38
  tbWindow.css({'top':'30px','margin-top':'0'});
39
  }
40
  };
41
 
42
- $('#addthis_rating_thank_you').hide()
43
 
44
- switch($('#addthis_rate_us').val()) {
45
  case 'dislike':
46
- $('#addthis_like_us_answers').hide();
47
- $('#addthis_dislike').show();
48
- $('#addthis_like').hide();
49
  break;
50
  case 'like':
51
- $('#addthis_like_us_answers').hide();
52
- $('#addthis_dislike').hide();
53
- $('#addthis_like').show();
54
  break;
55
  case 'will not rate':
56
  case 'rated':
57
- $('#addthis_do_you_like_us').hide()
58
  break;
59
  default:
60
- $('#addthis_dislike').hide();
61
- $('#addthis_like').hide();
62
  }
63
 
64
- $('#addthis_dislike_confirm').click(function() {
65
- $('#addthis_like_us_answers').hide();
66
- $('#addthis_dislike').show();
67
- $('#addthis_rate_us').val('dislike')
68
  });
69
- $('#addthis_like_confirm').click(function() {
70
- $('#addthis_like_us_answers').hide();
71
- $('#addthis_like').show();
72
- $('#addthis_rate_us').val('like')
73
  });
74
- $('#addthis_not_rating').click(function() {
75
- $('#addthis_do_you_like_us').hide()
76
- $('#addthis_rate_us').val('will not rate')
77
  });
78
- $('#addthis_rating').click(function() {
79
- $('#addthis_rating_thank_you').show()
80
- $('#addthis_rate_us').val('rated')
81
  });
82
 
83
- $('a.thickbox-preview').click( function() {
84
 
85
  var previewLink = this;
86
 
87
  var values = {};
88
- $.each($('#addthis-settings').serializeArray(), function(i, field) {
89
 
90
  var thisName = field.name
91
  if (thisName.indexOf("addthis_settings[") != -1 )
@@ -97,7 +97,7 @@ jQuery(document).ready(function($) {
97
  values[thisName] = field.value;
98
  });
99
 
100
- var stuff = $.param(values, true);
101
 
102
  var data = {
103
  action: 'at_save_transient',
@@ -108,79 +108,79 @@ jQuery(document).ready(function($) {
108
  jQuery.post(ajaxurl, data, function(response) {
109
 
110
  // Fix for WP 2.9's version of lightbox
111
- if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
112
  {
113
  tb_click.call(previewLink);
114
  }
115
- var href = $(previewLink).attr('href');
116
  var link = '';
117
 
118
 
119
  if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
120
  tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
121
  else
122
- tbWidth = $(window).width() - 90;
123
 
124
  if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
125
  tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
126
  else
127
- tbHeight = $(window).height() - 60;
128
 
129
- $('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
130
- $('#TB_closeAjaxWindow').css({'float':'left'});
131
- $('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
132
- $('#TB_iframeContent').width('100%');
133
  thickDims();
134
 
135
  });
136
  return false;
137
  });
138
 
139
- var aboveCustom = $('#above_custom_button');
140
  var aboveCustomShow = function(){
141
  if ( aboveCustom.is(':checked'))
142
  {
143
- $('.above_option_custom').removeClass('hidden');
144
  }
145
  else
146
  {
147
- $('.above_option_custom').addClass('hidden');
148
  }
149
  };
150
 
151
- var belowCustom = $('#below_custom_button');
152
  var belowCustomShow = function(){
153
  if ( belowCustom.is(':checked'))
154
  {
155
- $('.below_option_custom').removeClass('hidden');
156
  }
157
  else
158
  {
159
- $('.below_option_custom').addClass('hidden');
160
  }
161
  };
162
 
163
- var aboveCustomString = $('#above_custom_string');
164
  var aboveCustomStringShow = function(){
165
  if ( aboveCustomString.is(':checked'))
166
  {
167
- $('.above_custom_string_input').removeClass('hidden');
168
  }
169
  else
170
  {
171
- $('.above_custom_string_input').addClass('hidden');
172
  }
173
  };
174
 
175
- var belowCustomString = $('#below_custom_string');
176
  var belowCustomStringShow = function(){
177
  if ( belowCustomString.is(':checked'))
178
  {
179
- $('.below_custom_string_input').removeClass('hidden');
180
  }
181
  else
182
  {
183
- $('.below_custom_string_input').addClass('hidden');
184
  }
185
  };
186
 
@@ -189,8 +189,8 @@ jQuery(document).ready(function($) {
189
  aboveCustomStringShow();
190
  belowCustomStringShow();
191
 
192
- $('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow(); aboveCustomStringShow();} );
193
- $('input[name="addthis_settings[below]"]').change( function(){belowCustomStringShow();} );
194
 
195
  /**
196
  * Hide Theming and branding options when user selects version 3.0 or above
@@ -200,47 +200,47 @@ jQuery(document).ready(function($) {
200
  var MANUAL_UPDATE = -1;
201
  var AUTO_UPDATE = 0;
202
  var REVERTED = 1;
203
- var atVersionUpdateStatus = $("#addthis_atversion_update_status").val();
204
  if (atVersionUpdateStatus == REVERTED) {
205
- $(".classicFeature").show();
206
  } else {
207
- $(".classicFeature").hide();
208
  }
209
 
210
  /**
211
  * Revert to older version after the user upgrades
212
  */
213
- $(".addthis-revert-atversion").click(function(){
214
- $("#addthis_atversion_update_status").val(REVERTED);
215
- $("#addthis_atversion_hidden").val(ATVERSION_250);
216
- $(this).closest("form").submit();
217
  return false;
218
  });
219
  /**
220
  * Update to a newer version
221
  */
222
- $(".addthis-update-atversion").click(function(){
223
- $("#addthis_atversion_update_status").val(MANUAL_UPDATE);
224
- $("#addthis_atversion_hidden").val(AT_VERSION_300);
225
- $(this).closest("form").submit();
226
  return false;
227
  });
228
 
229
- var addthis_credential_validation_status = $("#addthis_credential_validation_status");
230
- var addthis_validation_message = $("#addthis-credential-validation-message");
231
- var addthis_profile_validation_message = $("#addthis-profile-validation-message");
232
  //Validate the Addthis credentials
233
  window.skipValidationInternalError = false;
234
  function validate_addthis_credentials() {
235
- $.ajax(
236
  {"url" : addthis_option_params.wp_ajax_url,
237
  "type" : "post",
238
  "data" : {"action" : addthis_option_params.addthis_validate_action,
239
- "addthis_profile" : $("#addthis_profile").val()
240
  },
241
  "dataType" : "json",
242
  "beforeSend" : function() {
243
- $(".addthis-admin-loader").show();
244
  addthis_validation_message.html("").next().hide();
245
  addthis_profile_validation_message.html("").next().hide();
246
  },
@@ -254,18 +254,18 @@ jQuery(document).ready(function($) {
254
  } else {
255
  window.skipValidationInternalError = true;
256
  }
257
- $("#addthis-settings").submit();
258
  } else {
259
  addthis_validation_message.html(data.credentialmessage);
260
  addthis_profile_validation_message.html(data.profilemessage);
261
  if (data.profilemessage != "") {
262
- $('html, body').animate({"scrollTop":0}, 'slow');
263
  }
264
  }
265
 
266
  },
267
  "complete" :function(data) {
268
- $(".addthis-admin-loader").hide();
269
  },
270
  "error" : function(jqXHR, textStatus, errorThrown) {
271
  console.log(textStatus, errorThrown);
@@ -273,72 +273,101 @@ jQuery(document).ready(function($) {
273
  });
274
  }
275
 
276
- $("#addthis_profile").change(function(){
277
  addthis_credential_validation_status.val(0);
278
- if($.trim($("#addthis_profile").val()) == "") {
279
  addthis_profile_validation_message.next().hide();
280
  }
281
  });
282
 
283
- $('#addthis_config_json').focusout(function() {
284
  var error = 0;
285
- if ($('#addthis_config_json').val() != " ") {
286
  try {
287
- var addthis_config_json = jQuery.parseJSON($('#addthis_config_json').val());
288
  }
289
  catch (e) {
290
- $('#config-error').show();
291
  error = 1;
292
  }
293
  }
294
  if (error == 0) {
295
- $('#config-error').hide();
296
  return true;
297
  } else {
298
- $('#config-error').show();
299
  return false;
300
  }
301
  });
302
 
303
- $('#addthis_share_json').focusout(function() {
304
  var error = 0;
305
- if ($('#addthis_share_json').val() != " ") {
306
  try {
307
- var addthis_share_json = jQuery.parseJSON($('#addthis_share_json').val());
308
  }
309
  catch (e) {
310
- $('#share-error').show();
311
  error = 1;
312
  }
313
  }
314
  if (error == 0) {
315
- $('#share-error').hide();
316
  return true;
317
  } else {
318
- $('#share-error').show();
319
  return false;
320
  }
321
  });
322
 
323
- $('.addthis-submit-button').click(function() {
324
- $('#config-error').hide();
325
- $('#share-error').hide();
326
  var error = 0;
327
- if ($('#addthis-config-json').val() != " ") {
328
  try {
329
- var addthis_config_json = jQuery.parseJSON($('#addthis-config-json').val());
330
  }
331
  catch (e) {
332
- $('#config-error').show();
333
  error = 1;
334
  }
335
  }
336
- if ($('#addthis_share_json').val() != " ") {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  try {
338
- var addthis_share_json = jQuery.parseJSON($('#addthis_share_json').val());
339
  }
340
  catch (e) {
341
- $('#share-error').show();
342
  error = 1;
343
  }
344
  }
@@ -352,7 +381,7 @@ jQuery(document).ready(function($) {
352
 
353
  //preview box
354
  function rewriteServices(posn) {
355
- var services = $('#'+posn+'-chosen-list').val();
356
  var service = services.split(', ');
357
  var i;
358
  var newservice = '';
@@ -384,7 +413,7 @@ jQuery(document).ready(function($) {
384
  }
385
 
386
  function revertServices(posn) {
387
- var services = $('#'+posn+'-chosen-list').val();
388
  var service = services.split(', ');
389
  var i;
390
  var newservice = '';
@@ -415,149 +444,149 @@ jQuery(document).ready(function($) {
415
  return newservices;
416
  }
417
 
418
- if($('#large_toolbox_above').is(':checked')) {
419
- $('.above_button_set').show();
420
- } else if($('#fb_tw_p1_sc_above').is(':checked')) {
421
- $('.above_button_set').show();
422
- } else if($('#small_toolbox_above').is(':checked')) {
423
- $('.above_button_set').show();
424
- } else if($('#button_above').is(':checked')) {
425
- $('.above_button_set').hide();
426
- } else if($('#above_custom_string').is(':checked')) {
427
- $('.above_button_set').hide();
428
  }
429
 
430
- if($('#large_toolbox_below').is(':checked')) {
431
- $('.below_button_set').show();
432
- } else if($('#fb_tw_p1_sc_below').is(':checked')) {
433
- $('.below_button_set').show();
434
- } else if($('#small_toolbox_below').is(':checked')) {
435
- $('.below_button_set').show();
436
- } else if($('#button_below').is(':checked')) {
437
- $('.below_button_set').hide();
438
- } else if($('#below_custom_string').is(':checked')) {
439
- $('.below_button_set').hide();
440
  }
441
 
442
- $("#large_toolbox_above").click( function() {
443
- if($('#above-chosen-list').val() != '') {
444
  var newserv = revertServices('above');
445
- $('#above-chosen-list').val(newserv);
446
  }
447
- $('.above_button_set').show();
448
  });
449
 
450
- $("#large_toolbox_below").click( function() {
451
- if($('#below-chosen-list').val() != '') {
452
  var newserv = revertServices('below');
453
- $('#below-chosen-list').val(newserv);
454
  }
455
- $('.below_button_set').show();
456
  });
457
 
458
- $("#fb_tw_p1_sc_above").click( function() {
459
- if($('#above-chosen-list').val() != '') {
460
  var newserv = rewriteServices('above');
461
- $('#above-chosen-list').val(newserv);
462
  }
463
- $('.above_button_set').show();
464
  });
465
 
466
- $("#fb_tw_p1_sc_below").click( function() {
467
- if($('#below-chosen-list').val() != '') {
468
  var newserv = rewriteServices('below');
469
- $('#below-chosen-list').val(newserv);
470
  }
471
- $('.below_button_set').show();
472
  });
473
 
474
- $("#small_toolbox_above").click( function() {
475
- if($('#above-chosen-list').val() != '') {
476
  var newserv = revertServices('above');
477
- $('#above-chosen-list').val(newserv);
478
  }
479
- $('.above_button_set').show();
480
  });
481
 
482
- $("#small_toolbox_below").click( function() {
483
- if($('#below-chosen-list').val() != '') {
484
  var newserv = revertServices('below');
485
- $('#below-chosen-list').val(newserv);
486
  }
487
- $('.below_button_set').show();
488
  });
489
 
490
- $("#button_above").click( function() {
491
- $('.above_button_set').show();
492
  });
493
 
494
- $("#above_custom_string").click( function() {
495
- if($(this).is(':checked')){
496
- $('.above_button_set').hide();
497
  } else {
498
- $('.above_button_set').show();
499
  }
500
  });
501
 
502
- $("#button_below").click( function() {
503
- $('.below_button_set').show();
504
  });
505
 
506
- $("#below_custom_string").click( function() {
507
- if($(this).is(':checked')){
508
- $('.below_button_set').hide();
509
  } else {
510
- $('.below_button_set').show();
511
  }
512
  });
513
 
514
- $('.addthis-submit-button').click(function() {
515
- if($('#above-disable-smart-sharing').is(':checked')) {
516
- if($('#button_above').is(':checked')) {
517
- $('#above-chosen-list').val('');
518
  } else {
519
  var list = [];
520
- $('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
521
  var service = '';
522
- $(this).find('li').each(function(){
523
- if($(this).hasClass('enabled')) {
524
- list.push($(this).attr('data-service'));
525
- if($(this).attr('data-service') == 'compact') {
526
  list.push('counter');
527
  }
528
  }
529
  });
530
  });
531
  var aboveservices = list.join(', ');
532
- $('#above-chosen-list').val(aboveservices);
533
  }
534
  }
535
- if($('#button_above').is(':checked')) {
536
- $('#above-chosen-list').val('');
537
  }
538
 
539
- if($('#below-disable-smart-sharing').is(':checked')) {
540
- if($('#button_below').is(':checked')) {
541
- $('#below-chosen-list').val('');
542
  } else {
543
  var list = [];
544
- $('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
545
  var service = '';
546
- $(this).find('li').each(function(){
547
- if($(this).hasClass('enabled')) {
548
- list.push($(this).attr('data-service'));
549
- if($(this).attr('data-service') == 'compact') {
550
  list.push('counter');
551
  }
552
  }
553
  });
554
  });
555
  var belowservices = list.join(', ');
556
- $('#below-chosen-list').val(belowservices);
557
  }
558
  }
559
- if($('#button_below').is(':checked')) {
560
- $('#below-chosen-list').val('');
561
  }
562
 
563
  });
@@ -570,30 +599,30 @@ jQuery(document).ready(function($) {
570
  var popoverHeight = 0;
571
  var parent;
572
  var me;
573
- $('.row-right a').mouseover(function(){
574
- me = $(this);
575
- parent = $(me).parent();
576
 
577
- dataContent = $(parent).attr('data-content');
578
- dataTitle = $(parent).attr('data-original-title');
579
  innerContent = "<div class='popover fade right in' style='display: block;'><div class='arrow'></div><h3 class='popover-title'>";
580
  innerContent = innerContent + dataTitle;
581
  innerContent = innerContent + "</h3><div class='popover-content'>";
582
  innerContent = innerContent + dataContent;
583
  innerContent = innerContent + "</div></div>";
584
- $(parent).append(innerContent);
585
 
586
- popoverHeight = $(parent).find('.popover').height();
587
- left = $(me).position().left + 15;
588
- top = $(me).position().top - (popoverHeight/2) + 8;
589
 
590
- $(parent).find('.popover').css({
591
  'left': left+'px',
592
  'top': top+'px'
593
  });
594
  });
595
- $('.row-right a').mouseout(function(){
596
- $('.popover').remove();
597
  });
598
 
599
  });
18
  * +--------------------------------------------------------------------------+
19
  */
20
 
21
+ jQuery(document).ready(function(jQuery) {
22
+ jQuery( "#config-error" ).hide();
23
+ jQuery( "#share-error" ).hide();
24
+ jQuery( "#tabs" ).tabs();
25
 
26
  var thickDims, tbWidth, tbHeight, img = '';
27
 
28
  thickDims = function() {
29
+ var tbWindow = jQuery('#TB_window'), H = jQuery(window).height(), W = jQuery(window).width(), w, h;
30
 
31
  w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90;
32
  h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60;
33
  if ( tbWindow.size() ) {
34
  tbWindow.width(w).height(h);
35
+ jQuery('#TB_iframeContent').width(w).height(h - 27);
36
  tbWindow.css({'margin-left': '-' + parseInt((w / 2),10) + 'px'});
37
  if ( typeof document.body.style.maxWidth != 'undefined' )
38
  tbWindow.css({'top':'30px','margin-top':'0'});
39
  }
40
  };
41
 
42
+ jQuery('#addthis_rating_thank_you').hide()
43
 
44
+ switch(jQuery('#addthis_rate_us').val()) {
45
  case 'dislike':
46
+ jQuery('#addthis_like_us_answers').hide();
47
+ jQuery('#addthis_dislike').show();
48
+ jQuery('#addthis_like').hide();
49
  break;
50
  case 'like':
51
+ jQuery('#addthis_like_us_answers').hide();
52
+ jQuery('#addthis_dislike').hide();
53
+ jQuery('#addthis_like').show();
54
  break;
55
  case 'will not rate':
56
  case 'rated':
57
+ jQuery('#addthis_do_you_like_us').hide()
58
  break;
59
  default:
60
+ jQuery('#addthis_dislike').hide();
61
+ jQuery('#addthis_like').hide();
62
  }
63
 
64
+ jQuery('#addthis_dislike_confirm').click(function() {
65
+ jQuery('#addthis_like_us_answers').hide();
66
+ jQuery('#addthis_dislike').show();
67
+ jQuery('#addthis_rate_us').val('dislike')
68
  });
69
+ jQuery('#addthis_like_confirm').click(function() {
70
+ jQuery('#addthis_like_us_answers').hide();
71
+ jQuery('#addthis_like').show();
72
+ jQuery('#addthis_rate_us').val('like')
73
  });
74
+ jQuery('#addthis_not_rating').click(function() {
75
+ jQuery('#addthis_do_you_like_us').hide()
76
+ jQuery('#addthis_rate_us').val('will not rate')
77
  });
78
+ jQuery('#addthis_rating').click(function() {
79
+ jQuery('#addthis_rating_thank_you').show()
80
+ jQuery('#addthis_rate_us').val('rated')
81
  });
82
 
83
+ jQuery('a.thickbox-preview').click( function() {
84
 
85
  var previewLink = this;
86
 
87
  var values = {};
88
+ jQuery.each(jQuery('#addthis-settings').serializeArray(), function(i, field) {
89
 
90
  var thisName = field.name
91
  if (thisName.indexOf("addthis_settings[") != -1 )
97
  values[thisName] = field.value;
98
  });
99
 
100
+ var stuff = jQuery.param(values, true);
101
 
102
  var data = {
103
  action: 'at_save_transient',
108
  jQuery.post(ajaxurl, data, function(response) {
109
 
110
  // Fix for WP 2.9's version of lightbox
111
+ if ( typeof tb_click != 'undefined' && jQuery.isFunction(tb_click.call))
112
  {
113
  tb_click.call(previewLink);
114
  }
115
+ var href = jQuery(previewLink).attr('href');
116
  var link = '';
117
 
118
 
119
  if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
120
  tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
121
  else
122
+ tbWidth = jQuery(window).width() - 90;
123
 
124
  if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
125
  tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
126
  else
127
+ tbHeight = jQuery(window).height() - 60;
128
 
129
+ jQuery('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
130
+ jQuery('#TB_closeAjaxWindow').css({'float':'left'});
131
+ jQuery('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
132
+ jQuery('#TB_iframeContent').width('100%');
133
  thickDims();
134
 
135
  });
136
  return false;
137
  });
138
 
139
+ var aboveCustom = jQuery('#above_custom_button');
140
  var aboveCustomShow = function(){
141
  if ( aboveCustom.is(':checked'))
142
  {
143
+ jQuery('.above_option_custom').removeClass('hidden');
144
  }
145
  else
146
  {
147
+ jQuery('.above_option_custom').addClass('hidden');
148
  }
149
  };
150
 
151
+ var belowCustom = jQuery('#below_custom_button');
152
  var belowCustomShow = function(){
153
  if ( belowCustom.is(':checked'))
154
  {
155
+ jQuery('.below_option_custom').removeClass('hidden');
156
  }
157
  else
158
  {
159
+ jQuery('.below_option_custom').addClass('hidden');
160
  }
161
  };
162
 
163
+ var aboveCustomString = jQuery('#above_custom_string');
164
  var aboveCustomStringShow = function(){
165
  if ( aboveCustomString.is(':checked'))
166
  {
167
+ jQuery('.above_custom_string_input').removeClass('hidden');
168
  }
169
  else
170
  {
171
+ jQuery('.above_custom_string_input').addClass('hidden');
172
  }
173
  };
174
 
175
+ var belowCustomString = jQuery('#below_custom_string');
176
  var belowCustomStringShow = function(){
177
  if ( belowCustomString.is(':checked'))
178
  {
179
+ jQuery('.below_custom_string_input').removeClass('hidden');
180
  }
181
  else
182
  {
183
+ jQuery('.below_custom_string_input').addClass('hidden');
184
  }
185
  };
186
 
189
  aboveCustomStringShow();
190
  belowCustomStringShow();
191
 
192
+ jQuery('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow(); aboveCustomStringShow();} );
193
+ jQuery('input[name="addthis_settings[below]"]').change( function(){belowCustomStringShow();} );
194
 
195
  /**
196
  * Hide Theming and branding options when user selects version 3.0 or above
200
  var MANUAL_UPDATE = -1;
201
  var AUTO_UPDATE = 0;
202
  var REVERTED = 1;
203
+ var atVersionUpdateStatus = jQuery("#addthis_atversion_update_status").val();
204
  if (atVersionUpdateStatus == REVERTED) {
205
+ jQuery(".classicFeature").show();
206
  } else {
207
+ jQuery(".classicFeature").hide();
208
  }
209
 
210
  /**
211
  * Revert to older version after the user upgrades
212
  */
213
+ jQuery(".addthis-revert-atversion").click(function(){
214
+ jQuery("#addthis_atversion_update_status").val(REVERTED);
215
+ jQuery("#addthis_atversion_hidden").val(ATVERSION_250);
216
+ jQuery(this).closest("form").submit();
217
  return false;
218
  });
219
  /**
220
  * Update to a newer version
221
  */
222
+ jQuery(".addthis-update-atversion").click(function(){
223
+ jQuery("#addthis_atversion_update_status").val(MANUAL_UPDATE);
224
+ jQuery("#addthis_atversion_hidden").val(AT_VERSION_300);
225
+ jQuery(this).closest("form").submit();
226
  return false;
227
  });
228
 
229
+ var addthis_credential_validation_status = jQuery("#addthis_credential_validation_status");
230
+ var addthis_validation_message = jQuery("#addthis-credential-validation-message");
231
+ var addthis_profile_validation_message = jQuery("#addthis-profile-validation-message");
232
  //Validate the Addthis credentials
233
  window.skipValidationInternalError = false;
234
  function validate_addthis_credentials() {
235
+ jQuery.ajax(
236
  {"url" : addthis_option_params.wp_ajax_url,
237
  "type" : "post",
238
  "data" : {"action" : addthis_option_params.addthis_validate_action,
239
+ "addthis_profile" : jQuery("#addthis_profile").val()
240
  },
241
  "dataType" : "json",
242
  "beforeSend" : function() {
243
+ jQuery(".addthis-admin-loader").show();
244
  addthis_validation_message.html("").next().hide();
245
  addthis_profile_validation_message.html("").next().hide();
246
  },
254
  } else {
255
  window.skipValidationInternalError = true;
256
  }
257
+ jQuery("#addthis-settings").submit();
258
  } else {
259
  addthis_validation_message.html(data.credentialmessage);
260
  addthis_profile_validation_message.html(data.profilemessage);
261
  if (data.profilemessage != "") {
262
+ jQuery('html, body').animate({"scrollTop":0}, 'slow');
263
  }
264
  }
265
 
266
  },
267
  "complete" :function(data) {
268
+ jQuery(".addthis-admin-loader").hide();
269
  },
270
  "error" : function(jqXHR, textStatus, errorThrown) {
271
  console.log(textStatus, errorThrown);
273
  });
274
  }
275
 
276
+ jQuery("#addthis_profile").change(function(){
277
  addthis_credential_validation_status.val(0);
278
+ if(jQuery.trim(jQuery("#addthis_profile").val()) == "") {
279
  addthis_profile_validation_message.next().hide();
280
  }
281
  });
282
 
283
+ jQuery('#addthis_config_json').focusout(function() {
284
  var error = 0;
285
+ if (jQuery('#addthis_config_json').val() != " ") {
286
  try {
287
+ var addthis_config_json = jQuery.parseJSON(jQuery('#addthis_config_json').val());
288
  }
289
  catch (e) {
290
+ jQuery('#config-error').show();
291
  error = 1;
292
  }
293
  }
294
  if (error == 0) {
295
+ jQuery('#config-error').hide();
296
  return true;
297
  } else {
298
+ jQuery('#config-error').show();
299
  return false;
300
  }
301
  });
302
 
303
+ jQuery('#addthis_share_json').focusout(function() {
304
  var error = 0;
305
+ if (jQuery('#addthis_share_json').val() != " ") {
306
  try {
307
+ var addthis_share_json = jQuery.parseJSON(jQuery('#addthis_share_json').val());
308
  }
309
  catch (e) {
310
+ jQuery('#share-error').show();
311
  error = 1;
312
  }
313
  }
314
  if (error == 0) {
315
+ jQuery('#share-error').hide();
316
  return true;
317
  } else {
318
+ jQuery('#share-error').show();
319
  return false;
320
  }
321
  });
322
 
323
+ jQuery('#addthis_layers_json').focusout(function() {
 
 
324
  var error = 0;
325
+ if (jQuery('#addthis_layers_json').val() != " ") {
326
  try {
327
+ var addthis_layers_json = jQuery.parseJSON(jQuery('#addthis_layers_json').val());
328
  }
329
  catch (e) {
330
+ jQuery('#layers-error').show();
331
  error = 1;
332
  }
333
  }
334
+ if (error == 0) {
335
+ jQuery('#layers-error').hide();
336
+ return true;
337
+ } else {
338
+ jQuery('#layers-error').show();
339
+ return false;
340
+ }
341
+ });
342
+
343
+ jQuery('.addthis-submit-button').click(function() {
344
+ jQuery('#config-error').hide();
345
+ jQuery('#share-error').hide();
346
+ var error = 0;
347
+ if (jQuery('#addthis_config_json').val() != " ") {
348
+ try {
349
+ var addthis_config_json = jQuery.parseJSON(jQuery('#addthis_config_json').val());
350
+ }
351
+ catch (e) {
352
+ jQuery('#config-error').show();
353
+ error = 1;
354
+ }
355
+ }
356
+ if (jQuery('#addthis_share_json').val() != " ") {
357
+ try {
358
+ var addthis_share_json = jQuery.parseJSON(jQuery('#addthis_share_json').val());
359
+ }
360
+ catch (e) {
361
+ jQuery('#share-error').show();
362
+ error = 1;
363
+ }
364
+ }
365
+ if (jQuery('#addthis_layers_json').val() != " ") {
366
  try {
367
+ var addthis_layers_json = jQuery.parseJSON(jQuery('#addthis_layers_json').val());
368
  }
369
  catch (e) {
370
+ jQuery('#layers-error').show();
371
  error = 1;
372
  }
373
  }
381
 
382
  //preview box
383
  function rewriteServices(posn) {
384
+ var services = jQuery('#'+posn+'-chosen-list').val();
385
  var service = services.split(', ');
386
  var i;
387
  var newservice = '';
413
  }
414
 
415
  function revertServices(posn) {
416
+ var services = jQuery('#'+posn+'-chosen-list').val();
417
  var service = services.split(', ');
418
  var i;
419
  var newservice = '';
444
  return newservices;
445
  }
446
 
447
+ if(jQuery('#large_toolbox_above').is(':checked')) {
448
+ jQuery('.above_button_set').show();
449
+ } else if(jQuery('#fb_tw_p1_sc_above').is(':checked')) {
450
+ jQuery('.above_button_set').show();
451
+ } else if(jQuery('#small_toolbox_above').is(':checked')) {
452
+ jQuery('.above_button_set').show();
453
+ } else if(jQuery('#button_above').is(':checked')) {
454
+ jQuery('.above_button_set').hide();
455
+ } else if(jQuery('#above_custom_string').is(':checked')) {
456
+ jQuery('.above_button_set').hide();
457
  }
458
 
459
+ if(jQuery('#large_toolbox_below').is(':checked')) {
460
+ jQuery('.below_button_set').show();
461
+ } else if(jQuery('#fb_tw_p1_sc_below').is(':checked')) {
462
+ jQuery('.below_button_set').show();
463
+ } else if(jQuery('#small_toolbox_below').is(':checked')) {
464
+ jQuery('.below_button_set').show();
465
+ } else if(jQuery('#button_below').is(':checked')) {
466
+ jQuery('.below_button_set').hide();
467
+ } else if(jQuery('#below_custom_string').is(':checked')) {
468
+ jQuery('.below_button_set').hide();
469
  }
470
 
471
+ jQuery("#large_toolbox_above").click( function() {
472
+ if(jQuery('#above-chosen-list').val() != '') {
473
  var newserv = revertServices('above');
474
+ jQuery('#above-chosen-list').val(newserv);
475
  }
476
+ jQuery('.above_button_set').show();
477
  });
478
 
479
+ jQuery("#large_toolbox_below").click( function() {
480
+ if(jQuery('#below-chosen-list').val() != '') {
481
  var newserv = revertServices('below');
482
+ jQuery('#below-chosen-list').val(newserv);
483
  }
484
+ jQuery('.below_button_set').show();
485
  });
486
 
487
+ jQuery("#fb_tw_p1_sc_above").click( function() {
488
+ if(jQuery('#above-chosen-list').val() != '') {
489
  var newserv = rewriteServices('above');
490
+ jQuery('#above-chosen-list').val(newserv);
491
  }
492
+ jQuery('.above_button_set').show();
493
  });
494
 
495
+ jQuery("#fb_tw_p1_sc_below").click( function() {
496
+ if(jQuery('#below-chosen-list').val() != '') {
497
  var newserv = rewriteServices('below');
498
+ jQuery('#below-chosen-list').val(newserv);
499
  }
500
+ jQuery('.below_button_set').show();
501
  });
502
 
503
+ jQuery("#small_toolbox_above").click( function() {
504
+ if(jQuery('#above-chosen-list').val() != '') {
505
  var newserv = revertServices('above');
506
+ jQuery('#above-chosen-list').val(newserv);
507
  }
508
+ jQuery('.above_button_set').show();
509
  });
510
 
511
+ jQuery("#small_toolbox_below").click( function() {
512
+ if(jQuery('#below-chosen-list').val() != '') {
513
  var newserv = revertServices('below');
514
+ jQuery('#below-chosen-list').val(newserv);
515
  }
516
+ jQuery('.below_button_set').show();
517
  });
518
 
519
+ jQuery("#button_above").click( function() {
520
+ jQuery('.above_button_set').show();
521
  });
522
 
523
+ jQuery("#above_custom_string").click( function() {
524
+ if(jQuery(this).is(':checked')){
525
+ jQuery('.above_button_set').hide();
526
  } else {
527
+ jQuery('.above_button_set').show();
528
  }
529
  });
530
 
531
+ jQuery("#button_below").click( function() {
532
+ jQuery('.below_button_set').show();
533
  });
534
 
535
+ jQuery("#below_custom_string").click( function() {
536
+ if(jQuery(this).is(':checked')){
537
+ jQuery('.below_button_set').hide();
538
  } else {
539
+ jQuery('.below_button_set').show();
540
  }
541
  });
542
 
543
+ jQuery('.addthis-submit-button').click(function() {
544
+ if(jQuery('#above-disable-smart-sharing').is(':checked')) {
545
+ if(jQuery('#button_above').is(':checked')) {
546
+ jQuery('#above-chosen-list').val('');
547
  } else {
548
  var list = [];
549
+ jQuery('.above-smart-sharing-container .selected-services .ui-sortable').each(function(){
550
  var service = '';
551
+ jQuery(this).find('li').each(function(){
552
+ if(jQuery(this).hasClass('enabled')) {
553
+ list.push(jQuery(this).attr('data-service'));
554
+ if(jQuery(this).attr('data-service') == 'compact') {
555
  list.push('counter');
556
  }
557
  }
558
  });
559
  });
560
  var aboveservices = list.join(', ');
561
+ jQuery('#above-chosen-list').val(aboveservices);
562
  }
563
  }
564
+ if(jQuery('#button_above').is(':checked')) {
565
+ jQuery('#above-chosen-list').val('');
566
  }
567
 
568
+ if(jQuery('#below-disable-smart-sharing').is(':checked')) {
569
+ if(jQuery('#button_below').is(':checked')) {
570
+ jQuery('#below-chosen-list').val('');
571
  } else {
572
  var list = [];
573
+ jQuery('.below-smart-sharing-container .selected-services .ui-sortable').each(function(){
574
  var service = '';
575
+ jQuery(this).find('li').each(function(){
576
+ if(jQuery(this).hasClass('enabled')) {
577
+ list.push(jQuery(this).attr('data-service'));
578
+ if(jQuery(this).attr('data-service') == 'compact') {
579
  list.push('counter');
580
  }
581
  }
582
  });
583
  });
584
  var belowservices = list.join(', ');
585
+ jQuery('#below-chosen-list').val(belowservices);
586
  }
587
  }
588
+ if(jQuery('#button_below').is(':checked')) {
589
+ jQuery('#below-chosen-list').val('');
590
  }
591
 
592
  });
599
  var popoverHeight = 0;
600
  var parent;
601
  var me;
602
+ jQuery('.row-right a').mouseover(function(){
603
+ me = jQuery(this);
604
+ parent = jQuery(me).parent();
605
 
606
+ dataContent = jQuery(parent).attr('data-content');
607
+ dataTitle = jQuery(parent).attr('data-original-title');
608
  innerContent = "<div class='popover fade right in' style='display: block;'><div class='arrow'></div><h3 class='popover-title'>";
609
  innerContent = innerContent + dataTitle;
610
  innerContent = innerContent + "</h3><div class='popover-content'>";
611
  innerContent = innerContent + dataContent;
612
  innerContent = innerContent + "</div></div>";
613
+ jQuery(parent).append(innerContent);
614
 
615
+ popoverHeight = jQuery(parent).find('.popover').height();
616
+ left = jQuery(me).position().left + 15;
617
+ top = jQuery(me).position().top - (popoverHeight/2) + 8;
618
 
619
+ jQuery(parent).find('.popover').css({
620
  'left': left+'px',
621
  'top': top+'px'
622
  });
623
  });
624
+ jQuery('.row-right a').mouseout(function(){
625
+ jQuery('.popover').remove();
626
  });
627
 
628
  });
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: abramsm, srijith.v, vipinss, dnrahamim, jgrodel, bradaddthiscom, mkitzman, addthis_paul, addthis_matt, addthis_elsa, ribin_addthis, AddThis_Mike
3
  Tags: AddThis, addtoany, bookmark, bookmarking, email, e-mail, sharing buttons, share, share this, facebook, google+, pinterest, instagram, linkedin, whatsapp, social tools, website tools, twitter, content marketing, recommended content, conversion tool, subscription button, conversion tools, email tools, ecommerce tools, social marketing, personalization tools
4
  Requires at least: 3.0
5
- Tested up to: 4.2.2
6
- Stable tag: 5.0.12
7
 
8
  AddThis provides the best sharing tools to help you make your website smarter.
9
 
@@ -50,6 +50,10 @@ All of the options required through this plugin require javascript. JavaScript m
50
  1. Flexibility. AddThis can be customized via API, and served securely via SSL. You can roll your own sharing toolbars with our toolbox. Share just about anything, anywhere ­­ your way.
51
  1. Global reach. AddThis sends content to 200+ sharing services 60+ languages, to over 1.9 billion unique users in countries all over the world.
52
 
 
 
 
 
53
  = Who else uses AddThis? =
54
  Over 15,000,000 sites have installed AddThis. With over 1.9 billion unique users, AddThis is helping share content all over the world, in more than sixty languages.
55
 
@@ -70,11 +74,18 @@ In the screen options you can enable the AddThis meta box. Check the box and sav
70
  6. Tool Gallery on the AddThis Dashboard
71
  7. Customization options on the AddThis Dashboard
72
 
73
- == PHP Version ==
74
 
75
- PHP 5+ is preferred; PHP 4 is supported.
 
76
 
77
- == Changelog ==
 
 
 
 
 
 
78
 
79
  = 5.0.13 =
80
  * Fixing XSS bug in the administrative panel
@@ -368,6 +379,14 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
368
 
369
  == Upgrade Notice ==
370
 
 
 
 
 
 
 
 
 
371
  = 5.0.12 =
372
  * Fixing a bug that resets settings to defaults during the upgrade for users in AddThis mode
373
  * Reverting to pre-5.0.9 settings of plugin for upgrades from 5.0.9, 5.0.10 and 5.0.11
2
  Contributors: abramsm, srijith.v, vipinss, dnrahamim, jgrodel, bradaddthiscom, mkitzman, addthis_paul, addthis_matt, addthis_elsa, ribin_addthis, AddThis_Mike
3
  Tags: AddThis, addtoany, bookmark, bookmarking, email, e-mail, sharing buttons, share, share this, facebook, google+, pinterest, instagram, linkedin, whatsapp, social tools, website tools, twitter, content marketing, recommended content, conversion tool, subscription button, conversion tools, email tools, ecommerce tools, social marketing, personalization tools
4
  Requires at least: 3.0
5
+ Tested up to: 4.3
6
+ Stable tag: 5.1.0
7
 
8
  AddThis provides the best sharing tools to help you make your website smarter.
9
 
50
  1. Flexibility. AddThis can be customized via API, and served securely via SSL. You can roll your own sharing toolbars with our toolbox. Share just about anything, anywhere ­­ your way.
51
  1. Global reach. AddThis sends content to 200+ sharing services 60+ languages, to over 1.9 billion unique users in countries all over the world.
52
 
53
+ = What PHP version is required? =
54
+
55
+ This plugin requires PHP 5.2.4 or greater.
56
+
57
  = Who else uses AddThis? =
58
  Over 15,000,000 sites have installed AddThis. With over 1.9 billion unique users, AddThis is helping share content all over the world, in more than sixty languages.
59
 
74
  6. Tool Gallery on the AddThis Dashboard
75
  7. Customization options on the AddThis Dashboard
76
 
77
+ == Changelog ==
78
 
79
+ = 5.1.1 =
80
+ * Fixing XSS bug in the administrative panel
81
 
82
+ = 5.1.0 =
83
+ * New feature: set your own addthis.layers() paramaters to customize further using our API (in WordPress mode only)
84
+ * Fixing a bug with the AddThis Sharing Buttons meta box not showing up for users in AddThis mode when editing posts
85
+ * Fixing a bug with addthis_config where the JSON wasn't always checked before submitting the settings form
86
+ * Fixing a bug with the sharing sidebar, where the theme for the sidebar was used for all AddThis layers tools (in WordPress mode)
87
+ * Fixing a bug between AddThis Sharing Buttons and AddThis Follow Buttons, where saving changes in Follow Buttons would reset Sharing Buttons settings
88
+ * Support for WordPress 4.3
89
 
90
  = 5.0.13 =
91
  * Fixing XSS bug in the administrative panel
379
 
380
  == Upgrade Notice ==
381
 
382
+ = 5.1.0 =
383
+ * New feature: set your own addthis.layers() paramaters to customize further using our API (in WordPress mode only)
384
+ * Fixing a bug with the AddThis Sharing Buttons meta box not showing up for users in AddThis mode when editing posts
385
+ * Fixing a bug with addthis_config where the JSON wasn't always checked before submitting the settings form
386
+ * Fixing a bug with the sharing sidebar, where the theme for the sidebar was used for all AddThis layers tools (in WordPress mode)
387
+ * Fixing a bug between AddThis Sharing Buttons and AddThis Follow Buttons, where saving changes in Follow Buttons would reset Sharing Buttons settings
388
+ * Support for WordPress 4.3
389
+
390
  = 5.0.12 =
391
  * Fixing a bug that resets settings to defaults during the upgrade for users in AddThis mode
392
  * Reverting to pre-5.0.9 settings of plugin for upgrades from 5.0.9, 5.0.10 and 5.0.11
uninstall.php CHANGED
@@ -23,4 +23,10 @@ $option = get_option('addthis_settings');
23
  if ($option && isset($option['addthis_plugin_version'])) {
24
  $option['addthis_plugin_version'] = 'uninstalled';
25
  update_option('addthis_settings', $option);
 
 
 
 
 
 
26
  }
23
  if ($option && isset($option['addthis_plugin_version'])) {
24
  $option['addthis_plugin_version'] = 'uninstalled';
25
  update_option('addthis_settings', $option);
26
+ }
27
+
28
+ $option = get_option('addthis_shared_settings');
29
+ if ($option && isset($option['addthis_plugin_version'])) {
30
+ $option['addthis_plugin_version'] = 'uninstalled';
31
+ update_option('addthis_shared_settings', $option);
32
  }