/*
Plugin Name: Juiz Social Post Sharer
Plugin URI: http://www.creativejuiz.fr/blog/wordpress/plugin-juiz-social-post-sharer-partage-contenu-reseaux-sociaux
Author: Geoffrey Crofte
*/
jQuery(document).ready(function(a){jQuery.fn.juiz_get_counters=function(){return this.each(function(){var d=a(this).find(".juiz_sps_info_plugin_url").val(),b=a(this).find(".juiz_sps_info_permalink").val(),e=a(this).find(".juiz_sps_link_twitter"),f=a(this).find(".juiz_sps_link_linkedin"),g=a(this).find(".juiz_sps_link_delicious"),h=a(this).find(".juiz_sps_link_facebook"),k=a(this).find(".juiz_sps_link_pinterest"),l=a(this).find(".juiz_sps_link_google"),m=a(this).find(".juiz_sps_link_stumbleupon"), c="";a(this).hasClass("counters_total")&&(c=" juiz_hidden_counter");var n="//feeds.delicious.com/v2/json/urlinfo/data?url="+b+"&callback=?",p="//www.linkedin.com/countserv/count/share?format=jsonp&url="+b+"&callback=?",q="//api.pinterest.com/v1/urls/count.json?callback=?&url="+b,r="//graph.facebook.com/fql?q=SELECT%20like_count,%20total_count,%20share_count,%20click_count,%20comment_count%20FROM%20link_stat%20WHERE%20url%20=%20%22"+b+"%22",t=d+"js/get-noapi-counts.php?nw=google&url="+b,d=d+"js/get-noapi-counts.php?nw=stumble&url="+ b;e.length&&a.getJSON("//cdn.api.twitter.com/1/urls/count.json?url="+b+"&callback=?").done(function(a){e.prepend('<span class="juiz_sps_counter'+c+'">'+a.count+"</span>")});f.length&&a.getJSON(p).done(function(a){f.prepend('<span class="juiz_sps_counter'+c+'">'+a.count+"</span>")});k.length&&a.getJSON(q).done(function(a){k.prepend('<span class="juiz_sps_counter'+c+'">'+a.count+"</span>")});l.length&&a.getJSON(t).done(function(a){l.prepend('<span class="juiz_sps_counter'+c+'">'+a.count.replace("\u00a0", "")+"</span>")});m.length&&a.getJSON(d).done(function(a){m.prepend('<span class="juiz_sps_counter'+c+'">'+a.count+"</span>")});h.length&&a.getJSON(r).done(function(a){var b=0;0<a.data.length&&(b=a.data[0].total_count);h.prepend('<span class="juiz_sps_counter'+c+'">'+b+"</span>")});g.length&&a.getJSON(n).done(function(a){g.prepend('<span class="juiz_sps_counter'+c+'">'+a[0].total_posts+"</span>")})})};jQuery.fn.juiz_update_counters=function(){return this.each(function(){var d=a(this),b=d.find(".juiz_sps_totalcount"), e=b.find(".juiz_sps_t_nb"),f=b.attr("title");b.prepend('<span class="juiz_sps_total_text">'+f+"</span>");setInterval(function(){var b=0;d.find(".juiz_sps_counter").each(function(){b+=parseInt(a(this).text())});e.text(b)},1200)})};a(".juiz_sps_links.juiz_sps_counters").juiz_get_counters();0==a(".juiz_sps_links.juiz_sps_counters.counters_subtotal").length&&a(".juiz_sps_counters .juiz_sps_links_list").juiz_update_counters()});