Sharrre icon indicating copy to clipboard operation
Sharrre copied to clipboard

Too much remote calls

Open alexshelkov opened this issue 10 years ago • 0 comments

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?

alexshelkov avatar Aug 20 '14 13:08 alexshelkov