The Facebook share link does not open in a popup window by Addthis and instead a full new window is opened. This is a known problem by AddThis.

In order to overcome it, we added a JavascriptEvent just after the AddThis library is loaded, like this:

// addthis.js
        ...
        function(data, textStatus) {
          addthis.init();
          // Give the chance to other scripts to hook into the addthis variable.
          $(document).trigger('addthis.init', addthis);
        }

In a custom module we bound to the event and fixed the Facebook button's click event (thanks Michael Lablue):

$(document).bind('addthis.init', function(event, addthis) {
    addthis.addEventListener('addthis.ready', function () {
      $('.addthis_toolbox > .addthis_button_facebook')
        .each(function (i, o) {
          o.onclick = function () {
            return addthis_sendto('facebook');
          }
        });
    });
  });

Comments

juampynr’s picture

Status: Active » Needs review
StatusFileSize
new797 bytes

Here is a patch which triggers the addthis.init JQuery event. Other modules's JavaScript can hook into it by following the above example.

juampynr’s picture

Title: Give other modules the chance to hook in once addthis variable is availabe » Give other modules the chance to hook in once addthis variable is available

Fixing title.

matglas86’s picture

Issue summary: View changes

Nice. I'm committing it.

matglas86’s picture

Status: Needs review » Fixed

  • juampynr authored 6cce26d on 7.x-4.x
    Issue #1960656 by juampynr: Give other modules the chance to hook in...
  • juampynr authored f567e76 on 7.x-4.x
    Small change issue #1960656 by juampynr: Give other modules the chance...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.