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

Too much remote calls #215

Closed alexshelkov closed 11 months ago

alexshelkov commented 9 years ago

When tow exactly same groups (or more) of share buttons are displayed (for example one on top of the page and one on the bottom) Sharrre calls remote API every time.

This is what I mean:

<div class="demo1 sharrre" data-url="http://naturalon.com/how-to-have-an-energetic-day-without-stimulants/" data-text="Title" data-title="Shares"></div>
<div class="demo1 sharrre" data-url="http://naturalon.com/how-to-have-an-energetic-day-without-stimulants/" data-text="Title" data-title="Shares"></div>
<div class="demo1 sharrre" data-url="http://naturalon.com/how-to-have-an-energetic-day-without-stimulants/" data-text="Title" data-title="Shares"></div>

<script type="text/javascript">
    jQuery(document).ready(function($){
        jQuery('.demo1').sharrre({
            share: {
                googlePlus: true,
                facebook: true,
                twitter: true
            },
            buttons: {
                googlePlus: {size: 'tall', annotation:'bubble'},
                facebook: {layout: 'box_count'},
                twitter: {count: 'vertical', via: '_JulienH'}
            },
            hover: function(api, options){
                $(api.element).find('.buttons').show();
            },
            hide: function(api, options){
                $(api.element).find('.buttons').hide();
            },
            enableTracking: true
        });
    });
</script>

This code produce 9 calls instead of just 3. URL for pages are the same, so why counts should be different? And why Sharrre have to do extra remote calls?