Update for Sharredaddy with Infinite-Scroll in Jetpack
-
Hi! I have found a little bug with the Sahrredaddy and Inifinite scroll. The new post don’t have count and the link is not on a popup.
I have repair it with some change in the code of sharredaddy. If you went to update the official with, is not probs!
Start with the file : sharing-sources.php
line 166
Change : jQuery(document).ready(function(){
For : jQuery(document).on(‘ready post-load’, function() {File : sharing-service.php
line 411 : WPCOM_sharing_counts = Array();And the most of change on page sharing.js
get_counts : function( url ) {
if ( jQuery( ‘#sharing-facebook-‘ + WPCOM_sharing_counts[ url ] ).length && !jQuery( ‘#sharing-facebook-‘ + WPCOM_sharing_counts[ url ] + ‘ span .share-count’ ).length )
jQuery.getScript( ‘https://graph.facebook.com/’ + encodeURIComponent( url ) + ‘?callback=WPCOMSharing.update_facebook_count’ );
if ( jQuery( ‘#sharing-twitter-‘ + WPCOM_sharing_counts[ url ] ).length && !jQuery( ‘#sharing-twitter-‘ + WPCOM_sharing_counts[ url ] + ‘ span .share-count’ ).length )
jQuery.getScript( window.location.protocol + ‘//cdn.api.twitter.com/1/urls/count.json?callback=WPCOMSharing.update_twitter_count&url=’ + encodeURIComponent( url ) );
if ( jQuery( ‘#sharing-linkedin-‘ + WPCOM_sharing_counts[ url ] ).length && !jQuery( ‘#sharing-linkedin-‘ + WPCOM_sharing_counts[ url ] + ‘ span .share-count’ ).length )
jQuery.getScript( window.location.protocol + ‘//www.linkedin.com/countserv/count/share?format=jsonp&callback=WPCOMSharing.update_linkedin_count&url=’ + encodeURIComponent( url ) );
},$( document ).on( ‘ready post-load’, function() {
var $more_sharing_buttons = $( ‘.sharedaddy a.sharing-anchor’ );
$more_sharing_buttons.click( function() {
return false;
} );$( ‘.sharedaddy a’ ).each( function() {
if ( $( this ).attr( ‘href’ ) && $( this ).attr( ‘href’ ).indexOf( ‘share=’ ) != -1 && $( this ).attr( ‘href’ ).indexOf( ‘&nb=1’ ) == -1 ) {
if ($( this ).attr(‘id’)) {
var nurl = $( this ).attr(‘href’).split(‘?’);
var nid = $( this ).attr(‘id’).split(‘-‘);
if (!WPCOM_sharing_counts[nurl[0]] && nurl[0] && nid[2]) WPCOM_sharing_counts[nurl[0]] = nid[2];
}
$( this ).attr( ‘href’, $( this ).attr( ‘href’ ) + ‘&nb=1’ );
}
} );//MOVED HERE
if ( ‘undefined’ != typeof WPCOM_sharing_counts ) {
for ( var url in WPCOM_sharing_counts ) {
WPCOMSharing.get_counts( url );
}
}Voila, that’s work perfectly on my website, except for the count for Facebook, but there are already some people work on this http://wordpress.org/support/topic/facebook-does-not-show-how-many-counts
Tell me if you understand my change and if it’s ok :)
Thanks,
VincentThe blog I need help with is: (visible only to logged in users)
-
Thanks for the reports. Could you please try upgrading to Jetpack 2.0.4 and let us know if that fixed these issues? Thanks.
-
Yes, but not good for everything…
The link don’t go to a popup : line 166 of sharing-sources.php
The span count repeat when scroll and the link have repeat &nb=1But the bug with the like count is now good!
Thanks!
-
For now, I have repair with
&& !jQuery( ‘#sharing-facebook-‘ + WPCOM_sharing_counts[ url ] + ‘ span .share-count’ ).length
…in the function of get_counts
-
Glad to hear the “like” count is fixed with the latest Jetpack release.
I’ve reported the other issue to the Jetpack developers along with your code and will keep you posted here.
-
-
Hi there, the developers have implemented a fix for the ShareDaddy/Infinite Scroll issue, which should be included in the next release.
Other things, I don’t have share stats on the Jetpack Stats page…
I have reported this and will get back to you.
-
Our developers have let me know that sharing stats are not available in Jetpack at this time. We’re sorry for any inconvenience.
-
- The topic ‘Update for Sharredaddy with Infinite-Scroll in Jetpack’ is closed to new replies.