That’s a good idea. I took note of your suggestion here, and we’ll consider making the change in a future Jetpack update.
Maybe is posible do some like this:
Index: modules/sharedaddy/sharing-sources.php
===================================================================
--- modules/sharedaddy/sharing-sources.php (revisión: 811984)
+++ modules/sharedaddy/sharing-sources.php (copia de trabajo)
@@ -161,7 +161,25 @@
$opts[] = "$key=$val";
}
$opts = implode( ',', $opts );
- ?>
+ /*
+ * Filter example for async load:
+ *
+ * function custom_sharing_js_dialog( $name, $params, $opts) {
+ * ?>
+ * <script type="text/javascript">
+ * var _sharing_dialog = _sharing_dialog || [];
+ * _sharing_dialog.push([ '<?php echo $name; ?>','click',function(event) { event.preventDefault(); window.open( jQuery(this).attr( 'href' ), 'wpcom<?php echo $name; ?>', '<?php echo $opts; ?>' ); } ]);
+ * </script>
+ * <?php
+ * }
+ * add_filter('sharing_js_dialog','custom_sharing_js_dialog');
+ *
+ */
+ if (has_filter('sharing_js_dialog')) {
+ apply_filters('sharing_js_dialog', $name, $params, $opts );
+ return true;
+ }
+ ?>
<script type="text/javascript">
jQuery(document).on( 'ready post-load', function(){
jQuery( 'a.share-<?php echo $name; ?>' ).on( 'click', function() {
So the theme developer can load JS in async:
var _sharing_dialog = _sharing_dialog || [];
if ( _sharing_dialog ) {
for ( var i in _sharing_dialog ) {
var name = _sharing_dialog[i][0],
ev = _sharing_dialog[i][1],
func = _sharing_dialog[i][2];
jQuery( 'a.share-'+name).on( ev, func );
}
}