I am loading easy social for teaser of some cintent type. When I am loading teaser list through ajax only facebook loads. Twitter and Google plus in not loading at all.

I have seen same issue was there in addthis widget and solution was to add following code after ajax request is completed-

$.getScript('http://s7.addthis.com/js/250/addthis_widget.js#pubid=xyz',
function(){
addthis.init(); //callback function for script loading
});

Comments

alexweber’s picture

Version: 7.x-1.0-beta5 » 7.x-2.x-dev
Status: Active » Postponed (maintainer needs more info)

I can't replicate this!

Could you please give step-by-step instructions to replicate this bug please so we can fix it?

jm.federico’s picture

Status: Postponed (maintainer needs more info) » Active

Hi, you can see the problem by going to http://federicojm.com/en and opening one of the posts, they load via ajax.

Cheers

jm.federico’s picture

Ok, step by step the thing is:

Load a page with whatever content you have, but make sure it includes .
Have an ajax enabled link that load a node where the links are being printed
Click the link
The node will load but only the FB button will be renderes.

Solution is to run:

For Twitter
twttr.widgets.load();

For Google Plus
gapi.plusone.go();

After each ajax call

Haven't found a solution for LinkedIn

You can still look at http://federicojm.com/en which has issues with linked IN.

I'm current;y calling those two methods on my own modules on a Drupal.behavior.MODULE.attach(){}

Cheers

jm.federico’s picture

This is my current code:

(function($) {
  Drupal.behaviors.MYMODULE = {
    attach: function (context, settings) {
      // Fix easy_social.
      $('.easy_social_box').once('easy-social-box', function() {
        twttr.widgets.load();
        gapi.plusone.go();
      });
    }
  };
})(jQuery);
jm.federico’s picture

HA, been a bit active here, sorry for all the posts:

New discoveries:

To make G+ and Twitter work do this:

(function($) {
  Drupal.behaviors.MYMODULE = {
      // Fix easy_social.
      $('.easy_social_box').once('easy-social-box', function() {
        if (twttr && twttr.widgets && twttr.widgets.load) {
          twttr.widgets.load();
        }
        if (gapi && gapi.plusone && gapi.plusone.go) {
          gapi.plusone.go();
        }
      });
  };
})(jQuery);

A note about LinkedIN:

When loaded via an AJAX request, the linked in plugin messes things up. I'm yet to discover why and how, but the symptom is that the Drupal.ajax method injects a lot of DIVs and the LinkedIN

tag too many times. I'm thinking it may be jQuery's fault, but no confirmation there yet. Im using ajax_command_replace() to create the AJAX response. Cheers
alexweber’s picture

Thanks jm.federico!

If you're willing to write a patch and make sure this doesn't break anything without ajax enabled we'll gladly commit it!

If not it might be a couple days because im on vacation :)

jm.federico’s picture

@alexweber

I'm on vacation too (so decided to implement the module on my personal blog).

I was on my way to create a patch but stopped. Module is a bit bigger than what I expected so will take my time to learn the code and implement it correctly.

Enjoy your holidays!

Cheers

jm.federico’s picture

Issue summary: View changes

private pubid removed