Julienh / Sharrre

Make your sharing widget! Sharrre is a jQuery plugin that allows you to create nice widgets sharing for Facebook, Twitter, Google Plus (with PHP script) and more.
sharrre.com
MIT License
1.04k stars 413 forks source link

URL undefined Google Plus & Linkedin #285

Closed Twansparant closed 8 years ago

Twansparant commented 8 years ago

Hi there,

Since I updated to the 2.0.0 version, the Google Plus & Linkedin share buttons don't work anymore. I have the following code that was working correctly in the 1.3.5 version:

$('.shareme').sharrre({
  share: {
    twitter:    true,
    facebook:   true,
    linkedin:   true,
    googlePlus: true
  },
  template: '<div class="box"><div class="left"><span class="share">Share</span></div><div class="middle btn-group"><a href="#" class="facebook"><i class="icon-facebook"></i></a><a href="#" class="twitter"><i class="icon-twitter"></i></a><a href="#" class="linkedin"><i class="icon-linkedin"></i></a><a href="#" class="googleplus"><i class="icon-googleplus"></i></a></div><div class="right">{total}</div></div>',
  //url: document.location.href,
  urlCurl: '/path/to/theme/lib/sharrre.php',
  enableHover:    false,
  enableTracking: false,
  render: function(api, options){
    $(api.element).on('click', '.twitter', function() {
       api.openPopup('twitter');
    });
    $(api.element).on('click', '.facebook', function() {
       api.openPopup('facebook');
    });
    $(api.element).on('click', '.linkedin', function() {
       api.openPopup('linkedin');
    });
    $(api.element).on('click', '.googleplus', function() {
       api.openPopup('googlePlus');
    });
  },
  buttons: {
    twitter: {},
    facebook: {},
    linkedin: {},
    googlePlus: {}
  }
});

Facebook & Twitter work fine and show the correct url & text, but in the Google Plus & Linkedin popup the url look like:

https://plus.google.com/share?hl=undefined&url=undefined
https://www.linkedin.com/cws/share?url=undefined&token=&isFramed=true

In my console the url is correct:

GET http://mydomain.com/path/to/theme/lib/sharrre.php?url=http%3A%2F%2Fmydomain.com%2Fproject%2Fproject-name%2F&type=googlePlus
{"url":"http://mydomain.com/project/project-name/","count":0}

Any idea what is causing this? Thanks!

smeeckaert commented 8 years ago

Try updating to 2.0.1 i just correct a bug.

Twansparant commented 8 years ago

Try updating to 2.0.1 i just correct a bug.

Yes, that fixed it, thanks!