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 411 forks source link

Pinterest is Broken #287

Open LockeAG opened 8 years ago

LockeAG commented 8 years ago

Hi guys again ...

Seems that : encodeURIComponent(this.settings.media) and encodeURIComponent(this.settings.description) , are not getting the correct data .

In my basic knowledge I needed to add data-media so I can do the next implementation:

$(shareElement).each(function(i) {
        var lnk = $(this).attr('data-url'),
        txt = $(this).attr('data-text'),
        media = $(this).attr('data-media'),
        resTxt = encodeURIComponent(txt),
        resLnk = encodeURIComponent(lnk),
        resMedia = encodeURIComponent(media);

        $(this).sharrre({
            share: {
                facebook: true,
                twitter: true,
                pinterest: true,
            },
            template: '<ul class="box"><!--<li> <h2>{total}<small>Compartido</small> </h2> </li>--><li id="facebook"><i class="fa fa-facebook"></i></li><li id="twitter"><i class="fa fa-twitter"></i></li><li id="pinterest"><i class="fa fa-pinterest"></i></li></ul>',
            enableHover: false,
            enableTracking: false,
            buttons: {
                facebook: {
                    layout: 'button',
                    send: true
                },
                twitter: {
                    via: 'robbreportmx',
                },
                pinterest: {
                    url:''+ lnk + '',
                    media: ''+ media + '',
                    description: ''+ txt + ''
                }
            },
            render: function(api, options) {
                $(api.element).on('click', '#twitter', function() {
                    api.openPopup('twitter');
                    return false;

                });

                $(api.element).on('click', '#facebook', function() {
                    api.openPopup('facebook');
                    return false;

                });

                $(api.element).on('click', '#pinterest', function() {
                    api.openPopup('pinterest');
                    return false;

                });

            }
        });

    });

Thank you