From 801adfdd477bdfdf52afd6e41ec964897561a4fc Mon Sep 17 00:00:00 2001 From: famfam Date: Sat, 17 May 2014 11:51:02 +0200 Subject: [PATCH 01/37] "javascript:void(0);" instead of "#" Adding "javascript:void(0);" to the element instead of "#" to avoid some issues regarding links behaviors using ajax. Hope this helps for you. --- jquery.sharrre.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 9823bd5..a945421 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -100,8 +100,8 @@ urlJson = { googlePlus: "", - //new FQL method by Sire - facebook: "https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?", + //new FQL method by Sire + facebook: "https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?", //old method facebook: "http://graph.facebook.com/?id={url}&callback=?", //facebook : "http://api.ak.facebook.com/restserver.php?v=1.0&method=links.getStats&urls={url}&format=json" @@ -455,7 +455,7 @@ temp = temp.replace('\u00c2\u00a0', ''); //remove google plus special chars count += parseInt(temp, 10); } - //get the FB total count (shares, likes and more) + //get the FB total count (shares, likes and more) else if(json.data && json.data.length > 0 && typeof json.data[0].total_count !== "undefined"){ //Facebook total count count += parseInt(json.data[0].total_count, 10); } @@ -508,8 +508,8 @@ } else{ //template by defaults $(this.element).html( - '
' + total + '' + - (this.options.title !== '' ? '' : '') + + '
' + total + '' + + (this.options.title !== '' ? '' : '') + '
' ); } From d5b784bc4bb1118d680ab2a63ff27285cb06ee02 Mon Sep 17 00:00:00 2001 From: famfam Date: Sat, 17 May 2014 12:00:35 +0200 Subject: [PATCH 02/37] Add hashtags in twitter popup Add the hashtags in the uri of twitter popup --- jquery.sharrre.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index a945421..ddc17af 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -325,7 +325,7 @@ window.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((opt.buttons.facebook.url !== '' ? opt.buttons.facebook.url : opt.url))+"&t="+opt.text+"", "", "toolbar=0, status=0, width=900, height=500"); }, twitter: function(opt){ - window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(opt.text)+"&url="+encodeURIComponent((opt.buttons.twitter.url !== '' ? opt.buttons.twitter.url : opt.url))+(opt.buttons.twitter.via !== '' ? '&via='+opt.buttons.twitter.via : ''), "", "toolbar=0, status=0, width=650, height=360"); + window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(opt.text)+"&url="+encodeURIComponent((opt.buttons.twitter.url !== '' ? opt.buttons.twitter.url : opt.url))+(opt.buttons.twitter.via !== '' ? '&via='+opt.buttons.twitter.via : '')+(opt.buttons.twitter.hashtags !== '' ? '&hashtags='+encodeURIComponent(opt.buttons.twitter.hashtags) : ''), "", "toolbar=0, status=0, width=650, height=360"); }, digg: function(opt){ window.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((opt.buttons.digg.url !== '' ? opt.buttons.digg.url : opt.url))+"&title="+opt.text+"&related=true&style=true", "", "toolbar=0, status=0, width=650, height=360"); From bcf958fdd92fc62b614f119372f1659eb8ef45ab Mon Sep 17 00:00:00 2001 From: famfam Date: Sat, 17 May 2014 12:11:57 +0200 Subject: [PATCH 03/37] Updated to universal analytics tracking code Updated to universal analytics tracking code. --- jquery.sharrre.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index ddc17af..1b68792 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -271,13 +271,13 @@ fb = window.setInterval(function(){ if (typeof FB !== 'undefined') { FB.Event.subscribe('edge.create', function(targetUrl) { - _gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]); + ga('send', 'social', 'facebook', 'like', targetUrl); }); FB.Event.subscribe('edge.remove', function(targetUrl) { - _gaq.push(['_trackSocial', 'facebook', 'unlike', targetUrl]); + ga('send', 'social', 'facebook', 'unlike', targetUrl); }); FB.Event.subscribe('message.send', function(targetUrl) { - _gaq.push(['_trackSocial', 'facebook', 'send', targetUrl]); + ga('send', 'social', 'facebook', 'like', targetUrl); }); //console.log('ok'); clearInterval(fb); @@ -290,7 +290,7 @@ if (typeof twttr !== 'undefined') { twttr.events.bind('tweet', function(event) { if (event) { - _gaq.push(['_trackSocial', 'twitter', 'tweet']); + ga('send', 'social', 'twitter', 'tweet'); } }); //console.log('ok'); @@ -308,7 +308,7 @@ stumbleupon: function(){}, linkedin: function(){ function LinkedInShare() { - _gaq.push(['_trackSocial', 'linkedin', 'share']); + ga('send', 'social', 'linkedin', 'share'); } }, pinterest: function(){ @@ -541,7 +541,7 @@ linkedin: {site: 'linkedin', action: 'share'}, pinterest: {site: 'pinterest', action: 'pin'} }; - _gaq.push(['_trackSocial', tracking[site].site, tracking[site].action]); + ga('send', 'social', tracking[site].site, tracking[site].action); } }; From a2d737853ebb6e978dfb64715ca01aee95fb6443 Mon Sep 17 00:00:00 2001 From: famfam Date: Sat, 17 May 2014 13:03:44 +0200 Subject: [PATCH 04/37] Minify jquery.sharrre --- jquery.sharrre.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.sharrre.min.js b/jquery.sharrre.min.js index 377659a..a10de47 100644 --- a/jquery.sharrre.min.js +++ b/jquery.sharrre.min.js @@ -4,4 +4,4 @@ * Author: Julien Hany * License: MIT http://en.wikipedia.org/wiki/MIT_License or GPLv2 http://en.wikipedia.org/wiki/GNU_General_Public_License */ -;(function(g,i,j,b){var h="sharrre",f={className:"sharrre",share:{googlePlus:false,facebook:false,twitter:false,digg:false,delicious:false,stumbleupon:false,linkedin:false,pinterest:false},shareTotal:0,template:"",title:"",url:j.location.href,text:j.title,urlCurl:"sharrre.php",count:{},total:0,shorterTotal:true,enableHover:true,enableCounter:true,enableTracking:false,hover:function(){},hide:function(){},click:function(){},render:function(){},buttons:{googlePlus:{url:"",urlCount:false,size:"medium",lang:"en-US",annotation:""},facebook:{url:"",urlCount:false,action:"like",layout:"button_count",width:"",send:"false",faces:"false",colorscheme:"",font:"",lang:"en_US"},twitter:{url:"",urlCount:false,count:"horizontal",hashtags:"",via:"",related:"",lang:"en"},digg:{url:"",urlCount:false,type:"DiggCompact"},delicious:{url:"",urlCount:false,size:"medium"},stumbleupon:{url:"",urlCount:false,layout:"1"},linkedin:{url:"",urlCount:false,counter:""},pinterest:{url:"",media:"",description:"",layout:"horizontal"}}},c={googlePlus:"",facebook:"https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?",twitter:"http://cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?",digg:"http://services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?",delicious:"http://feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?",stumbleupon:"",linkedin:"http://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?",pinterest:"http://api.pinterest.com/v1/urls/count.json?url={url}&callback=?"},l={googlePlus:function(m){var n=m.options.buttons.googlePlus;g(m.element).find(".buttons").append('
');i.___gcfg={lang:m.options.buttons.googlePlus.lang};var o=0;if(typeof gapi==="undefined"&&o==0){o=1;(function(){var p=j.createElement("script");p.type="text/javascript";p.async=true;p.src="//apis.google.com/js/plusone.js";var q=j.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{gapi.plusone.go()}},facebook:function(m){var n=m.options.buttons.facebook;g(m.element).find(".buttons").append('');var o=0;if(typeof FB==="undefined"&&o==0){o=1;(function(t,p,u){var r,q=t.getElementsByTagName(p)[0];if(t.getElementById(u)){return}r=t.createElement(p);r.id=u;r.src="//connect.facebook.net/"+n.lang+"/all.js#xfbml=1";q.parentNode.insertBefore(r,q)}(j,"script","facebook-jssdk"))}else{FB.XFBML.parse()}},twitter:function(m){var n=m.options.buttons.twitter;g(m.element).find(".buttons").append('');var o=0;if(typeof twttr==="undefined"&&o==0){o=1;(function(){var q=j.createElement("script");q.type="text/javascript";q.async=true;q.src="//platform.twitter.com/widgets.js";var p=j.getElementsByTagName("script")[0];p.parentNode.insertBefore(q,p)})()}else{g.ajax({url:"//platform.twitter.com/widgets.js",dataType:"script",cache:true})}},digg:function(m){var n=m.options.buttons.digg;g(m.element).find(".buttons").append('
');var o=0;if(typeof __DBW==="undefined"&&o==0){o=1;(function(){var q=j.createElement("SCRIPT"),p=j.getElementsByTagName("SCRIPT")[0];q.type="text/javascript";q.async=true;q.src="//widgets.digg.com/buttons.js";p.parentNode.insertBefore(q,p)})()}},delicious:function(o){if(o.options.buttons.delicious.size=="tall"){var p="width:50px;",n="height:35px;width:50px;font-size:15px;line-height:35px;",m="height:18px;line-height:18px;margin-top:3px;"}else{var p="width:93px;",n="float:right;padding:0 3px;height:20px;width:26px;line-height:20px;",m="float:left;height:20px;line-height:20px;"}var q=o.shorterTotal(o.options.count.delicious);if(typeof q==="undefined"){q=0}g(o.element).find(".buttons").append('
'+q+'
Delicious Add
');g(o.element).find(".delicious").on("click",function(){o.openPopup("delicious")})},stumbleupon:function(m){var n=m.options.buttons.stumbleupon;g(m.element).find(".buttons").append('
');var o=0;if(typeof STMBLPN==="undefined"&&o==0){o=1;(function(){var p=j.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.stumbleupon.com/1/widgets.js";var q=j.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})();s=i.setTimeout(function(){if(typeof STMBLPN!=="undefined"){STMBLPN.processWidgets();clearInterval(s)}},500)}else{STMBLPN.processWidgets()}},linkedin:function(m){var n=m.options.buttons.linkedin;g(m.element).find(".buttons").append('
');var m=0;if(typeof g.IN==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.linkedin.com/in.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{g.IN.init()}},pinterest:function(m){var n=m.options.buttons.pinterest;f(m.element).find(".buttons").append('');(function(){var o=d.createElement("script");o.type="text/javascript";o.async=true;o.src="//assets.pinterest.com/js/pinit.js";var p=d.getElementsByTagName("script")[0];p.parentNode.insertBefore(o,p)})()}},j={googlePlus:function(){},facebook:function(){fb=g.setInterval(function(){if(typeof FB!=="undefined"){FB.Event.subscribe("edge.create",function(m){ga("send","social","facebook","like",m)});FB.Event.subscribe("edge.remove",function(m){ga("send","social","facebook","unlike",m)});FB.Event.subscribe("message.send",function(m){ga("send","social","facebook","like",m)});clearInterval(fb)}},1000)},twitter:function(){tw=g.setInterval(function(){if(typeof twttr!=="undefined"){twttr.events.bind("tweet",function(m){if(m){ga("send","social","twitter","tweet")}});clearInterval(tw)}},1000)},digg:function(){},delicious:function(){},stumbleupon:function(){},linkedin:function(){function m(){ga("send","social","linkedin","share")}},pinterest:function(){}},b={googlePlus:function(m){g.open("https://plus.google.com/share?hl="+m.buttons.googlePlus.lang+"&url="+encodeURIComponent((m.buttons.googlePlus.url!==""?m.buttons.googlePlus.url:m.url)),"","toolbar=0, status=0, width=900, height=500")},facebook:function(m){g.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((m.buttons.facebook.url!==""?m.buttons.facebook.url:m.url))+"&t="+m.text+"","","toolbar=0, status=0, width=900, height=500")},twitter:function(m){g.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(m.text)+"&url="+encodeURIComponent((m.buttons.twitter.url!==""?m.buttons.twitter.url:m.url))+(m.buttons.twitter.via!==""?"&via="+m.buttons.twitter.via:"")+(m.buttons.twitter.hashtags!==""?"&hashtags="+encodeURIComponent(m.buttons.twitter.hashtags):""),"","toolbar=0, status=0, width=650, height=360")},digg:function(m){g.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((m.buttons.digg.url!==""?m.buttons.digg.url:m.url))+"&title="+m.text+"&related=true&style=true","","toolbar=0, status=0, width=650, height=360")},delicious:function(m){g.open("http://www.delicious.com/save?v=5&noui&jump=close&url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&title="+m.text,"delicious","toolbar=no,width=550,height=550")},stumbleupon:function(m){g.open("http://www.stumbleupon.com/badge/?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url)),"stumbleupon","toolbar=no,width=550,height=550")},linkedin:function(m){g.open("https://www.linkedin.com/cws/share?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&token=&isFramed=true","linkedin","toolbar=no,width=550,height=550")},pinterest:function(m){g.open("http://pinterest.com/pin/create/button/?url="+encodeURIComponent((m.buttons.pinterest.url!==""?m.buttons.pinterest.url:m.url))+"&media="+encodeURIComponent(m.buttons.pinterest.media)+"&description="+m.buttons.pinterest.description,"pinterest","toolbar=no,width=700,height=300")}};function i(m,n){this.element=m;this.options=f.extend(true,{},l,n);this.options.share=n.share;this._defaults=l;this._name=c;this.init()}i.prototype.init=function(){var m=this;if(this.options.urlCurl!==""){h.googlePlus=this.options.urlCurl+"?url={url}&type=googlePlus";h.stumbleupon=this.options.urlCurl+"?url={url}&type=stumbleupon"}f(this.element).addClass(this.options.className);if(typeof f(this.element).data("title")!=="undefined"){this.options.title=f(this.element).attr("data-title")}if(typeof f(this.element).data("url")!=="undefined"){this.options.url=f(this.element).data("url")}if(typeof f(this.element).data("text")!=="undefined"){this.options.text=f(this.element).data("text")}f.each(this.options.share,function(o,n){if(n===true){m.options.shareTotal++}});if(m.options.enableCounter===true){f.each(this.options.share,function(p,o){if(o===true){try{m.getSocialJson(p)}catch(n){}}})}else{if(m.options.template!==""){this.options.render(this,this.options)}else{this.loadButtons()}}f(this.element).hover(function(){if(f(this).find(".buttons").length===0&&m.options.enableHover===true){m.loadButtons()}m.options.hover(m,m.options)},function(){m.options.hide(m,m.options)});f(this.element).click(function(){m.options.click(m,m.options);return false})};i.prototype.loadButtons=function(){var m=this;f(this.element).append('
');f.each(m.options.share,function(o,n){if(n==true){k[o](m);if(m.options.enableTracking===true){j[o]()}}})};i.prototype.getSocialJson=function(p){var o=this,n=0,m=h[p].replace("{url}",encodeURIComponent(this.options.url));if(this.options.buttons[p].urlCount===true&&this.options.buttons[p].url!==""){m=h[p].replace("{url}",this.options.buttons[p].url)}if(m!=""&&o.options.urlCurl!==""){f.getJSON(m,function(q){if(typeof q.count!=="undefined"){var r=q.count+"";r=r.replace("\u00c2\u00a0","");n+=parseInt(r,10)}else{if(q.data&&q.data.length>0&&typeof q.data[0].total_count!=="undefined"){n+=parseInt(q.data[0].total_count,10)}else{if(typeof q[0]!=="undefined"){n+=parseInt(q[0].total_posts,10)}else{if(typeof q[0]!=="undefined"){}}}}o.options.count[p]=n;o.options.total+=n;o.renderer();o.rendererPerso()}).error(function(){o.options.count[p]=0;o.rendererPerso()})}else{o.renderer();o.options.count[p]=0;o.rendererPerso()}};i.prototype.rendererPerso=function(){var m=0;for(e in this.options.count){m++}if(m===this.options.shareTotal){this.options.render(this,this.options)}};i.prototype.renderer=function(){var n=this.options.total,m=this.options.template;if(this.options.shorterTotal===true){n=this.shorterTotal(n)}if(m!==""){m=m.replace("{total}",n);f(this.element).html(m)}else{f(this.element).html('
'+n+""+(this.options.title!==""?'":"")+"
")}};i.prototype.shorterTotal=function(m){if(m>=1000000){m=(m/1000000).toFixed(2)+"M"}else{if(m>=1000){m=(m/1000).toFixed(1)+"k"}}return m};i.prototype.openPopup=function(m){b[m](this.options);if(this.options.enableTracking===true){var n={googlePlus:{site:"Google",action:"+1"},facebook:{site:"facebook",action:"like"},twitter:{site:"twitter",action:"tweet"},digg:{site:"digg",action:"add"},delicious:{site:"delicious",action:"add"},stumbleupon:{site:"stumbleupon",action:"add"},linkedin:{site:"linkedin",action:"share"},pinterest:{site:"pinterest",action:"pin"}};ga("send","social",n[m].site,n[m].action)}};i.prototype.simulateClick=function(){var m=f(this.element).html();f(this.element).html(m.replace(this.options.total,this.options.total+1))};i.prototype.update=function(n,m){if(n!==""){this.options.url=n}if(m!==""){this.options.text=m}};f.fn[c]=function(m){var n=arguments;if(m===a||typeof m==="object"){return this.each(function(){if(!f.data(this,"plugin_"+c)){f.data(this,"plugin_"+c,new i(this,m))}})}else{if(typeof m==="string"&&m[0]!=="_"&&m!=="init"){return this.each(function(){var o=f.data(this,"plugin_"+c);if(o instanceof i&&typeof o[m]==="function"){o[m].apply(o,Array.prototype.slice.call(n,1))}})}}}})(jQuery,window,document); From 912b6f4a76e5d2c213c842baaafedbec660f69f5 Mon Sep 17 00:00:00 2001 From: famfam Date: Wed, 9 Jul 2014 18:06:47 +0200 Subject: [PATCH 05/37] Add email option. --- jquery.sharrre.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 1b68792..9345c2c 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -92,6 +92,9 @@ media: '', description: '', layout: 'horizontal' + }, + email: { // Send by email + url: '' } } }, @@ -341,6 +344,9 @@ }, pinterest: function(opt){ window.open('http://pinterest.com/pin/create/button/?url='+encodeURIComponent((opt.buttons.pinterest.url !== '' ? opt.buttons.pinterest.url : opt.url))+'&media='+encodeURIComponent(opt.buttons.pinterest.media)+'&description='+opt.buttons.pinterest.description, 'pinterest', 'toolbar=no,width=700,height=300'); + }, + email: function (opt) { + window.open('mailto:?body=' + (opt.buttons.email.url !== '' ? opt.buttons.email.url : opt.url) + '&subject=' + opt.text, 'email', 'toolbar=no,width=550,height=550'); } }; From 324f3a7a3856f39046b0d4bcdbec5183119dbb8e Mon Sep 17 00:00:00 2001 From: famfam Date: Wed, 9 Jul 2014 18:49:50 +0200 Subject: [PATCH 06/37] fixed popups --- jquery.sharrre.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 9345c2c..4e27ac6 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -321,29 +321,29 @@ /* Popup for each social network ================================================== */ popup = { - googlePlus: function(opt){ - window.open("https://plus.google.com/share?hl="+opt.buttons.googlePlus.lang+"&url="+encodeURIComponent((opt.buttons.googlePlus.url !== '' ? opt.buttons.googlePlus.url : opt.url)), "", "toolbar=0, status=0, width=900, height=500"); + googlePlus: function (opt) { + window.open("https://plus.google.com/share?hl=" + opt.buttons.googlePlus.lang + "&url=" + encodeURIComponent((opt.buttons.googlePlus.url !== '' ? opt.buttons.googlePlus.url : opt.url)), "", "toolbar=0, status=0, width=320, height=640"); }, - facebook: function(opt){ - window.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((opt.buttons.facebook.url !== '' ? opt.buttons.facebook.url : opt.url))+"&t="+opt.text+"", "", "toolbar=0, status=0, width=900, height=500"); + facebook: function (opt) { + window.open("http://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent((opt.buttons.facebook.url !== '' ? opt.buttons.facebook.url : opt.url)) + "&t=" + opt.text + "", "", "toolbar=0, status=0, width=320, height=500"); }, - twitter: function(opt){ - window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(opt.text)+"&url="+encodeURIComponent((opt.buttons.twitter.url !== '' ? opt.buttons.twitter.url : opt.url))+(opt.buttons.twitter.via !== '' ? '&via='+opt.buttons.twitter.via : '')+(opt.buttons.twitter.hashtags !== '' ? '&hashtags='+encodeURIComponent(opt.buttons.twitter.hashtags) : ''), "", "toolbar=0, status=0, width=650, height=360"); + twitter: function (opt) { + window.open("https://twitter.com/intent/tweet?text=" + encodeURIComponent(opt.text) + "&url=" + encodeURIComponent((opt.buttons.twitter.url !== '' ? opt.buttons.twitter.url : opt.url)) + (opt.buttons.twitter.via !== '' ? '&via=' + opt.buttons.twitter.via : ''), "", "toolbar=0, status=0, width=320, height=450"); }, - digg: function(opt){ - window.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((opt.buttons.digg.url !== '' ? opt.buttons.digg.url : opt.url))+"&title="+opt.text+"&related=true&style=true", "", "toolbar=0, status=0, width=650, height=360"); + digg: function (opt) { + window.open("http://digg.com/tools/diggthis/submit?url=" + encodeURIComponent((opt.buttons.digg.url !== '' ? opt.buttons.digg.url : opt.url)) + "&title=" + opt.text + "&related=true&style=true", "", "toolbar=0, status=0, width=650, height=360"); }, - delicious: function(opt){ - window.open('http://www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent((opt.buttons.delicious.url !== '' ? opt.buttons.delicious.url : opt.url))+'&title='+opt.text, 'delicious', 'toolbar=no,width=550,height=550'); + delicious: function (opt) { + window.open('http://www.delicious.com/save?v=5&noui&jump=close&url=' + encodeURIComponent((opt.buttons.delicious.url !== '' ? opt.buttons.delicious.url : opt.url)) + '&title=' + opt.text, 'delicious', 'toolbar=no,width=550,height=550'); }, - stumbleupon: function(opt){ - window.open('http://www.stumbleupon.com/badge/?url='+encodeURIComponent((opt.buttons.delicious.url !== '' ? opt.buttons.delicious.url : opt.url)), 'stumbleupon', 'toolbar=no,width=550,height=550'); + stumbleupon: function (opt) { + window.open('http://www.stumbleupon.com/badge/?url=' + encodeURIComponent((opt.buttons.stumbleupon.url !== '' ? opt.buttons.stumbleupon.url : opt.url)), 'stumbleupon', 'toolbar=no,width=550,height=550'); }, - linkedin: function(opt){ - window.open('https://www.linkedin.com/cws/share?url='+encodeURIComponent((opt.buttons.delicious.url !== '' ? opt.buttons.delicious.url : opt.url))+'&token=&isFramed=true', 'linkedin', 'toolbar=no,width=550,height=550'); + linkedin: function (opt) { + window.open('https://www.linkedin.com/cws/share?url=' + encodeURIComponent((opt.buttons.linkedin.url !== '' ? opt.buttons.linkedin.url : opt.url)) + '&token=&isFramed=true', 'linkedin', 'toolbar=no,width=550,height=550'); }, - pinterest: function(opt){ - window.open('http://pinterest.com/pin/create/button/?url='+encodeURIComponent((opt.buttons.pinterest.url !== '' ? opt.buttons.pinterest.url : opt.url))+'&media='+encodeURIComponent(opt.buttons.pinterest.media)+'&description='+opt.buttons.pinterest.description, 'pinterest', 'toolbar=no,width=700,height=300'); + pinterest: function (opt) { + window.open('http://pinterest.com/pin/create/button/?url=' + encodeURIComponent((opt.buttons.pinterest.url !== '' ? opt.buttons.pinterest.url : opt.url)) + '&media=' + encodeURIComponent(opt.buttons.pinterest.media) + '&description=' + opt.buttons.pinterest.description, 'pinterest', 'toolbar=no,width=700,height=300'); }, email: function (opt) { window.open('mailto:?body=' + (opt.buttons.email.url !== '' ? opt.buttons.email.url : opt.url) + '&subject=' + opt.text, 'email', 'toolbar=no,width=550,height=550'); From 0d181b41f1d15597e57572da03f34ce5d8d93960 Mon Sep 17 00:00:00 2001 From: Brando Meniconi Date: Thu, 4 Sep 2014 13:01:43 +0200 Subject: [PATCH 07/37] added twitter hastags option in poput function --- jquery.sharrre.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 710e1b8..fbeaa1b 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -325,7 +325,7 @@ window.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((opt.buttons.facebook.url !== '' ? opt.buttons.facebook.url : opt.url))+"&t="+opt.text+"", "", "toolbar=0, status=0, width=900, height=500"); }, twitter: function(opt){ - window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(opt.text)+"&url="+encodeURIComponent((opt.buttons.twitter.url !== '' ? opt.buttons.twitter.url : opt.url))+(opt.buttons.twitter.via !== '' ? '&via='+opt.buttons.twitter.via : ''), "", "toolbar=0, status=0, width=650, height=360"); + window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(opt.text)+"&url="+encodeURIComponent((opt.buttons.twitter.url !== '' ? opt.buttons.twitter.url : opt.url))+(opt.buttons.twitter.via !== '' ? '&via='+opt.buttons.twitter.via : '')+(opt.buttons.twitter.hashtags !== '' ? '&hashtags='+encodeURIComponent(opt.buttons.twitter.hashtags) : ''), "", "toolbar=0, status=0, width=650, height=360"); }, digg: function(opt){ window.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((opt.buttons.digg.url !== '' ? opt.buttons.digg.url : opt.url))+"&title="+opt.text+"&related=true&style=true", "", "toolbar=0, status=0, width=650, height=360"); From 73bd4fda08be441334bbe27de9658d040d9bb100 Mon Sep 17 00:00:00 2001 From: Greg Mercer Date: Fri, 5 Sep 2014 14:16:54 -0700 Subject: [PATCH 08/37] Changes for support of google analytics.js --- jquery.sharrre.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 710e1b8..45110ff 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -271,13 +271,16 @@ fb = window.setInterval(function(){ if (typeof FB !== 'undefined') { FB.Event.subscribe('edge.create', function(targetUrl) { - _gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]); + //_gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]); + ga('send', 'social', 'facebook', 'like', targetUrl); }); FB.Event.subscribe('edge.remove', function(targetUrl) { - _gaq.push(['_trackSocial', 'facebook', 'unlike', targetUrl]); + //_gaq.push(['_trackSocial', 'facebook', 'unlike', targetUrl]); + ga('send', 'social', 'facebook', 'unlike', targetUrl); }); FB.Event.subscribe('message.send', function(targetUrl) { - _gaq.push(['_trackSocial', 'facebook', 'send', targetUrl]); + //_gaq.push(['_trackSocial', 'facebook', 'send', targetUrl]); + ga('send', 'social', 'facebook', 'send', targetUrl); }); //console.log('ok'); clearInterval(fb); @@ -290,7 +293,8 @@ if (typeof twttr !== 'undefined') { twttr.events.bind('tweet', function(event) { if (event) { - _gaq.push(['_trackSocial', 'twitter', 'tweet']); + //_gaq.push(['_trackSocial', 'twitter', 'tweet']); + ga('send', 'social', 'twitter', 'tweet'); } }); //console.log('ok'); @@ -308,7 +312,8 @@ stumbleupon: function(){}, linkedin: function(){ function LinkedInShare() { - _gaq.push(['_trackSocial', 'linkedin', 'share']); + //_gaq.push(['_trackSocial', 'linkedin', 'share']); + ga('send', 'social', 'linkedin', 'share'); } }, pinterest: function(){ @@ -541,7 +546,8 @@ linkedin: {site: 'linkedin', action: 'share'}, pinterest: {site: 'pinterest', action: 'pin'} }; - _gaq.push(['_trackSocial', tracking[site].site, tracking[site].action]); + //_gaq.push(['_trackSocial', tracking[site].site, tracking[site].action]); + ga('send', 'social', tracking[site].site, tracking[site].action); } }; From 8687f9e49c351fcd583e6aa0ae4fee9e9060ed70 Mon Sep 17 00:00:00 2001 From: Greg Mercer Date: Mon, 8 Sep 2014 08:48:32 -0700 Subject: [PATCH 09/37] Updated the simulateClick function have the option of using a className --- jquery.sharrre.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 45110ff..eaae8d8 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -553,9 +553,13 @@ /* Methode for add +1 to a counter ================================================== */ - Plugin.prototype.simulateClick = function () { + Plugin.prototype.simulateClick = function (className) { var html = $(this.element).html(); - $(this.element).html(html.replace(this.options.total, this.options.total+1)); + if (className === undefined) { + $(this.element).html(html.replace(this.options.total, this.options.total+1)); + } else { + $('.'+className).html(html.replace(this.options.total, this.options.total+1)); + } }; /* Methode for add +1 to a counter From 095dec918d2e8d4e3da60aa16ed1b2651ef8b7d4 Mon Sep 17 00:00:00 2001 From: Greg Mercer Date: Fri, 19 Sep 2014 10:55:51 -0700 Subject: [PATCH 10/37] WP-4320 Changed to correct the ga send that occurs when opening the popup. --- jquery.sharrre.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index eaae8d8..e4eba7e 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -294,7 +294,7 @@ twttr.events.bind('tweet', function(event) { if (event) { //_gaq.push(['_trackSocial', 'twitter', 'tweet']); - ga('send', 'social', 'twitter', 'tweet'); + ga('send', 'social', 'twitter', 'tweet'); } }); //console.log('ok'); @@ -538,7 +538,7 @@ if(this.options.enableTracking === true){ //tracking! var tracking = { googlePlus: {site: 'Google', action: '+1'}, - facebook: {site: 'facebook', action: 'like'}, + facebook: {site: 'facebook', action: 'share'}, twitter: {site: 'twitter', action: 'tweet'}, digg: {site: 'digg', action: 'add'}, delicious: {site: 'delicious', action: 'add'}, @@ -547,19 +547,20 @@ pinterest: {site: 'pinterest', action: 'pin'} }; //_gaq.push(['_trackSocial', tracking[site].site, tracking[site].action]); - ga('send', 'social', tracking[site].site, tracking[site].action); + //ga('send', 'social', tracking[site].site, tracking[site].action); + ga('send', 'social', { + 'socialNetwork': tracking[site].site, + 'socialAction': tracking[site].action, + 'socialTarget': this.options.url + }); } }; /* Methode for add +1 to a counter ================================================== */ - Plugin.prototype.simulateClick = function (className) { + Plugin.prototype.simulateClick = function () { var html = $(this.element).html(); - if (className === undefined) { - $(this.element).html(html.replace(this.options.total, this.options.total+1)); - } else { - $('.'+className).html(html.replace(this.options.total, this.options.total+1)); - } + $(this.element).html(html.replace(this.options.total, this.options.total+1)); }; /* Methode for add +1 to a counter From 3f9bf32332a06f2c67af9a402d85d1cf875b697a Mon Sep 17 00:00:00 2001 From: Greg Mercer Date: Fri, 19 Sep 2014 11:00:24 -0700 Subject: [PATCH 11/37] WP-4320 Passing the classname into simulateClick, as we were doing before. --- jquery.sharrre.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index e4eba7e..f011f1a 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -558,10 +558,14 @@ /* Methode for add +1 to a counter ================================================== */ - Plugin.prototype.simulateClick = function () { + Plugin.prototype.simulateClick = function (className) { var html = $(this.element).html(); - $(this.element).html(html.replace(this.options.total, this.options.total+1)); - }; + if (className === undefined) { + $(this.element).html(html.replace(this.options.total, this.options.total+1)); + } else { + $('.'+className).html(html.replace(this.options.total, this.options.total+1)); + } + }; /* Methode for add +1 to a counter ================================================== */ From 08c1c6f1389f648df53fad7f1801d5e3e032d0fe Mon Sep 17 00:00:00 2001 From: Meghan P Date: Wed, 24 Sep 2014 12:10:13 -0700 Subject: [PATCH 12/37] Wrap the title in a span --- jquery.sharrre.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index f011f1a..d843129 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -514,7 +514,7 @@ else{ //template by defaults $(this.element).html( '
' + total + '' + - (this.options.title !== '' ? '' : '') + + (this.options.title !== '' ? '' : '') + '
' ); } From a70229dd697255c30ef9ee61f58f48ad6872abf8 Mon Sep 17 00:00:00 2001 From: Jamie Emerson Date: Wed, 24 Sep 2014 22:02:43 -0600 Subject: [PATCH 13/37] add tumblr to sharrre options --- jquery.sharrre.js | 84 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 26 deletions(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 710e1b8..565b1ec 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -16,6 +16,7 @@ googlePlus: false, facebook: false, twitter: false, + tumblr: false, digg: false, delicious: false, stumbleupon: false, @@ -67,6 +68,12 @@ related: '', lang: 'en' }, + tumblr: { + url: '', + urlCount: false, + description: '', + name: '' + }, digg: { //http://about.digg.com/downloads/button/smart url: '', //if you need to personalize url button urlCount: false, //if you want to use personnalize button url on global counter @@ -104,10 +111,11 @@ facebook: "https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?", //old method facebook: "http://graph.facebook.com/?id={url}&callback=?", //facebook : "http://api.ak.facebook.com/restserver.php?v=1.0&method=links.getStats&urls={url}&format=json" - + twitter: "http://cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?", digg: "http://services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?", delicious: 'http://feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?', + tumblr: "", //stumbleupon: "http://www.stumbleupon.com/services/1.01/badge.getinfo?url={url}&format=jsonp&callback=?", stumbleupon: "", linkedin: "http://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?", @@ -173,6 +181,25 @@ $.ajax({ url: '//platform.twitter.com/widgets.js', dataType: 'script', cache:true}); //http://stackoverflow.com/q/6536108 } }, + tumblr: function(self) { + var sett = self.options.buttons.tumblr; + $(self.element).find('.buttons').append('
Share on Tumblr
') + var loading = 0; + if(typeof Tumblr === 'undefined' && loading == 0) { + loading = 1; + (function() { + var tumblrScriptTag = document.createElement('script'); + var s = document.getElementsByTagName('script')[0]; + tumblrScriptTag.type = 'text/javascript'; + tumblrScriptTag.async = true; + tumblrScriptTag.src = '//platform.tumblr.com/v1/share.js'; + s.parentNode.insertBefore(tumblrScriptTag, s); + })(); + } + else { + Tumblr.activate_share_on_tumblr_buttons(); + } + }, digg : function(self){ var sett = self.options.buttons.digg; $(self.element).find('.buttons').append('
'); @@ -208,7 +235,7 @@ '
'+count+'
'+ '
'+ 'Delicious Add
'); - + $(self.element).find('.delicious').on('click', function(){ self.openPopup('delicious'); }); @@ -221,7 +248,7 @@ loading = 1; (function() { var li = document.createElement('script');li.type = 'text/javascript';li.async = true; - li.src = '//platform.stumbleupon.com/1/widgets.js'; + li.src = '//platform.stumbleupon.com/1/widgets.js'; var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s); })(); s = window.setTimeout(function(){ @@ -243,7 +270,7 @@ loading = 1; (function() { var li = document.createElement('script');li.type = 'text/javascript';li.async = true; - li.src = '//platform.linkedin.com/in.js'; + li.src = '//platform.linkedin.com/in.js'; var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s); })(); } @@ -257,7 +284,7 @@ (function() { var li = document.createElement('script');li.type = 'text/javascript';li.async = true; - li.src = '//assets.pinterest.com/js/pinit.js'; + li.src = '//assets.pinterest.com/js/pinit.js'; var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s); })(); } @@ -298,6 +325,7 @@ } },1000); }, + tumblr: function(){}, digg: function(){ //if somenone find a solution, mail me ! /*$(this.element).find('.digg').on('click', function(){ @@ -327,6 +355,9 @@ twitter: function(opt){ window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(opt.text)+"&url="+encodeURIComponent((opt.buttons.twitter.url !== '' ? opt.buttons.twitter.url : opt.url))+(opt.buttons.twitter.via !== '' ? '&via='+opt.buttons.twitter.via : ''), "", "toolbar=0, status=0, width=650, height=360"); }, + tumblr: function(opt){ + window.open("http://www.tumblr.com/share/link?url="+encodeURIComponent(opt.buttons.tumblr.url) + "&name=" + encodeURIComponent(opt.buttons.tumblr.name) + "&description=" + encodeURIComponent(opt.buttons.tumblr.description), "", "toolbar=0, status=0, width=900, height=500"); + }, digg: function(opt){ window.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((opt.buttons.digg.url !== '' ? opt.buttons.digg.url : opt.url))+"&title="+opt.text+"&related=true&style=true", "", "toolbar=0, status=0, width=650, height=360"); }, @@ -348,16 +379,16 @@ ================================================== */ function Plugin( element, options ) { this.element = element; - + this.options = $.extend( true, {}, defaults, options); this.options.share = options.share; //simple solution to allow order of buttons - + this._defaults = defaults; this._name = pluginName; - + this.init(); }; - + /* Initialization method ================================================== */ Plugin.prototype.init = function () { @@ -367,7 +398,7 @@ urlJson.stumbleupon = this.options.urlCurl + '?url={url}&type=stumbleupon'; // PHP script for Stumbleupon... } $(this.element).addClass(this.options.className); //add class - + //HTML5 Custom data if(typeof $(this.element).data('title') !== 'undefined'){ this.options.title = $(this.element).attr('data-title'); @@ -378,14 +409,14 @@ if(typeof $(this.element).data('text') !== 'undefined'){ this.options.text = $(this.element).data('text'); } - + //how many social website have been selected $.each(this.options.share, function(name, val) { if(val === true){ self.options.shareTotal ++; } }); - + if(self.options.enableCounter === true){ //if for some reason you don't need counter //get count of social share that have been selected $.each(this.options.share, function(name, val) { @@ -404,7 +435,7 @@ else{ // if you want to use official button like example 3 or 5 this.loadButtons(); } - + //add hover event $(this.element).hover(function(){ //load social button if enable and 1 time @@ -415,14 +446,14 @@ }, function(){ self.options.hide(self, self.options); }); - + //click event $(this.element).click(function(){ self.options.click(self, self.options); return false; }); }; - + /* loadButtons methode ================================================== */ Plugin.prototype.loadButtons = function () { @@ -437,7 +468,7 @@ } }); }; - + /* getSocialJson methode ================================================== */ Plugin.prototype.getSocialJson = function (name) { @@ -470,7 +501,7 @@ self.rendererPerso(); //console.log(json); //debug }) - .error(function() { + .error(function() { self.options.count[name] = 0; self.rendererPerso(); }); @@ -481,7 +512,7 @@ self.rendererPerso(); } }; - + /* launch render methode ================================================== */ Plugin.prototype.rendererPerso = function () { @@ -492,7 +523,7 @@ this.options.render(this, this.options); } }; - + /* render methode ================================================== */ Plugin.prototype.renderer = function () { @@ -501,31 +532,31 @@ if(this.options.shorterTotal === true){ //format number like 1.2k or 5M total = this.shorterTotal(total); } - + if(template !== ''){ //if there is a template template = template.replace('{total}', total); $(this.element).html(template); } else{ //template by defaults $(this.element).html( - '
' + total + '' + + '
' + total + '' + (this.options.title !== '' ? '' : '') + '
' ); } }; - + /* format total numbers like 1.2k or 5M ================================================== */ Plugin.prototype.shorterTotal = function (num) { if (num >= 1e6){ num = (num / 1e6).toFixed(2) + "M" - } else if (num >= 1e3){ + } else if (num >= 1e3){ num = (num / 1e3).toFixed(1) + "k" } return num; }; - + /* Methode for open popup ================================================== */ Plugin.prototype.openPopup = function (site) { @@ -535,6 +566,7 @@ googlePlus: {site: 'Google', action: '+1'}, facebook: {site: 'facebook', action: 'like'}, twitter: {site: 'twitter', action: 'tweet'}, + tumblr: {site: 'tumblr', action: 'share'}, digg: {site: 'digg', action: 'add'}, delicious: {site: 'delicious', action: 'add'}, stumbleupon: {site: 'stumbleupon', action: 'add'}, @@ -544,14 +576,14 @@ _gaq.push(['_trackSocial', tracking[site].site, tracking[site].action]); } }; - + /* Methode for add +1 to a counter ================================================== */ Plugin.prototype.simulateClick = function () { var html = $(this.element).html(); $(this.element).html(html.replace(this.options.total, this.options.total+1)); }; - + /* Methode for add +1 to a counter ================================================== */ Plugin.prototype.update = function (url, text) { From eec60803231d1aac498584ed3fb1b422f0e41e79 Mon Sep 17 00:00:00 2001 From: Greg Mercer Date: Mon, 6 Oct 2014 10:38:19 -0700 Subject: [PATCH 14/37] Changing count urls to be defined without protocols --- jquery.sharrre.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index d843129..2a4b32f 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -101,17 +101,17 @@ googlePlus: "", //new FQL method by Sire - facebook: "https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?", - //old method facebook: "http://graph.facebook.com/?id={url}&callback=?", - //facebook : "http://api.ak.facebook.com/restserver.php?v=1.0&method=links.getStats&urls={url}&format=json" + facebook: "//graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?", + //old method facebook: "//graph.facebook.com/?id={url}&callback=?", + //facebook : "//api.ak.facebook.com/restserver.php?v=1.0&method=links.getStats&urls={url}&format=json" - twitter: "http://cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?", - digg: "http://services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?", - delicious: 'http://feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?', - //stumbleupon: "http://www.stumbleupon.com/services/1.01/badge.getinfo?url={url}&format=jsonp&callback=?", + twitter: "//cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?", + digg: "//services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?", + delicious: '//feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?', + //stumbleupon: "//www.stumbleupon.com/services/1.01/badge.getinfo?url={url}&format=jsonp&callback=?", stumbleupon: "", - linkedin: "http://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?", - pinterest: "http://api.pinterest.com/v1/urls/count.json?url={url}&callback=?" + linkedin: "//www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?", + pinterest: "//api.pinterest.com/v1/urls/count.json?url={url}&callback=?" }, /* Load share buttons asynchronously ================================================== */ From 766bbb24fcd3920521f73a03b71794f1768fb8cb Mon Sep 17 00:00:00 2001 From: Adam Moore Date: Mon, 6 Oct 2014 12:10:51 -0700 Subject: [PATCH 15/37] Remove php and index.html. --- index.html | 106 ---------------------------------------------------- sharrre.php | 62 ------------------------------ 2 files changed, 168 deletions(-) delete mode 100644 index.html delete mode 100644 sharrre.php diff --git a/index.html b/index.html deleted file mode 100644 index ebe6eeb..0000000 --- a/index.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - Sharrre.com - - - - - - - -

Sharrre demo

-
-

-
- - - diff --git a/sharrre.php b/sharrre.php deleted file mode 100644 index 867024e..0000000 --- a/sharrre.php +++ /dev/null @@ -1,62 +0,0 @@ -'','count'=>0); - $json['url'] = $_GET['url']; - $url = urlencode($_GET['url']); - $type = urlencode($_GET['type']); - - if(filter_var($_GET['url'], FILTER_VALIDATE_URL)){ - if($type == 'googlePlus'){ //source http://www.helmutgranda.com/2011/11/01/get-a-url-google-count-via-php/ - $contents = parse('https://plusone.google.com/u/0/_/+1/fastbutton?url=' . $url . '&count=true'); - - preg_match( '/window\.__SSR = {c: ([\d]+)/', $contents, $matches ); - - if(isset($matches[0])){ - $json['count'] = (int)str_replace('window.__SSR = {c: ', '', $matches[0]); - } - } - else if($type == 'stumbleupon'){ - $content = parse("http://www.stumbleupon.com/services/1.01/badge.getinfo?url=$url"); - - $result = json_decode($content); - if (isset($result->result->views)) - { - $json['count'] = $result->result->views; - } - - } - } - echo str_replace('\\/','/',json_encode($json)); - - function parse($encUrl){ - $options = array( - CURLOPT_RETURNTRANSFER => true, // return web page - CURLOPT_HEADER => false, // don't return headers - CURLOPT_FOLLOWLOCATION => true, // follow redirects - CURLOPT_ENCODING => "", // handle all encodings - CURLOPT_USERAGENT => 'sharrre', // who am i - CURLOPT_AUTOREFERER => true, // set referer on redirect - CURLOPT_CONNECTTIMEOUT => 5, // timeout on connect - CURLOPT_TIMEOUT => 10, // timeout on response - CURLOPT_MAXREDIRS => 3, // stop after 10 redirects - CURLOPT_SSL_VERIFYHOST => 0, - CURLOPT_SSL_VERIFYPEER => false, - ); - $ch = curl_init(); - - $options[CURLOPT_URL] = $encUrl; - curl_setopt_array($ch, $options); - - $content = curl_exec($ch); - $err = curl_errno($ch); - $errmsg = curl_error($ch); - - curl_close($ch); - - if ($errmsg != '' || $err != '') { - /*print_r($errmsg); - print_r($errmsg);*/ - } - return $content; - } From 773a0625ffd123d18886298f064eb1a42f98ff4a Mon Sep 17 00:00:00 2001 From: trapvincenzo Date: Thu, 13 Nov 2014 13:23:08 +0100 Subject: [PATCH 16/37] Update sharrre.php Proxy support --- sharrre.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sharrre.php b/sharrre.php index 867024e..c3610fd 100644 --- a/sharrre.php +++ b/sharrre.php @@ -5,6 +5,8 @@ $json['url'] = $_GET['url']; $url = urlencode($_GET['url']); $type = urlencode($_GET['type']); + $proxy = null; + $proxyAuth = array(); if(filter_var($_GET['url'], FILTER_VALIDATE_URL)){ if($type == 'googlePlus'){ //source http://www.helmutgranda.com/2011/11/01/get-a-url-google-count-via-php/ @@ -30,6 +32,9 @@ echo str_replace('\\/','/',json_encode($json)); function parse($encUrl){ + global $proxy; + global $proxyAuth; + $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers @@ -45,6 +50,13 @@ function parse($encUrl){ ); $ch = curl_init(); + if ($proxy != null) { + $options[CURLOPT_PROXY] = $proxy; + if (isset($proxyAuth['user']) && isset($proxyAuth['pwd'])) { + $options[CURLOPT_PROXYUSERPWD] = $proxyAuth['user'] . ':' . $proxyAuth['pwd']; + } + } + $options[CURLOPT_URL] = $encUrl; curl_setopt_array($ch, $options); From aad0c472dcece2354b41785737a80fdfcab67bc6 Mon Sep 17 00:00:00 2001 From: Greg Mercer Date: Thu, 20 Nov 2014 11:21:40 -0800 Subject: [PATCH 17/37] WP-4610 Changes related to getting the count values for the social buttons --- jquery.sharrre.js | 135 ++++++++++++++++++++++++++-------------------- 1 file changed, 78 insertions(+), 57 deletions(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 2a4b32f..34f274e 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -104,7 +104,7 @@ facebook: "//graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?", //old method facebook: "//graph.facebook.com/?id={url}&callback=?", //facebook : "//api.ak.facebook.com/restserver.php?v=1.0&method=links.getStats&urls={url}&format=json" - + twitter: "//cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?", digg: "//services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?", delicious: '//feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?', @@ -208,7 +208,7 @@ '
'+count+'
'+ '
'+ 'Delicious Add
'); - + $(self.element).find('.delicious').on('click', function(){ self.openPopup('delicious'); }); @@ -221,7 +221,7 @@ loading = 1; (function() { var li = document.createElement('script');li.type = 'text/javascript';li.async = true; - li.src = '//platform.stumbleupon.com/1/widgets.js'; + li.src = '//platform.stumbleupon.com/1/widgets.js'; var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s); })(); s = window.setTimeout(function(){ @@ -243,7 +243,7 @@ loading = 1; (function() { var li = document.createElement('script');li.type = 'text/javascript';li.async = true; - li.src = '//platform.linkedin.com/in.js'; + li.src = '//platform.linkedin.com/in.js'; var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s); })(); } @@ -257,7 +257,7 @@ (function() { var li = document.createElement('script');li.type = 'text/javascript';li.async = true; - li.src = '//assets.pinterest.com/js/pinit.js'; + li.src = '//assets.pinterest.com/js/pinit.js'; var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s); })(); } @@ -294,7 +294,7 @@ twttr.events.bind('tweet', function(event) { if (event) { //_gaq.push(['_trackSocial', 'twitter', 'tweet']); - ga('send', 'social', 'twitter', 'tweet'); + ga('send', 'social', 'twitter', 'tweet'); } }); //console.log('ok'); @@ -353,16 +353,16 @@ ================================================== */ function Plugin( element, options ) { this.element = element; - + this.options = $.extend( true, {}, defaults, options); this.options.share = options.share; //simple solution to allow order of buttons - + this._defaults = defaults; this._name = pluginName; - + this.init(); }; - + /* Initialization method ================================================== */ Plugin.prototype.init = function () { @@ -372,7 +372,7 @@ urlJson.stumbleupon = this.options.urlCurl + '?url={url}&type=stumbleupon'; // PHP script for Stumbleupon... } $(this.element).addClass(this.options.className); //add class - + //HTML5 Custom data if(typeof $(this.element).data('title') !== 'undefined'){ this.options.title = $(this.element).attr('data-title'); @@ -383,14 +383,14 @@ if(typeof $(this.element).data('text') !== 'undefined'){ this.options.text = $(this.element).data('text'); } - + //how many social website have been selected $.each(this.options.share, function(name, val) { if(val === true){ self.options.shareTotal ++; } }); - + if(self.options.enableCounter === true){ //if for some reason you don't need counter //get count of social share that have been selected $.each(this.options.share, function(name, val) { @@ -409,7 +409,7 @@ else{ // if you want to use official button like example 3 or 5 this.loadButtons(); } - + //add hover event $(this.element).hover(function(){ //load social button if enable and 1 time @@ -420,14 +420,14 @@ }, function(){ self.options.hide(self, self.options); }); - + //click event $(this.element).click(function(){ self.options.click(self, self.options); return false; }); }; - + /* loadButtons methode ================================================== */ Plugin.prototype.loadButtons = function () { @@ -442,43 +442,46 @@ } }); }; - - /* getSocialJson methode + + /* getSocialJson methode ================================================== */ Plugin.prototype.getSocialJson = function (name) { var self = this, count = 0, - url = urlJson[name].replace('{url}', encodeURIComponent(this.options.url)); - if(this.options.buttons[name].urlCount === true && this.options.buttons[name].url !== ''){ - url = urlJson[name].replace('{url}', this.options.buttons[name].url); + url = self.cleanURL(this.options.url,name), + currentURL = self.cleanURL(window.location.href,name); + var urls = [url]; + if (url != currentURL) { + urls[urls.length] = currentURL; } - //console.log('name : ' + name + ' - url : '+url); //debug if(url != '' && self.options.urlCurl !== ''){ //urlCurl = '' if you don't want to used PHP script but used social button - $.getJSON(url, function(json){ - if(typeof json.count !== "undefined"){ //GooglePlus, Stumbleupon, Twitter, Pinterest and Digg - var temp = json.count + ''; - temp = temp.replace('\u00c2\u00a0', ''); //remove google plus special chars - count += parseInt(temp, 10); - } - //get the FB total count (shares, likes and more) - else if(json.data && json.data.length > 0 && typeof json.data[0].total_count !== "undefined"){ //Facebook total count - count += parseInt(json.data[0].total_count, 10); - } - else if(typeof json[0] !== "undefined"){ //Delicious - count += parseInt(json[0].total_posts, 10); - } - else if(typeof json[0] !== "undefined"){ //Stumbleupon - } - self.options.count[name] = count; - self.options.total += count; - self.renderer(); - self.rendererPerso(); - //console.log(json); //debug - }) - .error(function() { - self.options.count[name] = 0; - self.rendererPerso(); - }); + for (var index in urls) { + $.getJSON(urls[index], function(json){ + if(typeof json.count !== "undefined"){ //GooglePlus, Stumbleupon, Twitter, Pinterest and Digg + var temp = json.count + ''; + temp = temp.replace('\u00c2\u00a0', ''); //remove google plus special chars + count += parseInt(temp, 10); + } + //get the FB total count (shares, likes and more) + else if(json.data && json.data.length > 0 && typeof json.data[0].total_count !== "undefined"){ //Facebook total count + count += parseInt(json.data[0].total_count, 10); + } + else if(typeof json[0] !== "undefined"){ //Delicious + count += parseInt(json[0].total_posts, 10); + } + else if(typeof json[0] !== "undefined"){ //Stumbleupon + } + self.options.count[name] += count; + self.options.total += count; + self.renderer(); + self.rendererPerso(); + //console.log(json); //debug + }) + .error(function() { + self.options.count[name] = 0; + self.rendererPerso(); + }); + } } else{ self.renderer(); @@ -486,7 +489,25 @@ self.rendererPerso(); } }; - + + /* clean url + ================================================== */ + Plugin.prototype.cleanURL = function (url, name) { + // Strip paramaters + url = url.replace(window.location.search, ""); + // Strip protocol + url = url.replace(/.*?:\/\//g, ""); + // googlePlus needs the protocol to do the query + if (name == 'googlePlus') { + url = 'http://' + url; + } + url = urlJson[name].replace('{url}', encodeURIComponent(url)); + if(this.options.buttons[name].urlCount === true && this.options.buttons[name].url !== ''){ + url = urlJson[name].replace('{url}', this.options.buttons[name].url); + } + return url; + }; + /* launch render methode ================================================== */ Plugin.prototype.rendererPerso = function () { @@ -497,7 +518,7 @@ this.options.render(this, this.options); } }; - + /* render methode ================================================== */ Plugin.prototype.renderer = function () { @@ -506,31 +527,31 @@ if(this.options.shorterTotal === true){ //format number like 1.2k or 5M total = this.shorterTotal(total); } - + if(template !== ''){ //if there is a template template = template.replace('{total}', total); $(this.element).html(template); } else{ //template by defaults $(this.element).html( - '
' + total + '' + + '
' + total + '' + (this.options.title !== '' ? '' : '') + '
' ); } }; - + /* format total numbers like 1.2k or 5M ================================================== */ Plugin.prototype.shorterTotal = function (num) { if (num >= 1e6){ num = (num / 1e6).toFixed(2) + "M" - } else if (num >= 1e3){ + } else if (num >= 1e3){ num = (num / 1e3).toFixed(1) + "k" } return num; }; - + /* Methode for open popup ================================================== */ Plugin.prototype.openPopup = function (site) { @@ -555,7 +576,7 @@ }); } }; - + /* Methode for add +1 to a counter ================================================== */ Plugin.prototype.simulateClick = function (className) { @@ -565,8 +586,8 @@ } else { $('.'+className).html(html.replace(this.options.total, this.options.total+1)); } - }; - + }; + /* Methode for add +1 to a counter ================================================== */ Plugin.prototype.update = function (url, text) { From 4c8fb6411eef12c3d85f7d56ab5f40b8184a3386 Mon Sep 17 00:00:00 2001 From: Adam Moore Date: Fri, 21 Nov 2014 11:28:32 -0800 Subject: [PATCH 18/37] WP-4610: Adjust how we get the counters. Fix line endings. --- jquery.sharrre.js | 1249 +++++++++++++++++++++++---------------------- 1 file changed, 628 insertions(+), 621 deletions(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 34f274e..86e6724 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -1,621 +1,628 @@ -/*! - * Sharrre.com - Make your sharing widget! - * Version: beta 1.3.5 - * Author: Julien Hany - * License: MIT http://en.wikipedia.org/wiki/MIT_License or GPLv2 http://en.wikipedia.org/wiki/GNU_General_Public_License - */ - -;(function ( $, window, document, undefined ) { - - /* Defaults - ================================================== */ - var pluginName = 'sharrre', - defaults = { - className: 'sharrre', - share: { - googlePlus: false, - facebook: false, - twitter: false, - digg: false, - delicious: false, - stumbleupon: false, - linkedin: false, - pinterest: false - }, - shareTotal: 0, - template: '', - title: '', - url: document.location.href, - text: document.title, - urlCurl: 'sharrre.php', //PHP script for google plus... - count: {}, //counter by social network - total: 0, //total of sharing - shorterTotal: true, //show total by k or M when number is to big - enableHover: true, //disable if you want to personalize hover event with callback - enableCounter: true, //disable if you just want use buttons - enableTracking: false, //tracking with google analitycs - hover: function(){}, //personalize hover event with this callback function - hide: function(){}, //personalize hide event with this callback function - click: function(){}, //personalize click event with this callback function - render: function(){}, //personalize render event with this callback function - buttons: { //settings for buttons - googlePlus : { //http://www.google.com/webmasters/+1/button/ - url: '', //if you need to personnalize button url - urlCount: false, //if you want to use personnalize button url on global counter - size: 'medium', - lang: 'en-US', - annotation: '' - }, - facebook: { //http://developers.facebook.com/docs/reference/plugins/like/ - url: '', //if you need to personalize url button - urlCount: false, //if you want to use personnalize button url on global counter - action: 'like', - layout: 'button_count', - width: '', - send: 'false', - faces: 'false', - colorscheme: '', - font: '', - lang: 'en_US' - }, - twitter: { //http://twitter.com/about/resources/tweetbutton - url: '', //if you need to personalize url button - urlCount: false, //if you want to use personnalize button url on global counter - count: 'horizontal', - hashtags: '', - via: '', - related: '', - lang: 'en' - }, - digg: { //http://about.digg.com/downloads/button/smart - url: '', //if you need to personalize url button - urlCount: false, //if you want to use personnalize button url on global counter - type: 'DiggCompact' - }, - delicious: { - url: '', //if you need to personalize url button - urlCount: false, //if you want to use personnalize button url on global counter - size: 'medium' //medium or tall - }, - stumbleupon: { //http://www.stumbleupon.com/badges/ - url: '', //if you need to personalize url button - urlCount: false, //if you want to use personnalize button url on global counter - layout: '1' - }, - linkedin: { //http://developer.linkedin.com/plugins/share-button - url: '', //if you need to personalize url button - urlCount: false, //if you want to use personnalize button url on global counter - counter: '' - }, - pinterest: { //http://pinterest.com/about/goodies/ - url: '', //if you need to personalize url button - media: '', - description: '', - layout: 'horizontal' - } - } - }, - /* Json URL to get count number - ================================================== */ - urlJson = { - googlePlus: "", - - //new FQL method by Sire - facebook: "//graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?", - //old method facebook: "//graph.facebook.com/?id={url}&callback=?", - //facebook : "//api.ak.facebook.com/restserver.php?v=1.0&method=links.getStats&urls={url}&format=json" - - twitter: "//cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?", - digg: "//services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?", - delicious: '//feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?', - //stumbleupon: "//www.stumbleupon.com/services/1.01/badge.getinfo?url={url}&format=jsonp&callback=?", - stumbleupon: "", - linkedin: "//www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?", - pinterest: "//api.pinterest.com/v1/urls/count.json?url={url}&callback=?" - }, - /* Load share buttons asynchronously - ================================================== */ - loadButton = { - googlePlus : function(self){ - var sett = self.options.buttons.googlePlus; - //$(self.element).find('.buttons').append('
'); - $(self.element).find('.buttons').append('
'); - window.___gcfg = { - lang: self.options.buttons.googlePlus.lang - }; - var loading = 0; - if(typeof gapi === 'undefined' && loading == 0){ - loading = 1; - (function() { - var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; - po.src = '//apis.google.com/js/plusone.js'; - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); - })(); - } - else{ - gapi.plusone.go(); - } - }, - facebook : function(self){ - var sett = self.options.buttons.facebook; - $(self.element).find('.buttons').append(''); - var loading = 0; - if(typeof FB === 'undefined' && loading == 0){ - loading = 1; - (function(d, s, id) { - var js, fjs = d.getElementsByTagName(s)[0]; - if (d.getElementById(id)) {return;} - js = d.createElement(s); js.id = id; - js.src = '//connect.facebook.net/'+sett.lang+'/all.js#xfbml=1'; - fjs.parentNode.insertBefore(js, fjs); - }(document, 'script', 'facebook-jssdk')); - } - else{ - FB.XFBML.parse(); - } - }, - twitter : function(self){ - var sett = self.options.buttons.twitter; - $(self.element).find('.buttons').append(''); - var loading = 0; - if(typeof twttr === 'undefined' && loading == 0){ - loading = 1; - (function() { - var twitterScriptTag = document.createElement('script'); - twitterScriptTag.type = 'text/javascript'; - twitterScriptTag.async = true; - twitterScriptTag.src = '//platform.twitter.com/widgets.js'; - var s = document.getElementsByTagName('script')[0]; - s.parentNode.insertBefore(twitterScriptTag, s); - })(); - } - else{ - $.ajax({ url: '//platform.twitter.com/widgets.js', dataType: 'script', cache:true}); //http://stackoverflow.com/q/6536108 - } - }, - digg : function(self){ - var sett = self.options.buttons.digg; - $(self.element).find('.buttons').append('
'); - var loading = 0; - if(typeof __DBW === 'undefined' && loading == 0){ - loading = 1; - (function() { - var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0]; - s.type = 'text/javascript'; - s.async = true; - s.src = '//widgets.digg.com/buttons.js'; - s1.parentNode.insertBefore(s, s1); - })(); - } - }, - delicious : function(self){ - if(self.options.buttons.delicious.size == 'tall'){//tall - var css = 'width:50px;', - cssCount = 'height:35px;width:50px;font-size:15px;line-height:35px;', - cssShare = 'height:18px;line-height:18px;margin-top:3px;'; - } - else{//medium - var css = 'width:93px;', - cssCount = 'float:right;padding:0 3px;height:20px;width:26px;line-height:20px;', - cssShare = 'float:left;height:20px;line-height:20px;'; - } - var count = self.shorterTotal(self.options.count.delicious); - if(typeof count === "undefined"){ - count = 0; - } - $(self.element).find('.buttons').append( - '
'+ - '
'+count+'
'+ - '
'+ - 'Delicious Add
'); - - $(self.element).find('.delicious').on('click', function(){ - self.openPopup('delicious'); - }); - }, - stumbleupon : function(self){ - var sett = self.options.buttons.stumbleupon; - $(self.element).find('.buttons').append('
'); - var loading = 0; - if(typeof STMBLPN === 'undefined' && loading == 0){ - loading = 1; - (function() { - var li = document.createElement('script');li.type = 'text/javascript';li.async = true; - li.src = '//platform.stumbleupon.com/1/widgets.js'; - var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s); - })(); - s = window.setTimeout(function(){ - if(typeof STMBLPN !== 'undefined'){ - STMBLPN.processWidgets(); - clearInterval(s); - } - },500); - } - else{ - STMBLPN.processWidgets(); - } - }, - linkedin : function(self){ - var sett = self.options.buttons.linkedin; - $(self.element).find('.buttons').append('
'); - var loading = 0; - if(typeof window.IN === 'undefined' && loading == 0){ - loading = 1; - (function() { - var li = document.createElement('script');li.type = 'text/javascript';li.async = true; - li.src = '//platform.linkedin.com/in.js'; - var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s); - })(); - } - else{ - window.IN.init(); - } - }, - pinterest : function(self){ - var sett = self.options.buttons.pinterest; - $(self.element).find('.buttons').append(''); - - (function() { - var li = document.createElement('script');li.type = 'text/javascript';li.async = true; - li.src = '//assets.pinterest.com/js/pinit.js'; - var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s); - })(); - } - }, - /* Tracking for Google Analytics - ================================================== */ - tracking = { - googlePlus: function(){}, - facebook: function(){ - //console.log('facebook'); - fb = window.setInterval(function(){ - if (typeof FB !== 'undefined') { - FB.Event.subscribe('edge.create', function(targetUrl) { - //_gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]); - ga('send', 'social', 'facebook', 'like', targetUrl); - }); - FB.Event.subscribe('edge.remove', function(targetUrl) { - //_gaq.push(['_trackSocial', 'facebook', 'unlike', targetUrl]); - ga('send', 'social', 'facebook', 'unlike', targetUrl); - }); - FB.Event.subscribe('message.send', function(targetUrl) { - //_gaq.push(['_trackSocial', 'facebook', 'send', targetUrl]); - ga('send', 'social', 'facebook', 'send', targetUrl); - }); - //console.log('ok'); - clearInterval(fb); - } - },1000); - }, - twitter: function(){ - //console.log('twitter'); - tw = window.setInterval(function(){ - if (typeof twttr !== 'undefined') { - twttr.events.bind('tweet', function(event) { - if (event) { - //_gaq.push(['_trackSocial', 'twitter', 'tweet']); - ga('send', 'social', 'twitter', 'tweet'); - } - }); - //console.log('ok'); - clearInterval(tw); - } - },1000); - }, - digg: function(){ - //if somenone find a solution, mail me ! - /*$(this.element).find('.digg').on('click', function(){ - _gaq.push(['_trackSocial', 'digg', 'add']); - });*/ - }, - delicious: function(){}, - stumbleupon: function(){}, - linkedin: function(){ - function LinkedInShare() { - //_gaq.push(['_trackSocial', 'linkedin', 'share']); - ga('send', 'social', 'linkedin', 'share'); - } - }, - pinterest: function(){ - //if somenone find a solution, mail me ! - } - }, - /* Popup for each social network - ================================================== */ - popup = { - googlePlus: function(opt){ - window.open("https://plus.google.com/share?hl="+opt.buttons.googlePlus.lang+"&url="+encodeURIComponent((opt.buttons.googlePlus.url !== '' ? opt.buttons.googlePlus.url : opt.url)), "", "toolbar=0, status=0, width=900, height=500"); - }, - facebook: function(opt){ - window.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((opt.buttons.facebook.url !== '' ? opt.buttons.facebook.url : opt.url))+"&t="+opt.text+"", "", "toolbar=0, status=0, width=900, height=500"); - }, - twitter: function(opt){ - window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(opt.text)+"&url="+encodeURIComponent((opt.buttons.twitter.url !== '' ? opt.buttons.twitter.url : opt.url))+(opt.buttons.twitter.via !== '' ? '&via='+opt.buttons.twitter.via : ''), "", "toolbar=0, status=0, width=650, height=360"); - }, - digg: function(opt){ - window.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((opt.buttons.digg.url !== '' ? opt.buttons.digg.url : opt.url))+"&title="+opt.text+"&related=true&style=true", "", "toolbar=0, status=0, width=650, height=360"); - }, - delicious: function(opt){ - window.open('http://www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent((opt.buttons.delicious.url !== '' ? opt.buttons.delicious.url : opt.url))+'&title='+opt.text, 'delicious', 'toolbar=no,width=550,height=550'); - }, - stumbleupon: function(opt){ - window.open('http://www.stumbleupon.com/badge/?url='+encodeURIComponent((opt.buttons.stumbleupon.url !== '' ? opt.buttons.stumbleupon.url : opt.url)), 'stumbleupon', 'toolbar=no,width=550,height=550'); - }, - linkedin: function(opt){ - window.open('https://www.linkedin.com/cws/share?url='+encodeURIComponent((opt.buttons.linkedin.url !== '' ? opt.buttons.linkedin.url : opt.url))+'&token=&isFramed=true', 'linkedin', 'toolbar=no,width=550,height=550'); - }, - pinterest: function(opt){ - window.open('http://pinterest.com/pin/create/button/?url='+encodeURIComponent((opt.buttons.pinterest.url !== '' ? opt.buttons.pinterest.url : opt.url))+'&media='+encodeURIComponent(opt.buttons.pinterest.media)+'&description='+opt.buttons.pinterest.description, 'pinterest', 'toolbar=no,width=700,height=300'); - } - }; - - /* Plugin constructor - ================================================== */ - function Plugin( element, options ) { - this.element = element; - - this.options = $.extend( true, {}, defaults, options); - this.options.share = options.share; //simple solution to allow order of buttons - - this._defaults = defaults; - this._name = pluginName; - - this.init(); - }; - - /* Initialization method - ================================================== */ - Plugin.prototype.init = function () { - var self = this; - if(this.options.urlCurl !== ''){ - urlJson.googlePlus = this.options.urlCurl + '?url={url}&type=googlePlus'; // PHP script for GooglePlus... - urlJson.stumbleupon = this.options.urlCurl + '?url={url}&type=stumbleupon'; // PHP script for Stumbleupon... - } - $(this.element).addClass(this.options.className); //add class - - //HTML5 Custom data - if(typeof $(this.element).data('title') !== 'undefined'){ - this.options.title = $(this.element).attr('data-title'); - } - if(typeof $(this.element).data('url') !== 'undefined'){ - this.options.url = $(this.element).data('url'); - } - if(typeof $(this.element).data('text') !== 'undefined'){ - this.options.text = $(this.element).data('text'); - } - - //how many social website have been selected - $.each(this.options.share, function(name, val) { - if(val === true){ - self.options.shareTotal ++; - } - }); - - if(self.options.enableCounter === true){ //if for some reason you don't need counter - //get count of social share that have been selected - $.each(this.options.share, function(name, val) { - if(val === true){ - //self.getSocialJson(name); - try { - self.getSocialJson(name); - } catch(e){ - } - } - }); - } - else if(self.options.template !== ''){ //for personalized button (with template) - this.options.render(this, this.options); - } - else{ // if you want to use official button like example 3 or 5 - this.loadButtons(); - } - - //add hover event - $(this.element).hover(function(){ - //load social button if enable and 1 time - if($(this).find('.buttons').length === 0 && self.options.enableHover === true){ - self.loadButtons(); - } - self.options.hover(self, self.options); - }, function(){ - self.options.hide(self, self.options); - }); - - //click event - $(this.element).click(function(){ - self.options.click(self, self.options); - return false; - }); - }; - - /* loadButtons methode - ================================================== */ - Plugin.prototype.loadButtons = function () { - var self = this; - $(this.element).append('
'); - $.each(self.options.share, function(name, val) { - if(val == true){ - loadButton[name](self); - if(self.options.enableTracking === true){ //add tracking - tracking[name](); - } - } - }); - }; - - /* getSocialJson methode - ================================================== */ - Plugin.prototype.getSocialJson = function (name) { - var self = this, - count = 0, - url = self.cleanURL(this.options.url,name), - currentURL = self.cleanURL(window.location.href,name); - var urls = [url]; - if (url != currentURL) { - urls[urls.length] = currentURL; - } - if(url != '' && self.options.urlCurl !== ''){ //urlCurl = '' if you don't want to used PHP script but used social button - for (var index in urls) { - $.getJSON(urls[index], function(json){ - if(typeof json.count !== "undefined"){ //GooglePlus, Stumbleupon, Twitter, Pinterest and Digg - var temp = json.count + ''; - temp = temp.replace('\u00c2\u00a0', ''); //remove google plus special chars - count += parseInt(temp, 10); - } - //get the FB total count (shares, likes and more) - else if(json.data && json.data.length > 0 && typeof json.data[0].total_count !== "undefined"){ //Facebook total count - count += parseInt(json.data[0].total_count, 10); - } - else if(typeof json[0] !== "undefined"){ //Delicious - count += parseInt(json[0].total_posts, 10); - } - else if(typeof json[0] !== "undefined"){ //Stumbleupon - } - self.options.count[name] += count; - self.options.total += count; - self.renderer(); - self.rendererPerso(); - //console.log(json); //debug - }) - .error(function() { - self.options.count[name] = 0; - self.rendererPerso(); - }); - } - } - else{ - self.renderer(); - self.options.count[name] = 0; - self.rendererPerso(); - } - }; - - /* clean url - ================================================== */ - Plugin.prototype.cleanURL = function (url, name) { - // Strip paramaters - url = url.replace(window.location.search, ""); - // Strip protocol - url = url.replace(/.*?:\/\//g, ""); - // googlePlus needs the protocol to do the query - if (name == 'googlePlus') { - url = 'http://' + url; - } - url = urlJson[name].replace('{url}', encodeURIComponent(url)); - if(this.options.buttons[name].urlCount === true && this.options.buttons[name].url !== ''){ - url = urlJson[name].replace('{url}', this.options.buttons[name].url); - } - return url; - }; - - /* launch render methode - ================================================== */ - Plugin.prototype.rendererPerso = function () { - //check if this is the last social website to launch render - var shareCount = 0; - for (e in this.options.count) { shareCount++; } - if(shareCount === this.options.shareTotal){ - this.options.render(this, this.options); - } - }; - - /* render methode - ================================================== */ - Plugin.prototype.renderer = function () { - var total = this.options.total, - template = this.options.template; - if(this.options.shorterTotal === true){ //format number like 1.2k or 5M - total = this.shorterTotal(total); - } - - if(template !== ''){ //if there is a template - template = template.replace('{total}', total); - $(this.element).html(template); - } - else{ //template by defaults - $(this.element).html( - '
' + total + '' + - (this.options.title !== '' ? '' : '') + - '
' - ); - } - }; - - /* format total numbers like 1.2k or 5M - ================================================== */ - Plugin.prototype.shorterTotal = function (num) { - if (num >= 1e6){ - num = (num / 1e6).toFixed(2) + "M" - } else if (num >= 1e3){ - num = (num / 1e3).toFixed(1) + "k" - } - return num; - }; - - /* Methode for open popup - ================================================== */ - Plugin.prototype.openPopup = function (site) { - popup[site](this.options); //open - if(this.options.enableTracking === true){ //tracking! - var tracking = { - googlePlus: {site: 'Google', action: '+1'}, - facebook: {site: 'facebook', action: 'share'}, - twitter: {site: 'twitter', action: 'tweet'}, - digg: {site: 'digg', action: 'add'}, - delicious: {site: 'delicious', action: 'add'}, - stumbleupon: {site: 'stumbleupon', action: 'add'}, - linkedin: {site: 'linkedin', action: 'share'}, - pinterest: {site: 'pinterest', action: 'pin'} - }; - //_gaq.push(['_trackSocial', tracking[site].site, tracking[site].action]); - //ga('send', 'social', tracking[site].site, tracking[site].action); - ga('send', 'social', { - 'socialNetwork': tracking[site].site, - 'socialAction': tracking[site].action, - 'socialTarget': this.options.url - }); - } - }; - - /* Methode for add +1 to a counter - ================================================== */ - Plugin.prototype.simulateClick = function (className) { - var html = $(this.element).html(); - if (className === undefined) { - $(this.element).html(html.replace(this.options.total, this.options.total+1)); - } else { - $('.'+className).html(html.replace(this.options.total, this.options.total+1)); - } - }; - - /* Methode for add +1 to a counter - ================================================== */ - Plugin.prototype.update = function (url, text) { - if(url !== ''){ - this.options.url = url; - } - if(text !== ''){ - this.options.text = text; - } - }; - - /* A really lightweight plugin wrapper around the constructor, preventing against multiple instantiations - ================================================== */ - $.fn[pluginName] = function ( options ) { - var args = arguments; - if (options === undefined || typeof options === 'object') { - return this.each(function () { - if (!$.data(this, 'plugin_' + pluginName)) { - $.data(this, 'plugin_' + pluginName, new Plugin( this, options )); - } - }); - } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') { - return this.each(function () { - var instance = $.data(this, 'plugin_' + pluginName); - if (instance instanceof Plugin && typeof instance[options] === 'function') { - instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) ); - } - }); - } - }; -})(jQuery, window, document); +/*! + * Sharrre.com - Make your sharing widget! + * Version: beta 1.3.5 + * Author: Julien Hany + * License: MIT http://en.wikipedia.org/wiki/MIT_License or GPLv2 http://en.wikipedia.org/wiki/GNU_General_Public_License + */ + +;(function ( $, window, document, undefined ) { + + /* Defaults + ================================================== */ + var pluginName = 'sharrre', + defaults = { + className: 'sharrre', + share: { + googlePlus: false, + facebook: false, + twitter: false, + digg: false, + delicious: false, + stumbleupon: false, + linkedin: false, + pinterest: false + }, + shareTotal: 0, + template: '', + title: '', + url: document.location.href, + text: document.title, + urlCurl: 'sharrre.php', //PHP script for google plus... + count: {}, //counter by social network + total: 0, //total of sharing + shorterTotal: true, //show total by k or M when number is to big + enableHover: true, //disable if you want to personalize hover event with callback + enableCounter: true, //disable if you just want use buttons + enableTracking: false, //tracking with google analitycs + hover: function(){}, //personalize hover event with this callback function + hide: function(){}, //personalize hide event with this callback function + click: function(){}, //personalize click event with this callback function + render: function(){}, //personalize render event with this callback function + buttons: { //settings for buttons + googlePlus : { //http://www.google.com/webmasters/+1/button/ + url: '', //if you need to personnalize button url + urlCount: false, //if you want to use personnalize button url on global counter + size: 'medium', + lang: 'en-US', + annotation: '' + }, + facebook: { //http://developers.facebook.com/docs/reference/plugins/like/ + url: '', //if you need to personalize url button + urlCount: false, //if you want to use personnalize button url on global counter + action: 'like', + layout: 'button_count', + width: '', + send: 'false', + faces: 'false', + colorscheme: '', + font: '', + lang: 'en_US' + }, + twitter: { //http://twitter.com/about/resources/tweetbutton + url: '', //if you need to personalize url button + urlCount: false, //if you want to use personnalize button url on global counter + count: 'horizontal', + hashtags: '', + via: '', + related: '', + lang: 'en' + }, + digg: { //http://about.digg.com/downloads/button/smart + url: '', //if you need to personalize url button + urlCount: false, //if you want to use personnalize button url on global counter + type: 'DiggCompact' + }, + delicious: { + url: '', //if you need to personalize url button + urlCount: false, //if you want to use personnalize button url on global counter + size: 'medium' //medium or tall + }, + stumbleupon: { //http://www.stumbleupon.com/badges/ + url: '', //if you need to personalize url button + urlCount: false, //if you want to use personnalize button url on global counter + layout: '1' + }, + linkedin: { //http://developer.linkedin.com/plugins/share-button + url: '', //if you need to personalize url button + urlCount: false, //if you want to use personnalize button url on global counter + counter: '' + }, + pinterest: { //http://pinterest.com/about/goodies/ + url: '', //if you need to personalize url button + media: '', + description: '', + layout: 'horizontal' + } + } + }, + /* Json URL to get count number + ================================================== */ + urlJson = { + googlePlus: "", + + //new FQL method by Sire + facebook: "//graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?", + //old method facebook: "//graph.facebook.com/?id={url}&callback=?", + //facebook : "//api.ak.facebook.com/restserver.php?v=1.0&method=links.getStats&urls={url}&format=json" + + twitter: "//cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?", + digg: "//services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?", + delicious: '//feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?', + //stumbleupon: "//www.stumbleupon.com/services/1.01/badge.getinfo?url={url}&format=jsonp&callback=?", + stumbleupon: "", + linkedin: "//www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?", + pinterest: "//api.pinterest.com/v1/urls/count.json?url={url}&callback=?" + }, + /* Load share buttons asynchronously + ================================================== */ + loadButton = { + googlePlus : function(self){ + var sett = self.options.buttons.googlePlus; + //$(self.element).find('.buttons').append('
'); + $(self.element).find('.buttons').append('
'); + window.___gcfg = { + lang: self.options.buttons.googlePlus.lang + }; + var loading = 0; + if(typeof gapi === 'undefined' && loading == 0){ + loading = 1; + (function() { + var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; + po.src = '//apis.google.com/js/plusone.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); + })(); + } + else{ + gapi.plusone.go(); + } + }, + facebook : function(self){ + var sett = self.options.buttons.facebook; + $(self.element).find('.buttons').append(''); + var loading = 0; + if(typeof FB === 'undefined' && loading == 0){ + loading = 1; + (function(d, s, id) { + var js, fjs = d.getElementsByTagName(s)[0]; + if (d.getElementById(id)) {return;} + js = d.createElement(s); js.id = id; + js.src = '//connect.facebook.net/'+sett.lang+'/all.js#xfbml=1'; + fjs.parentNode.insertBefore(js, fjs); + }(document, 'script', 'facebook-jssdk')); + } + else{ + FB.XFBML.parse(); + } + }, + twitter : function(self){ + var sett = self.options.buttons.twitter; + $(self.element).find('.buttons').append(''); + var loading = 0; + if(typeof twttr === 'undefined' && loading == 0){ + loading = 1; + (function() { + var twitterScriptTag = document.createElement('script'); + twitterScriptTag.type = 'text/javascript'; + twitterScriptTag.async = true; + twitterScriptTag.src = '//platform.twitter.com/widgets.js'; + var s = document.getElementsByTagName('script')[0]; + s.parentNode.insertBefore(twitterScriptTag, s); + })(); + } + else{ + $.ajax({ url: '//platform.twitter.com/widgets.js', dataType: 'script', cache:true}); //http://stackoverflow.com/q/6536108 + } + }, + digg : function(self){ + var sett = self.options.buttons.digg; + $(self.element).find('.buttons').append('
'); + var loading = 0; + if(typeof __DBW === 'undefined' && loading == 0){ + loading = 1; + (function() { + var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0]; + s.type = 'text/javascript'; + s.async = true; + s.src = '//widgets.digg.com/buttons.js'; + s1.parentNode.insertBefore(s, s1); + })(); + } + }, + delicious : function(self){ + if(self.options.buttons.delicious.size == 'tall'){//tall + var css = 'width:50px;', + cssCount = 'height:35px;width:50px;font-size:15px;line-height:35px;', + cssShare = 'height:18px;line-height:18px;margin-top:3px;'; + } + else{//medium + var css = 'width:93px;', + cssCount = 'float:right;padding:0 3px;height:20px;width:26px;line-height:20px;', + cssShare = 'float:left;height:20px;line-height:20px;'; + } + var count = self.shorterTotal(self.options.count.delicious); + if(typeof count === "undefined"){ + count = 0; + } + $(self.element).find('.buttons').append( + '
'+ + '
'+count+'
'+ + '
'+ + 'Delicious Add
'); + + $(self.element).find('.delicious').on('click', function(){ + self.openPopup('delicious'); + }); + }, + stumbleupon : function(self){ + var sett = self.options.buttons.stumbleupon; + $(self.element).find('.buttons').append('
'); + var loading = 0; + if(typeof STMBLPN === 'undefined' && loading == 0){ + loading = 1; + (function() { + var li = document.createElement('script');li.type = 'text/javascript';li.async = true; + li.src = '//platform.stumbleupon.com/1/widgets.js'; + var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s); + })(); + s = window.setTimeout(function(){ + if(typeof STMBLPN !== 'undefined'){ + STMBLPN.processWidgets(); + clearInterval(s); + } + },500); + } + else{ + STMBLPN.processWidgets(); + } + }, + linkedin : function(self){ + var sett = self.options.buttons.linkedin; + $(self.element).find('.buttons').append('
'); + var loading = 0; + if(typeof window.IN === 'undefined' && loading == 0){ + loading = 1; + (function() { + var li = document.createElement('script');li.type = 'text/javascript';li.async = true; + li.src = '//platform.linkedin.com/in.js'; + var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s); + })(); + } + else{ + window.IN.init(); + } + }, + pinterest : function(self){ + var sett = self.options.buttons.pinterest; + $(self.element).find('.buttons').append(''); + + (function() { + var li = document.createElement('script');li.type = 'text/javascript';li.async = true; + li.src = '//assets.pinterest.com/js/pinit.js'; + var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(li, s); + })(); + } + }, + /* Tracking for Google Analytics + ================================================== */ + tracking = { + googlePlus: function(){}, + facebook: function(){ + //console.log('facebook'); + fb = window.setInterval(function(){ + if (typeof FB !== 'undefined') { + FB.Event.subscribe('edge.create', function(targetUrl) { + //_gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]); + ga('send', 'social', 'facebook', 'like', targetUrl); + }); + FB.Event.subscribe('edge.remove', function(targetUrl) { + //_gaq.push(['_trackSocial', 'facebook', 'unlike', targetUrl]); + ga('send', 'social', 'facebook', 'unlike', targetUrl); + }); + FB.Event.subscribe('message.send', function(targetUrl) { + //_gaq.push(['_trackSocial', 'facebook', 'send', targetUrl]); + ga('send', 'social', 'facebook', 'send', targetUrl); + }); + //console.log('ok'); + clearInterval(fb); + } + },1000); + }, + twitter: function(){ + //console.log('twitter'); + tw = window.setInterval(function(){ + if (typeof twttr !== 'undefined') { + twttr.events.bind('tweet', function(event) { + if (event) { + //_gaq.push(['_trackSocial', 'twitter', 'tweet']); + ga('send', 'social', 'twitter', 'tweet'); + } + }); + //console.log('ok'); + clearInterval(tw); + } + },1000); + }, + digg: function(){ + //if somenone find a solution, mail me ! + /*$(this.element).find('.digg').on('click', function(){ + _gaq.push(['_trackSocial', 'digg', 'add']); + });*/ + }, + delicious: function(){}, + stumbleupon: function(){}, + linkedin: function(){ + function LinkedInShare() { + //_gaq.push(['_trackSocial', 'linkedin', 'share']); + ga('send', 'social', 'linkedin', 'share'); + } + }, + pinterest: function(){ + //if somenone find a solution, mail me ! + } + }, + /* Popup for each social network + ================================================== */ + popup = { + googlePlus: function(opt){ + window.open("https://plus.google.com/share?hl="+opt.buttons.googlePlus.lang+"&url="+encodeURIComponent((opt.buttons.googlePlus.url !== '' ? opt.buttons.googlePlus.url : opt.url)), "", "toolbar=0, status=0, width=900, height=500"); + }, + facebook: function(opt){ + window.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((opt.buttons.facebook.url !== '' ? opt.buttons.facebook.url : opt.url))+"&t="+opt.text+"", "", "toolbar=0, status=0, width=900, height=500"); + }, + twitter: function(opt){ + window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(opt.text)+"&url="+encodeURIComponent((opt.buttons.twitter.url !== '' ? opt.buttons.twitter.url : opt.url))+(opt.buttons.twitter.via !== '' ? '&via='+opt.buttons.twitter.via : ''), "", "toolbar=0, status=0, width=650, height=360"); + }, + digg: function(opt){ + window.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((opt.buttons.digg.url !== '' ? opt.buttons.digg.url : opt.url))+"&title="+opt.text+"&related=true&style=true", "", "toolbar=0, status=0, width=650, height=360"); + }, + delicious: function(opt){ + window.open('http://www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent((opt.buttons.delicious.url !== '' ? opt.buttons.delicious.url : opt.url))+'&title='+opt.text, 'delicious', 'toolbar=no,width=550,height=550'); + }, + stumbleupon: function(opt){ + window.open('http://www.stumbleupon.com/badge/?url='+encodeURIComponent((opt.buttons.stumbleupon.url !== '' ? opt.buttons.stumbleupon.url : opt.url)), 'stumbleupon', 'toolbar=no,width=550,height=550'); + }, + linkedin: function(opt){ + window.open('https://www.linkedin.com/cws/share?url='+encodeURIComponent((opt.buttons.linkedin.url !== '' ? opt.buttons.linkedin.url : opt.url))+'&token=&isFramed=true', 'linkedin', 'toolbar=no,width=550,height=550'); + }, + pinterest: function(opt){ + window.open('http://pinterest.com/pin/create/button/?url='+encodeURIComponent((opt.buttons.pinterest.url !== '' ? opt.buttons.pinterest.url : opt.url))+'&media='+encodeURIComponent(opt.buttons.pinterest.media)+'&description='+opt.buttons.pinterest.description, 'pinterest', 'toolbar=no,width=700,height=300'); + } + }; + + /* Plugin constructor + ================================================== */ + function Plugin( element, options ) { + this.element = element; + + this.options = $.extend( true, {}, defaults, options); + this.options.share = options.share; //simple solution to allow order of buttons + + this._defaults = defaults; + this._name = pluginName; + + this.init(); + }; + + /* Initialization method + ================================================== */ + Plugin.prototype.init = function () { + var self = this; + if(this.options.urlCurl !== ''){ + urlJson.googlePlus = this.options.urlCurl + '?url={url}&type=googlePlus'; // PHP script for GooglePlus... + urlJson.stumbleupon = this.options.urlCurl + '?url={url}&type=stumbleupon'; // PHP script for Stumbleupon... + } + $(this.element).addClass(this.options.className); //add class + + //HTML5 Custom data + if(typeof $(this.element).data('title') !== 'undefined'){ + this.options.title = $(this.element).attr('data-title'); + } + if(typeof $(this.element).data('url') !== 'undefined'){ + this.options.url = $(this.element).data('url'); + } + if(typeof $(this.element).data('text') !== 'undefined'){ + this.options.text = $(this.element).data('text'); + } + + //how many social website have been selected + $.each(this.options.share, function(name, val) { + if(val === true){ + self.options.shareTotal ++; + } + }); + + if(self.options.enableCounter === true){ //if for some reason you don't need counter + //get count of social share that have been selected + $.each(this.options.share, function(name, val) { + if(val === true){ + //self.getSocialJson(name); + try { + self.getSocialJson(name); + } catch(e){ + } + } + }); + } + else if(self.options.template !== ''){ //for personalized button (with template) + this.options.render(this, this.options); + } + else{ // if you want to use official button like example 3 or 5 + this.loadButtons(); + } + + //add hover event + $(this.element).hover(function(){ + //load social button if enable and 1 time + if($(this).find('.buttons').length === 0 && self.options.enableHover === true){ + self.loadButtons(); + } + self.options.hover(self, self.options); + }, function(){ + self.options.hide(self, self.options); + }); + + //click event + $(this.element).click(function(){ + self.options.click(self, self.options); + return false; + }); + }; + + /* loadButtons methode + ================================================== */ + Plugin.prototype.loadButtons = function () { + var self = this; + $(this.element).append('
'); + $.each(self.options.share, function(name, val) { + if(val == true){ + loadButton[name](self); + if(self.options.enableTracking === true){ //add tracking + tracking[name](); + } + } + }); + }; + + /* getSocialJson methode + ================================================== */ + Plugin.prototype.getSocialJson = function (name) { + var self = this, + count = 0, + url = self.cleanURL(this.options.url,name), + currentURL = self.cleanURL(window.location.href,name); + + var urls = [url]; + if (url != currentURL) { + urls[urls.length] = currentURL; + } + for (var index in urls) { + urls[urls.length] = 'https://' + urls[index]; + urls[index] = 'http://' + urls[index]; + } + if(url != '' && self.options.urlCurl !== ''){ //urlCurl = '' if you don't want to used PHP script but used social button + for (var index in urls) { + $.getJSON(self.buildSocialURL(urls[index]), function(json){ + if(typeof json.count !== "undefined"){ //GooglePlus, Stumbleupon, Twitter, Pinterest and Digg + var temp = json.count + ''; + temp = temp.replace('\u00c2\u00a0', ''); //remove google plus special chars + count += parseInt(temp, 10); + } + //get the FB total count (shares, likes and more) + else if(json.data && json.data.length > 0 && typeof json.data[0].total_count !== "undefined"){ //Facebook total count + count += parseInt(json.data[0].total_count, 10); + } + else if(typeof json[0] !== "undefined"){ //Delicious + count += parseInt(json[0].total_posts, 10); + } + else if(typeof json[0] !== "undefined"){ //Stumbleupon + } + self.options.count[name] += count; + self.options.total += count; + self.renderer(); + self.rendererPerso(); + //console.log(json); //debug + }) + .error(function() { + self.options.count[name] = 0; + self.rendererPerso(); + }); + } + } + else{ + self.renderer(); + self.options.count[name] = 0; + self.rendererPerso(); + } + }; + + /* clean url + ================================================== */ + Plugin.prototype.cleanURL = function (url, name) { + // Strip paramaters + url = url.replace(window.location.search, ""); + // Strip protocol + url = url.replace(/.*?:\/\//g, ""); + return url; + }; + + /* convert url to social link + ================================================== */ + Plugin.prototype.buildSocialURL = function(url, name) { + url = urlJson[name].replace('{url}', encodeURIComponent(url)); + if(this.options.buttons[name].urlCount === true && this.options.buttons[name].url !== ''){ + url = urlJson[name].replace('{url}', this.options.buttons[name].url); + } + return url; + }; + + /* launch render methode + ================================================== */ + Plugin.prototype.rendererPerso = function () { + //check if this is the last social website to launch render + var shareCount = 0; + for (e in this.options.count) { shareCount++; } + if(shareCount === this.options.shareTotal){ + this.options.render(this, this.options); + } + }; + + /* render methode + ================================================== */ + Plugin.prototype.renderer = function () { + var total = this.options.total, + template = this.options.template; + if(this.options.shorterTotal === true){ //format number like 1.2k or 5M + total = this.shorterTotal(total); + } + + if(template !== ''){ //if there is a template + template = template.replace('{total}', total); + $(this.element).html(template); + } + else{ //template by defaults + $(this.element).html( + '
' + total + '' + + (this.options.title !== '' ? '' : '') + + '
' + ); + } + }; + + /* format total numbers like 1.2k or 5M + ================================================== */ + Plugin.prototype.shorterTotal = function (num) { + if (num >= 1e6){ + num = (num / 1e6).toFixed(2) + "M" + } else if (num >= 1e3){ + num = (num / 1e3).toFixed(1) + "k" + } + return num; + }; + + /* Methode for open popup + ================================================== */ + Plugin.prototype.openPopup = function (site) { + popup[site](this.options); //open + if(this.options.enableTracking === true){ //tracking! + var tracking = { + googlePlus: {site: 'Google', action: '+1'}, + facebook: {site: 'facebook', action: 'share'}, + twitter: {site: 'twitter', action: 'tweet'}, + digg: {site: 'digg', action: 'add'}, + delicious: {site: 'delicious', action: 'add'}, + stumbleupon: {site: 'stumbleupon', action: 'add'}, + linkedin: {site: 'linkedin', action: 'share'}, + pinterest: {site: 'pinterest', action: 'pin'} + }; + //_gaq.push(['_trackSocial', tracking[site].site, tracking[site].action]); + //ga('send', 'social', tracking[site].site, tracking[site].action); + ga('send', 'social', { + 'socialNetwork': tracking[site].site, + 'socialAction': tracking[site].action, + 'socialTarget': this.options.url + }); + } + }; + + /* Methode for add +1 to a counter + ================================================== */ + Plugin.prototype.simulateClick = function (className) { + var html = $(this.element).html(); + if (className === undefined) { + $(this.element).html(html.replace(this.options.total, this.options.total+1)); + } else { + $('.'+className).html(html.replace(this.options.total, this.options.total+1)); + } + }; + + /* Methode for add +1 to a counter + ================================================== */ + Plugin.prototype.update = function (url, text) { + if(url !== ''){ + this.options.url = url; + } + if(text !== ''){ + this.options.text = text; + } + }; + + /* A really lightweight plugin wrapper around the constructor, preventing against multiple instantiations + ================================================== */ + $.fn[pluginName] = function ( options ) { + var args = arguments; + if (options === undefined || typeof options === 'object') { + return this.each(function () { + if (!$.data(this, 'plugin_' + pluginName)) { + $.data(this, 'plugin_' + pluginName, new Plugin( this, options )); + } + }); + } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') { + return this.each(function () { + var instance = $.data(this, 'plugin_' + pluginName); + if (instance instanceof Plugin && typeof instance[options] === 'function') { + instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) ); + } + }); + } + }; +})(jQuery, window, document); From b8c3c799be75853c48c2a67a80a11d817e5686ad Mon Sep 17 00:00:00 2001 From: Adam Moore Date: Tue, 25 Nov 2014 11:19:00 -0800 Subject: [PATCH 19/37] WP-4610: refactor buildSocialURL. Fix missing name parameter. --- jquery.sharrre.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 86e6724..80b6fe5 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -282,7 +282,6 @@ //_gaq.push(['_trackSocial', 'facebook', 'send', targetUrl]); ga('send', 'social', 'facebook', 'send', targetUrl); }); - //console.log('ok'); clearInterval(fb); } },1000); @@ -297,7 +296,6 @@ ga('send', 'social', 'twitter', 'tweet'); } }); - //console.log('ok'); clearInterval(tw); } },1000); @@ -366,6 +364,7 @@ /* Initialization method ================================================== */ Plugin.prototype.init = function () { + var self = this; if(this.options.urlCurl !== ''){ urlJson.googlePlus = this.options.urlCurl + '?url={url}&type=googlePlus'; // PHP script for GooglePlus... @@ -451,17 +450,20 @@ url = self.cleanURL(this.options.url,name), currentURL = self.cleanURL(window.location.href,name); + // Add any type of url we may have. var urls = [url]; if (url != currentURL) { urls[urls.length] = currentURL; } + + // Add https versions of the url for (var index in urls) { urls[urls.length] = 'https://' + urls[index]; urls[index] = 'http://' + urls[index]; } - if(url != '' && self.options.urlCurl !== ''){ //urlCurl = '' if you don't want to used PHP script but used social button + if (url != '' && self.options.urlCurl !== '') { //urlCurl = '' if you don't want to used PHP script but used social button for (var index in urls) { - $.getJSON(self.buildSocialURL(urls[index]), function(json){ + $.getJSON(self.buildSocialURL(urls[index], name), function(json){ if(typeof json.count !== "undefined"){ //GooglePlus, Stumbleupon, Twitter, Pinterest and Digg var temp = json.count + ''; temp = temp.replace('\u00c2\u00a0', ''); //remove google plus special chars @@ -476,11 +478,11 @@ } else if(typeof json[0] !== "undefined"){ //Stumbleupon } + self.options.count[name] += count; self.options.total += count; self.renderer(); self.rendererPerso(); - //console.log(json); //debug }) .error(function() { self.options.count[name] = 0; @@ -508,11 +510,8 @@ /* convert url to social link ================================================== */ Plugin.prototype.buildSocialURL = function(url, name) { - url = urlJson[name].replace('{url}', encodeURIComponent(url)); - if(this.options.buttons[name].urlCount === true && this.options.buttons[name].url !== ''){ - url = urlJson[name].replace('{url}', this.options.buttons[name].url); - } - return url; + newurl = (this.options.buttons[name].urlCount === true && this.options.buttons[name].url !== '') ? this.options.buttons[name].url : encodeURIComponent(url); + return urlJson[name].replace('{url}', newurl); }; /* launch render methode From 28f81bb7758fa9f5050caa60bccc460bc4970e53 Mon Sep 17 00:00:00 2001 From: Adam Moore Date: Thu, 4 Dec 2014 07:50:19 -0800 Subject: [PATCH 20/37] Only check http connections and only against the current url. --- jquery.sharrre.js | 66 +++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 39 deletions(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 80b6fe5..c0b9d10 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -442,53 +442,41 @@ }); }; - /* getSocialJson methode + /* getSocialJson method ================================================== */ Plugin.prototype.getSocialJson = function (name) { var self = this, count = 0, - url = self.cleanURL(this.options.url,name), - currentURL = self.cleanURL(window.location.href,name); + url = 'http://' + self.cleanURL(window.location.href,name); - // Add any type of url we may have. - var urls = [url]; - if (url != currentURL) { - urls[urls.length] = currentURL; - } + if (self.options.urlCurl !== '') { //urlCurl = '' if you don't want to used PHP script but used social button - // Add https versions of the url - for (var index in urls) { - urls[urls.length] = 'https://' + urls[index]; - urls[index] = 'http://' + urls[index]; - } - if (url != '' && self.options.urlCurl !== '') { //urlCurl = '' if you don't want to used PHP script but used social button - for (var index in urls) { - $.getJSON(self.buildSocialURL(urls[index], name), function(json){ - if(typeof json.count !== "undefined"){ //GooglePlus, Stumbleupon, Twitter, Pinterest and Digg - var temp = json.count + ''; - temp = temp.replace('\u00c2\u00a0', ''); //remove google plus special chars - count += parseInt(temp, 10); - } - //get the FB total count (shares, likes and more) - else if(json.data && json.data.length > 0 && typeof json.data[0].total_count !== "undefined"){ //Facebook total count - count += parseInt(json.data[0].total_count, 10); - } - else if(typeof json[0] !== "undefined"){ //Delicious - count += parseInt(json[0].total_posts, 10); - } - else if(typeof json[0] !== "undefined"){ //Stumbleupon - } + $.getJSON(self.buildSocialURL(url, name), function(json){ + if(typeof json.count !== "undefined"){ //GooglePlus, Stumbleupon, Twitter, Pinterest and Digg + var temp = json.count + ''; + temp = temp.replace('\u00c2\u00a0', ''); //remove google plus special chars + count += parseInt(temp, 10); + console.log('name: ' + name + ', count: ' + count); + } + //get the FB total count (shares, likes and more) + else if(json.data && json.data.length > 0 && typeof json.data[0].total_count !== "undefined"){ //Facebook total count + count += parseInt(json.data[0].total_count, 10); + } + else if(typeof json[0] !== "undefined"){ //Delicious + count += parseInt(json[0].total_posts, 10); + } + else if(typeof json[0] !== "undefined"){ //Stumbleupon + } - self.options.count[name] += count; - self.options.total += count; - self.renderer(); + self.options.count[name] += count; + self.options.total += count; + self.renderer(); + self.rendererPerso(); + }) + .error(function() { + self.options.count[name] = 0; self.rendererPerso(); - }) - .error(function() { - self.options.count[name] = 0; - self.rendererPerso(); - }); - } + }); } else{ self.renderer(); From 016575d7e8b5c9785d7bd789abe9fecf62bd6d6e Mon Sep 17 00:00:00 2001 From: Adam Moore Date: Thu, 4 Dec 2014 09:07:49 -0800 Subject: [PATCH 21/37] Remove console.log --- jquery.sharrre.js | 1 - 1 file changed, 1 deletion(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index c0b9d10..20b7281 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -456,7 +456,6 @@ var temp = json.count + ''; temp = temp.replace('\u00c2\u00a0', ''); //remove google plus special chars count += parseInt(temp, 10); - console.log('name: ' + name + ', count: ' + count); } //get the FB total count (shares, likes and more) else if(json.data && json.data.length > 0 && typeof json.data[0].total_count !== "undefined"){ //Facebook total count From 3ba99d0a3b64c0354d443b00441bbec124c805e9 Mon Sep 17 00:00:00 2001 From: Alejandro Torrado Date: Tue, 9 Dec 2014 20:04:34 -0300 Subject: [PATCH 22/37] Support for facebook share flag --- jquery.sharrre.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 710e1b8..79280b0 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -138,7 +138,7 @@ }, facebook : function(self){ var sett = self.options.buttons.facebook; - $(self.element).find('.buttons').append(''); + $(self.element).find('.buttons').append(''); var loading = 0; if(typeof FB === 'undefined' && loading == 0){ loading = 1; From 9a5cdf73723b3b553e8850fd1dc3e5022a9548af Mon Sep 17 00:00:00 2001 From: Alejandro Torrado Date: Tue, 9 Dec 2014 20:07:24 -0300 Subject: [PATCH 23/37] support for setting facebook appId --- jquery.sharrre.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 79280b0..631d4c6 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -147,6 +147,9 @@ if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = '//connect.facebook.net/'+sett.lang+'/all.js#xfbml=1'; + if (sett.appId) { + js.src += '&appId='+sett.appId; + } fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); } From e893573afd8babfd6d1d725d03d13344cd761f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Lund?= Date: Sun, 28 Dec 2014 14:18:30 +0100 Subject: [PATCH 24/37] Fix gapi.plusone undefined explicitly check for the google plusone api being present (there already may be other google apis around) --- jquery.sharrre.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 710e1b8..df60caa 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -124,7 +124,7 @@ lang: self.options.buttons.googlePlus.lang }; var loading = 0; - if(typeof gapi === 'undefined' && loading == 0){ + if((typeof gapi === 'undefined' || typeof gapi.plusone === 'undefined') && loading == 0){ loading = 1; (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; From f2fe94aed45c501d5b878c6112ed348404853f3c Mon Sep 17 00:00:00 2001 From: qualitybits Date: Mon, 5 Jan 2015 16:40:11 +0500 Subject: [PATCH 25/37] Update README.md update code mistake --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 60fdb7f..f722306 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Usage twitter: true }, url: 'http://sharrre.com' - }); + }); Example === From 1c2bb1cb20818f87fc9934e7d48de6f555116b50 Mon Sep 17 00:00:00 2001 From: Brando Meniconi Date: Mon, 20 Apr 2015 16:45:32 +0200 Subject: [PATCH 26/37] Revert "Remove php and index.html." This reverts commit 766bbb24fcd3920521f73a03b71794f1768fb8cb. --- index.html | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++ sharrre.php | 62 ++++++++++++++++++++++++++++++ 2 files changed, 168 insertions(+) create mode 100644 index.html create mode 100644 sharrre.php diff --git a/index.html b/index.html new file mode 100644 index 0000000..ebe6eeb --- /dev/null +++ b/index.html @@ -0,0 +1,106 @@ + + + + + Sharrre.com + + + + + + + +

Sharrre demo

+
+

+
+ + + diff --git a/sharrre.php b/sharrre.php new file mode 100644 index 0000000..867024e --- /dev/null +++ b/sharrre.php @@ -0,0 +1,62 @@ +'','count'=>0); + $json['url'] = $_GET['url']; + $url = urlencode($_GET['url']); + $type = urlencode($_GET['type']); + + if(filter_var($_GET['url'], FILTER_VALIDATE_URL)){ + if($type == 'googlePlus'){ //source http://www.helmutgranda.com/2011/11/01/get-a-url-google-count-via-php/ + $contents = parse('https://plusone.google.com/u/0/_/+1/fastbutton?url=' . $url . '&count=true'); + + preg_match( '/window\.__SSR = {c: ([\d]+)/', $contents, $matches ); + + if(isset($matches[0])){ + $json['count'] = (int)str_replace('window.__SSR = {c: ', '', $matches[0]); + } + } + else if($type == 'stumbleupon'){ + $content = parse("http://www.stumbleupon.com/services/1.01/badge.getinfo?url=$url"); + + $result = json_decode($content); + if (isset($result->result->views)) + { + $json['count'] = $result->result->views; + } + + } + } + echo str_replace('\\/','/',json_encode($json)); + + function parse($encUrl){ + $options = array( + CURLOPT_RETURNTRANSFER => true, // return web page + CURLOPT_HEADER => false, // don't return headers + CURLOPT_FOLLOWLOCATION => true, // follow redirects + CURLOPT_ENCODING => "", // handle all encodings + CURLOPT_USERAGENT => 'sharrre', // who am i + CURLOPT_AUTOREFERER => true, // set referer on redirect + CURLOPT_CONNECTTIMEOUT => 5, // timeout on connect + CURLOPT_TIMEOUT => 10, // timeout on response + CURLOPT_MAXREDIRS => 3, // stop after 10 redirects + CURLOPT_SSL_VERIFYHOST => 0, + CURLOPT_SSL_VERIFYPEER => false, + ); + $ch = curl_init(); + + $options[CURLOPT_URL] = $encUrl; + curl_setopt_array($ch, $options); + + $content = curl_exec($ch); + $err = curl_errno($ch); + $errmsg = curl_error($ch); + + curl_close($ch); + + if ($errmsg != '' || $err != '') { + /*print_r($errmsg); + print_r($errmsg);*/ + } + return $content; + } From 5421a15e8ad683967b9ca9b9e5f737a6e7f5b818 Mon Sep 17 00:00:00 2001 From: Brando Meniconi Date: Mon, 20 Apr 2015 17:14:57 +0200 Subject: [PATCH 27/37] modified proxy config --- sharrre.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sharrre.php b/sharrre.php index c3610fd..39013f1 100644 --- a/sharrre.php +++ b/sharrre.php @@ -5,8 +5,11 @@ $json['url'] = $_GET['url']; $url = urlencode($_GET['url']); $type = urlencode($_GET['type']); - $proxy = null; - $proxyAuth = array(); + + /* Uncomment & edit the following lines to enable proxy */ + //define('MY_PROXY_URL','my.proxy.com') ; + //define('MY_PROXY_USER', 'user' ); + //define('MY_PROXY_PASSWORD', 'password' ); if(filter_var($_GET['url'], FILTER_VALIDATE_URL)){ if($type == 'googlePlus'){ //source http://www.helmutgranda.com/2011/11/01/get-a-url-google-count-via-php/ @@ -32,8 +35,6 @@ echo str_replace('\\/','/',json_encode($json)); function parse($encUrl){ - global $proxy; - global $proxyAuth; $options = array( CURLOPT_RETURNTRANSFER => true, // return web page @@ -50,10 +51,10 @@ function parse($encUrl){ ); $ch = curl_init(); - if ($proxy != null) { - $options[CURLOPT_PROXY] = $proxy; - if (isset($proxyAuth['user']) && isset($proxyAuth['pwd'])) { - $options[CURLOPT_PROXYUSERPWD] = $proxyAuth['user'] . ':' . $proxyAuth['pwd']; + if (defined(MY_PROXY_URL)) { + $options[CURLOPT_PROXY] = MY_PROXY_URL; + if (defined(MY_PROXY_USER) && defined(MY_PROXY_PASSWORD)) { + $options[CURLOPT_PROXYUSERPWD] = MY_PROXY_USER . ':' . MY_PROXY_USER; } } From e1414b6980c43d15437eae702b6d6e587fd92edc Mon Sep 17 00:00:00 2001 From: Brando Meniconi Date: Mon, 20 Apr 2015 18:29:07 +0200 Subject: [PATCH 28/37] fixed example --- index.html | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index ebe6eeb..bd94876 100644 --- a/index.html +++ b/index.html @@ -1,11 +1,11 @@ - - Sharrre.com + + Sharrre.com - +
');var m=0;if(typeof g.IN==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.linkedin.com/in.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{g.IN.init()}},pinterest:function(m){var n=m.options.buttons.pinterest;f(m.element).find(".buttons").append('
Pin It
');(function(){var o=d.createElement("script");o.type="text/javascript";o.async=true;o.src="//assets.pinterest.com/js/pinit.js";var p=d.getElementsByTagName("script")[0];p.parentNode.insertBefore(o,p)})()}},j={googlePlus:function(){},facebook:function(){fb=g.setInterval(function(){if(typeof FB!=="undefined"){FB.Event.subscribe("edge.create",function(m){ga("send","social","facebook","like",m)});FB.Event.subscribe("edge.remove",function(m){ga("send","social","facebook","unlike",m)});FB.Event.subscribe("message.send",function(m){ga("send","social","facebook","like",m)});clearInterval(fb)}},1000)},twitter:function(){tw=g.setInterval(function(){if(typeof twttr!=="undefined"){twttr.events.bind("tweet",function(m){if(m){ga("send","social","twitter","tweet")}});clearInterval(tw)}},1000)},digg:function(){},delicious:function(){},stumbleupon:function(){},linkedin:function(){function m(){ga("send","social","linkedin","share")}},pinterest:function(){}},b={googlePlus:function(m){g.open("https://plus.google.com/share?hl="+m.buttons.googlePlus.lang+"&url="+encodeURIComponent((m.buttons.googlePlus.url!==""?m.buttons.googlePlus.url:m.url)),"","toolbar=0, status=0, width=900, height=500")},facebook:function(m){g.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((m.buttons.facebook.url!==""?m.buttons.facebook.url:m.url))+"&t="+m.text+"","","toolbar=0, status=0, width=900, height=500")},twitter:function(m){g.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(m.text)+"&url="+encodeURIComponent((m.buttons.twitter.url!==""?m.buttons.twitter.url:m.url))+(m.buttons.twitter.via!==""?"&via="+m.buttons.twitter.via:"")+(m.buttons.twitter.hashtags!==""?"&hashtags="+encodeURIComponent(m.buttons.twitter.hashtags):""),"","toolbar=0, status=0, width=650, height=360")},digg:function(m){g.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((m.buttons.digg.url!==""?m.buttons.digg.url:m.url))+"&title="+m.text+"&related=true&style=true","","toolbar=0, status=0, width=650, height=360")},delicious:function(m){g.open("http://www.delicious.com/save?v=5&noui&jump=close&url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&title="+m.text,"delicious","toolbar=no,width=550,height=550")},stumbleupon:function(m){g.open("http://www.stumbleupon.com/badge/?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url)),"stumbleupon","toolbar=no,width=550,height=550")},linkedin:function(m){g.open("https://www.linkedin.com/cws/share?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&token=&isFramed=true","linkedin","toolbar=no,width=550,height=550")},pinterest:function(m){g.open("http://pinterest.com/pin/create/button/?url="+encodeURIComponent((m.buttons.pinterest.url!==""?m.buttons.pinterest.url:m.url))+"&media="+encodeURIComponent(m.buttons.pinterest.media)+"&description="+m.buttons.pinterest.description,"pinterest","toolbar=no,width=700,height=300")}};function i(m,n){this.element=m;this.options=f.extend(true,{},l,n);this.options.share=n.share;this._defaults=l;this._name=c;this.init()}i.prototype.init=function(){var m=this;if(this.options.urlCurl!==""){h.googlePlus=this.options.urlCurl+"?url={url}&type=googlePlus";h.stumbleupon=this.options.urlCurl+"?url={url}&type=stumbleupon"}f(this.element).addClass(this.options.className);if(typeof f(this.element).data("title")!=="undefined"){this.options.title=f(this.element).attr("data-title")}if(typeof f(this.element).data("url")!=="undefined"){this.options.url=f(this.element).data("url")}if(typeof f(this.element).data("text")!=="undefined"){this.options.text=f(this.element).data("text")}f.each(this.options.share,function(o,n){if(n===true){m.options.shareTotal++}});if(m.options.enableCounter===true){f.each(this.options.share,function(p,o){if(o===true){try{m.getSocialJson(p)}catch(n){}}})}else{if(m.options.template!==""){this.options.render(this,this.options)}else{this.loadButtons()}}f(this.element).hover(function(){if(f(this).find(".buttons").length===0&&m.options.enableHover===true){m.loadButtons()}m.options.hover(m,m.options)},function(){m.options.hide(m,m.options)});f(this.element).click(function(){m.options.click(m,m.options);return false})};i.prototype.loadButtons=function(){var m=this;f(this.element).append('
');f.each(m.options.share,function(o,n){if(n==true){k[o](m);if(m.options.enableTracking===true){j[o]()}}})};i.prototype.getSocialJson=function(p){var o=this,n=0,m=h[p].replace("{url}",encodeURIComponent(this.options.url));if(this.options.buttons[p].urlCount===true&&this.options.buttons[p].url!==""){m=h[p].replace("{url}",this.options.buttons[p].url)}if(m!=""&&o.options.urlCurl!==""){f.getJSON(m,function(q){if(typeof q.count!=="undefined"){var r=q.count+"";r=r.replace("\u00c2\u00a0","");n+=parseInt(r,10)}else{if(q.data&&q.data.length>0&&typeof q.data[0].total_count!=="undefined"){n+=parseInt(q.data[0].total_count,10)}else{if(typeof q[0]!=="undefined"){n+=parseInt(q[0].total_posts,10)}else{if(typeof q[0]!=="undefined"){}}}}o.options.count[p]=n;o.options.total+=n;o.renderer();o.rendererPerso()}).error(function(){o.options.count[p]=0;o.rendererPerso()})}else{o.renderer();o.options.count[p]=0;o.rendererPerso()}};i.prototype.rendererPerso=function(){var m=0;for(e in this.options.count){m++}if(m===this.options.shareTotal){this.options.render(this,this.options)}};i.prototype.renderer=function(){var n=this.options.total,m=this.options.template;if(this.options.shorterTotal===true){n=this.shorterTotal(n)}if(m!==""){m=m.replace("{total}",n);f(this.element).html(m)}else{f(this.element).html('
'+n+""+(this.options.title!==""?'":"")+"
")}};i.prototype.shorterTotal=function(m){if(m>=1000000){m=(m/1000000).toFixed(2)+"M"}else{if(m>=1000){m=(m/1000).toFixed(1)+"k"}}return m};i.prototype.openPopup=function(m){b[m](this.options);if(this.options.enableTracking===true){var n={googlePlus:{site:"Google",action:"+1"},facebook:{site:"facebook",action:"like"},twitter:{site:"twitter",action:"tweet"},digg:{site:"digg",action:"add"},delicious:{site:"delicious",action:"add"},stumbleupon:{site:"stumbleupon",action:"add"},linkedin:{site:"linkedin",action:"share"},pinterest:{site:"pinterest",action:"pin"}};ga("send","social",n[m].site,n[m].action)}};i.prototype.simulateClick=function(){var m=f(this.element).html();f(this.element).html(m.replace(this.options.total,this.options.total+1))};i.prototype.update=function(n,m){if(n!==""){this.options.url=n}if(m!==""){this.options.text=m}};f.fn[c]=function(m){var n=arguments;if(m===a||typeof m==="object"){return this.each(function(){if(!f.data(this,"plugin_"+c)){f.data(this,"plugin_"+c,new i(this,m))}})}else{if(typeof m==="string"&&m[0]!=="_"&&m!=="init"){return this.each(function(){var o=f.data(this,"plugin_"+c);if(o instanceof i&&typeof o[m]==="function"){o[m].apply(o,Array.prototype.slice.call(n,1))}})}}}})(jQuery,window,document); +(function(f,g,d,a){var c="sharrre",l={className:"sharrre",share:{googlePlus:false,facebook:false,twitter:false,digg:false,delicious:false,stumbleupon:false,linkedin:false,pinterest:false},shareTotal:0,template:"",title:"",url:d.location.href,text:d.title,urlCurl:"sharrre.php",count:{},total:0,shorterTotal:true,enableHover:true,enableCounter:true,enableTracking:false,hover:function(){},hide:function(){},click:function(){},render:function(){},buttons:{googlePlus:{url:"",urlCount:false,size:"medium",lang:"en-US",annotation:""},facebook:{url:"",urlCount:false,action:"like",layout:"button_count",width:"",send:"false",faces:"false",colorscheme:"",font:"",lang:"en_US"},twitter:{url:"",urlCount:false,count:"horizontal",hashtags:"",via:"",related:"",lang:"en"},digg:{url:"",urlCount:false,type:"DiggCompact"},delicious:{url:"",urlCount:false,size:"medium"},stumbleupon:{url:"",urlCount:false,layout:"1"},linkedin:{url:"",urlCount:false,counter:""},pinterest:{url:"",media:"",description:"",layout:"horizontal"}}},h={googlePlus:"",facebook:"https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?",twitter:"http://cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?",digg:"http://services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?",delicious:"http://feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?",stumbleupon:"",linkedin:"http://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?",pinterest:"http://api.pinterest.com/v1/urls/count.json?url={url}&callback=?"},k={googlePlus:function(n){var o=n.options.buttons.googlePlus;f(n.element).find(".buttons").append('
');g.___gcfg={lang:n.options.buttons.googlePlus.lang};var m=0;if(typeof gapi==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//apis.google.com/js/plusone.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{gapi.plusone.go()}},facebook:function(n){var o=n.options.buttons.facebook;f(n.element).find(".buttons").append('
');var m=0;if(typeof FB==="undefined"&&m==0){m=1;(function(t,q,p){var r,u=t.getElementsByTagName(q)[0];if(t.getElementById(p)){return}r=t.createElement(q);r.id=p;r.src="//connect.facebook.net/"+o.lang+"/all.js#xfbml=1";u.parentNode.insertBefore(r,u)}(d,"script","facebook-jssdk"))}else{FB.XFBML.parse()}},twitter:function(n){var o=n.options.buttons.twitter;f(n.element).find(".buttons").append('
');var m=0;if(typeof twttr==="undefined"&&m==0){m=1;(function(){var q=d.createElement("script");q.type="text/javascript";q.async=true;q.src="//platform.twitter.com/widgets.js";var p=d.getElementsByTagName("script")[0];p.parentNode.insertBefore(q,p)})()}else{f.ajax({url:"//platform.twitter.com/widgets.js",dataType:"script",cache:true})}},digg:function(n){var o=n.options.buttons.digg;f(n.element).find(".buttons").append('
');var m=0;if(typeof __DBW==="undefined"&&m==0){m=1;(function(){var q=d.createElement("SCRIPT"),p=d.getElementsByTagName("SCRIPT")[0];q.type="text/javascript";q.async=true;q.src="//widgets.digg.com/buttons.js";p.parentNode.insertBefore(q,p)})()}},delicious:function(p){if(p.options.buttons.delicious.size=="tall"){var o="width:50px;",n="height:35px;width:50px;font-size:15px;line-height:35px;",q="height:18px;line-height:18px;margin-top:3px;"}else{var o="width:93px;",n="float:right;padding:0 3px;height:20px;width:26px;line-height:20px;",q="float:left;height:20px;line-height:20px;"}var m=p.shorterTotal(p.options.count.delicious);if(typeof m==="undefined"){m=0}f(p.element).find(".buttons").append('
'+m+'
Delicious Add
');f(p.element).find(".delicious").on("click",function(){p.openPopup("delicious")})},stumbleupon:function(n){var o=n.options.buttons.stumbleupon;f(n.element).find(".buttons").append('
');var m=0;if(typeof STMBLPN==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.stumbleupon.com/1/widgets.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})();s=g.setTimeout(function(){if(typeof STMBLPN!=="undefined"){STMBLPN.processWidgets();clearInterval(s)}},500)}else{STMBLPN.processWidgets()}},linkedin:function(n){var o=n.options.buttons.linkedin;f(n.element).find(".buttons").append('
');var m=0;if(typeof g.IN==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.linkedin.com/in.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{g.IN.init()}},pinterest:function(m){var n=m.options.buttons.pinterest;f(m.element).find(".buttons").append('
Pin It
');(function(){var o=d.createElement("script");o.type="text/javascript";o.async=true;o.src="//assets.pinterest.com/js/pinit.js";var p=d.getElementsByTagName("script")[0];p.parentNode.insertBefore(o,p)})()}},j={googlePlus:function(){},facebook:function(){fb=g.setInterval(function(){if(typeof FB!=="undefined"){FB.Event.subscribe("edge.create",function(m){ga("send","social","facebook","like",m)});FB.Event.subscribe("edge.remove",function(m){ga("send","social","facebook","unlike",m)});FB.Event.subscribe("message.send",function(m){ga("send","social","facebook","like",m)});clearInterval(fb)}},1000)},twitter:function(){tw=g.setInterval(function(){if(typeof twttr!=="undefined"){twttr.events.bind("tweet",function(m){if(m){ga("send","social","twitter","tweet")}});clearInterval(tw)}},1000)},digg:function(){},delicious:function(){},stumbleupon:function(){},linkedin:function(){function m(){ga("send","social","linkedin","share")}},pinterest:function(){}},b={googlePlus:function(m){g.open("https://plus.google.com/share?hl="+m.buttons.googlePlus.lang+"&url="+encodeURIComponent((m.buttons.googlePlus.url!==""?m.buttons.googlePlus.url:m.url)),"","toolbar=0, status=0, width=900, height=500")},facebook:function(m){g.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((m.buttons.facebook.url!==""?m.buttons.facebook.url:m.url))+"&t="+m.text+"","","toolbar=0, status=0, width=900, height=500")},twitter:function(m){g.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(m.text)+"&url="+encodeURIComponent((m.buttons.twitter.url!==""?m.buttons.twitter.url:m.url))+(m.buttons.twitter.via!==""?"&via="+m.buttons.twitter.via:"")+(m.buttons.twitter.hashtags!==""?"&hashtags="+encodeURIComponent(m.buttons.twitter.hashtags):""),"","toolbar=0, status=0, width=650, height=360")},digg:function(m){g.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((m.buttons.digg.url!==""?m.buttons.digg.url:m.url))+"&title="+m.text+"&related=true&style=true","","toolbar=0, status=0, width=650, height=360")},delicious:function(m){g.open("http://www.delicious.com/save?v=5&noui&jump=close&url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&title="+m.text,"delicious","toolbar=no,width=550,height=550")},stumbleupon:function(m){g.open("http://www.stumbleupon.com/badge/?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url)),"stumbleupon","toolbar=no,width=550,height=550")},linkedin:function(m){g.open("https://www.linkedin.com/cws/share?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&token=&isFramed=true","linkedin","toolbar=no,width=550,height=550")},pinterest:function(m){g.open("http://pinterest.com/pin/create/button/?url="+encodeURIComponent((m.buttons.pinterest.url!==""?m.buttons.pinterest.url:m.url))+"&media="+encodeURIComponent(m.buttons.pinterest.media)+"&description="+m.buttons.pinterest.description,"pinterest","toolbar=no,width=700,height=300")}};function i(m,n){this.element=m;this.options=f.extend(true,{},l,n);this.options.share=n.share;this._defaults=l;this._name=c;this.init()}i.prototype.init=function(){var m=this;if(this.options.urlCurl!==""){h.googlePlus=this.options.urlCurl+"?url={url}&type=googlePlus";h.stumbleupon=this.options.urlCurl+"?url={url}&type=stumbleupon"}f(this.element).addClass(this.options.className);if(typeof f(this.element).data("title")!=="undefined"){this.options.title=f(this.element).attr("data-title")}if(typeof f(this.element).data("url")!=="undefined"){this.options.url=f(this.element).data("url")}if(typeof f(this.element).data("text")!=="undefined"){this.options.text=f(this.element).data("text")}f.each(this.options.share,function(o,n){if(n===true){m.options.shareTotal++}});if(m.options.enableCounter===true){f.each(this.options.share,function(p,o){if(o===true){try{m.getSocialJson(p)}catch(n){}}})}else{if(m.options.template!==""){this.options.render(this,this.options)}else{this.loadButtons()}}f(this.element).hover(function(){if(f(this).find(".buttons").length===0&&m.options.enableHover===true){m.loadButtons()}m.options.hover(m,m.options)},function(){m.options.hide(m,m.options)});f(this.element).click(function(){m.options.click(m,m.options);return false})};i.prototype.loadButtons=function(){var m=this;f(this.element).append('
');f.each(m.options.share,function(o,n){if(n==true){k[o](m);if(m.options.enableTracking===true){j[o]()}}})};i.prototype.getSocialJson=function(p){var o=this,n=0,m=h[p].replace("{url}",encodeURIComponent(this.options.url));if(this.options.buttons[p].urlCount===true&&this.options.buttons[p].url!==""){m=h[p].replace("{url}",this.options.buttons[p].url)}if(m!=""&&o.options.urlCurl!==""){f.getJSON(m,function(q){if(typeof q.count!=="undefined"){var r=q.count+"";r=r.replace("\u00c2\u00a0","");n+=parseInt(r,10)}else{if(q.data&&q.data.length>0&&typeof q.data[0].total_count!=="undefined"){n+=parseInt(q.data[0].total_count,10)}else{if(typeof q[0]!=="undefined"){n+=parseInt(q[0].total_posts,10)}else{if(typeof q[0]!=="undefined"){}}}}o.options.count[p]=n;o.options.total+=n;o.renderer();o.rendererPerso()}).error(function(){o.options.count[p]=0;o.rendererPerso()})}else{o.renderer();o.options.count[p]=0;o.rendererPerso()}};i.prototype.rendererPerso=function(){var m=0;for(e in this.options.count){m++}if(m===this.options.shareTotal){this.options.render(this,this.options)}};i.prototype.renderer=function(){var n=this.options.total,m=this.options.template;if(this.options.shorterTotal===true){n=this.shorterTotal(n)}if(m!==""){m=m.replace("{total}",n);f(this.element).html(m)}else{f(this.element).html('
'+n+""+(this.options.title!==""?'":"")+"
")}};i.prototype.shorterTotal=function(m){if(m>=1000000){m=(m/1000000).toFixed(2)+"M"}else{if(m>=1000){m=(m/1000).toFixed(1)+"k"}}return m};i.prototype.openPopup=function(m){b[m](this.options);if(this.options.enableTracking===true){var n={googlePlus:{site:"Google",action:"+1"},facebook:{site:"facebook",action:"like"},twitter:{site:"twitter",action:"tweet"},digg:{site:"digg",action:"add"},delicious:{site:"delicious",action:"add"},stumbleupon:{site:"stumbleupon",action:"add"},linkedin:{site:"linkedin",action:"share"},pinterest:{site:"pinterest",action:"pin"},,tumblr:{site:'tumblr',action:'share'}};ga("send","social",n[m].site,n[m].action)}};i.prototype.simulateClick=function(){var m=f(this.element).html();f(this.element).html(m.replace(this.options.total,this.options.total+1))};i.prototype.update=function(n,m){if(n!==""){this.options.url=n}if(m!==""){this.options.text=m}};f.fn[c]=function(m){var n=arguments;if(m===a||typeof m==="object"){return this.each(function(){if(!f.data(this,"plugin_"+c)){f.data(this,"plugin_"+c,new i(this,m))}})}else{if(typeof m==="string"&&m[0]!=="_"&&m!=="init"){return this.each(function(){var o=f.data(this,"plugin_"+c);if(o instanceof i&&typeof o[m]==="function"){o[m].apply(o,Array.prototype.slice.call(n,1))}})}}}})(jQuery,window,document); From e0a68633c37e363227d0814d073ecb4529f40380 Mon Sep 17 00:00:00 2001 From: famfam Date: Sun, 14 Jun 2015 17:16:51 +0200 Subject: [PATCH 35/37] Update jquery.sharrre.min.js --- jquery.sharrre.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.sharrre.min.js b/jquery.sharrre.min.js index 5a05405..178cd89 100644 --- a/jquery.sharrre.min.js +++ b/jquery.sharrre.min.js @@ -4,4 +4,4 @@ * Author: Julien Hany * License: MIT http://en.wikipedia.org/wiki/MIT_License or GPLv2 http://en.wikipedia.org/wiki/GNU_General_Public_License */ -(function(f,g,d,a){var c="sharrre",l={className:"sharrre",share:{googlePlus:false,facebook:false,twitter:false,digg:false,delicious:false,stumbleupon:false,linkedin:false,pinterest:false},shareTotal:0,template:"",title:"",url:d.location.href,text:d.title,urlCurl:"sharrre.php",count:{},total:0,shorterTotal:true,enableHover:true,enableCounter:true,enableTracking:false,hover:function(){},hide:function(){},click:function(){},render:function(){},buttons:{googlePlus:{url:"",urlCount:false,size:"medium",lang:"en-US",annotation:""},facebook:{url:"",urlCount:false,action:"like",layout:"button_count",width:"",send:"false",faces:"false",colorscheme:"",font:"",lang:"en_US"},twitter:{url:"",urlCount:false,count:"horizontal",hashtags:"",via:"",related:"",lang:"en"},digg:{url:"",urlCount:false,type:"DiggCompact"},delicious:{url:"",urlCount:false,size:"medium"},stumbleupon:{url:"",urlCount:false,layout:"1"},linkedin:{url:"",urlCount:false,counter:""},pinterest:{url:"",media:"",description:"",layout:"horizontal"}}},h={googlePlus:"",facebook:"https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?",twitter:"http://cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?",digg:"http://services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?",delicious:"http://feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?",stumbleupon:"",linkedin:"http://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?",pinterest:"http://api.pinterest.com/v1/urls/count.json?url={url}&callback=?"},k={googlePlus:function(n){var o=n.options.buttons.googlePlus;f(n.element).find(".buttons").append('
');g.___gcfg={lang:n.options.buttons.googlePlus.lang};var m=0;if(typeof gapi==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//apis.google.com/js/plusone.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{gapi.plusone.go()}},facebook:function(n){var o=n.options.buttons.facebook;f(n.element).find(".buttons").append('');var m=0;if(typeof FB==="undefined"&&m==0){m=1;(function(t,q,p){var r,u=t.getElementsByTagName(q)[0];if(t.getElementById(p)){return}r=t.createElement(q);r.id=p;r.src="//connect.facebook.net/"+o.lang+"/all.js#xfbml=1";u.parentNode.insertBefore(r,u)}(d,"script","facebook-jssdk"))}else{FB.XFBML.parse()}},twitter:function(n){var o=n.options.buttons.twitter;f(n.element).find(".buttons").append('');var m=0;if(typeof twttr==="undefined"&&m==0){m=1;(function(){var q=d.createElement("script");q.type="text/javascript";q.async=true;q.src="//platform.twitter.com/widgets.js";var p=d.getElementsByTagName("script")[0];p.parentNode.insertBefore(q,p)})()}else{f.ajax({url:"//platform.twitter.com/widgets.js",dataType:"script",cache:true})}},digg:function(n){var o=n.options.buttons.digg;f(n.element).find(".buttons").append('
');var m=0;if(typeof __DBW==="undefined"&&m==0){m=1;(function(){var q=d.createElement("SCRIPT"),p=d.getElementsByTagName("SCRIPT")[0];q.type="text/javascript";q.async=true;q.src="//widgets.digg.com/buttons.js";p.parentNode.insertBefore(q,p)})()}},delicious:function(p){if(p.options.buttons.delicious.size=="tall"){var o="width:50px;",n="height:35px;width:50px;font-size:15px;line-height:35px;",q="height:18px;line-height:18px;margin-top:3px;"}else{var o="width:93px;",n="float:right;padding:0 3px;height:20px;width:26px;line-height:20px;",q="float:left;height:20px;line-height:20px;"}var m=p.shorterTotal(p.options.count.delicious);if(typeof m==="undefined"){m=0}f(p.element).find(".buttons").append('
'+m+'
Delicious Add
');f(p.element).find(".delicious").on("click",function(){p.openPopup("delicious")})},stumbleupon:function(n){var o=n.options.buttons.stumbleupon;f(n.element).find(".buttons").append('
');var m=0;if(typeof STMBLPN==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.stumbleupon.com/1/widgets.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})();s=g.setTimeout(function(){if(typeof STMBLPN!=="undefined"){STMBLPN.processWidgets();clearInterval(s)}},500)}else{STMBLPN.processWidgets()}},linkedin:function(n){var o=n.options.buttons.linkedin;f(n.element).find(".buttons").append('
');var m=0;if(typeof g.IN==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.linkedin.com/in.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{g.IN.init()}},pinterest:function(m){var n=m.options.buttons.pinterest;f(m.element).find(".buttons").append('');(function(){var o=d.createElement("script");o.type="text/javascript";o.async=true;o.src="//assets.pinterest.com/js/pinit.js";var p=d.getElementsByTagName("script")[0];p.parentNode.insertBefore(o,p)})()}},j={googlePlus:function(){},facebook:function(){fb=g.setInterval(function(){if(typeof FB!=="undefined"){FB.Event.subscribe("edge.create",function(m){ga("send","social","facebook","like",m)});FB.Event.subscribe("edge.remove",function(m){ga("send","social","facebook","unlike",m)});FB.Event.subscribe("message.send",function(m){ga("send","social","facebook","like",m)});clearInterval(fb)}},1000)},twitter:function(){tw=g.setInterval(function(){if(typeof twttr!=="undefined"){twttr.events.bind("tweet",function(m){if(m){ga("send","social","twitter","tweet")}});clearInterval(tw)}},1000)},digg:function(){},delicious:function(){},stumbleupon:function(){},linkedin:function(){function m(){ga("send","social","linkedin","share")}},pinterest:function(){}},b={googlePlus:function(m){g.open("https://plus.google.com/share?hl="+m.buttons.googlePlus.lang+"&url="+encodeURIComponent((m.buttons.googlePlus.url!==""?m.buttons.googlePlus.url:m.url)),"","toolbar=0, status=0, width=900, height=500")},facebook:function(m){g.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((m.buttons.facebook.url!==""?m.buttons.facebook.url:m.url))+"&t="+m.text+"","","toolbar=0, status=0, width=900, height=500")},twitter:function(m){g.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(m.text)+"&url="+encodeURIComponent((m.buttons.twitter.url!==""?m.buttons.twitter.url:m.url))+(m.buttons.twitter.via!==""?"&via="+m.buttons.twitter.via:"")+(m.buttons.twitter.hashtags!==""?"&hashtags="+encodeURIComponent(m.buttons.twitter.hashtags):""),"","toolbar=0, status=0, width=650, height=360")},digg:function(m){g.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((m.buttons.digg.url!==""?m.buttons.digg.url:m.url))+"&title="+m.text+"&related=true&style=true","","toolbar=0, status=0, width=650, height=360")},delicious:function(m){g.open("http://www.delicious.com/save?v=5&noui&jump=close&url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&title="+m.text,"delicious","toolbar=no,width=550,height=550")},stumbleupon:function(m){g.open("http://www.stumbleupon.com/badge/?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url)),"stumbleupon","toolbar=no,width=550,height=550")},linkedin:function(m){g.open("https://www.linkedin.com/cws/share?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&token=&isFramed=true","linkedin","toolbar=no,width=550,height=550")},pinterest:function(m){g.open("http://pinterest.com/pin/create/button/?url="+encodeURIComponent((m.buttons.pinterest.url!==""?m.buttons.pinterest.url:m.url))+"&media="+encodeURIComponent(m.buttons.pinterest.media)+"&description="+m.buttons.pinterest.description,"pinterest","toolbar=no,width=700,height=300")}};function i(m,n){this.element=m;this.options=f.extend(true,{},l,n);this.options.share=n.share;this._defaults=l;this._name=c;this.init()}i.prototype.init=function(){var m=this;if(this.options.urlCurl!==""){h.googlePlus=this.options.urlCurl+"?url={url}&type=googlePlus";h.stumbleupon=this.options.urlCurl+"?url={url}&type=stumbleupon"}f(this.element).addClass(this.options.className);if(typeof f(this.element).data("title")!=="undefined"){this.options.title=f(this.element).attr("data-title")}if(typeof f(this.element).data("url")!=="undefined"){this.options.url=f(this.element).data("url")}if(typeof f(this.element).data("text")!=="undefined"){this.options.text=f(this.element).data("text")}f.each(this.options.share,function(o,n){if(n===true){m.options.shareTotal++}});if(m.options.enableCounter===true){f.each(this.options.share,function(p,o){if(o===true){try{m.getSocialJson(p)}catch(n){}}})}else{if(m.options.template!==""){this.options.render(this,this.options)}else{this.loadButtons()}}f(this.element).hover(function(){if(f(this).find(".buttons").length===0&&m.options.enableHover===true){m.loadButtons()}m.options.hover(m,m.options)},function(){m.options.hide(m,m.options)});f(this.element).click(function(){m.options.click(m,m.options);return false})};i.prototype.loadButtons=function(){var m=this;f(this.element).append('
');f.each(m.options.share,function(o,n){if(n==true){k[o](m);if(m.options.enableTracking===true){j[o]()}}})};i.prototype.getSocialJson=function(p){var o=this,n=0,m=h[p].replace("{url}",encodeURIComponent(this.options.url));if(this.options.buttons[p].urlCount===true&&this.options.buttons[p].url!==""){m=h[p].replace("{url}",this.options.buttons[p].url)}if(m!=""&&o.options.urlCurl!==""){f.getJSON(m,function(q){if(typeof q.count!=="undefined"){var r=q.count+"";r=r.replace("\u00c2\u00a0","");n+=parseInt(r,10)}else{if(q.data&&q.data.length>0&&typeof q.data[0].total_count!=="undefined"){n+=parseInt(q.data[0].total_count,10)}else{if(typeof q[0]!=="undefined"){n+=parseInt(q[0].total_posts,10)}else{if(typeof q[0]!=="undefined"){}}}}o.options.count[p]=n;o.options.total+=n;o.renderer();o.rendererPerso()}).error(function(){o.options.count[p]=0;o.rendererPerso()})}else{o.renderer();o.options.count[p]=0;o.rendererPerso()}};i.prototype.rendererPerso=function(){var m=0;for(e in this.options.count){m++}if(m===this.options.shareTotal){this.options.render(this,this.options)}};i.prototype.renderer=function(){var n=this.options.total,m=this.options.template;if(this.options.shorterTotal===true){n=this.shorterTotal(n)}if(m!==""){m=m.replace("{total}",n);f(this.element).html(m)}else{f(this.element).html('
'+n+""+(this.options.title!==""?'":"")+"
")}};i.prototype.shorterTotal=function(m){if(m>=1000000){m=(m/1000000).toFixed(2)+"M"}else{if(m>=1000){m=(m/1000).toFixed(1)+"k"}}return m};i.prototype.openPopup=function(m){b[m](this.options);if(this.options.enableTracking===true){var n={googlePlus:{site:"Google",action:"+1"},facebook:{site:"facebook",action:"like"},twitter:{site:"twitter",action:"tweet"},digg:{site:"digg",action:"add"},delicious:{site:"delicious",action:"add"},stumbleupon:{site:"stumbleupon",action:"add"},linkedin:{site:"linkedin",action:"share"},pinterest:{site:"pinterest",action:"pin"},,tumblr:{site:'tumblr',action:'share'}};ga("send","social",n[m].site,n[m].action)}};i.prototype.simulateClick=function(){var m=f(this.element).html();f(this.element).html(m.replace(this.options.total,this.options.total+1))};i.prototype.update=function(n,m){if(n!==""){this.options.url=n}if(m!==""){this.options.text=m}};f.fn[c]=function(m){var n=arguments;if(m===a||typeof m==="object"){return this.each(function(){if(!f.data(this,"plugin_"+c)){f.data(this,"plugin_"+c,new i(this,m))}})}else{if(typeof m==="string"&&m[0]!=="_"&&m!=="init"){return this.each(function(){var o=f.data(this,"plugin_"+c);if(o instanceof i&&typeof o[m]==="function"){o[m].apply(o,Array.prototype.slice.call(n,1))}})}}}})(jQuery,window,document); +(function(f,g,d,a){var c="sharrre",l={className:"sharrre",share:{googlePlus:false,facebook:false,twitter:false,digg:false,delicious:false,stumbleupon:false,linkedin:false,pinterest:false},shareTotal:0,template:"",title:"",url:d.location.href,text:d.title,urlCurl:"sharrre.php",count:{},total:0,shorterTotal:true,enableHover:true,enableCounter:true,enableTracking:false,hover:function(){},hide:function(){},click:function(){},render:function(){},buttons:{googlePlus:{url:"",urlCount:false,size:"medium",lang:"en-US",annotation:""},facebook:{url:"",urlCount:false,action:"like",layout:"button_count",width:"",send:"false",faces:"false",colorscheme:"",font:"",lang:"en_US"},twitter:{url:"",urlCount:false,count:"horizontal",hashtags:"",via:"",related:"",lang:"en"},digg:{url:"",urlCount:false,type:"DiggCompact"},delicious:{url:"",urlCount:false,size:"medium"},stumbleupon:{url:"",urlCount:false,layout:"1"},linkedin:{url:"",urlCount:false,counter:""},pinterest:{url:"",media:"",description:"",layout:"horizontal"}}},h={googlePlus:"",facebook:"https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?",twitter:"http://cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?",digg:"http://services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?",delicious:"http://feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?",stumbleupon:"",linkedin:"http://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?",pinterest:"http://api.pinterest.com/v1/urls/count.json?url={url}&callback=?"},k={googlePlus:function(n){var o=n.options.buttons.googlePlus;f(n.element).find(".buttons").append('
');g.___gcfg={lang:n.options.buttons.googlePlus.lang};var m=0;if(typeof gapi==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//apis.google.com/js/plusone.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{gapi.plusone.go()}},facebook:function(n){var o=n.options.buttons.facebook;f(n.element).find(".buttons").append('');var m=0;if(typeof FB==="undefined"&&m==0){m=1;(function(t,q,p){var r,u=t.getElementsByTagName(q)[0];if(t.getElementById(p)){return}r=t.createElement(q);r.id=p;r.src="//connect.facebook.net/"+o.lang+"/all.js#xfbml=1";u.parentNode.insertBefore(r,u)}(d,"script","facebook-jssdk"))}else{FB.XFBML.parse()}},twitter:function(n){var o=n.options.buttons.twitter;f(n.element).find(".buttons").append('');var m=0;if(typeof twttr==="undefined"&&m==0){m=1;(function(){var q=d.createElement("script");q.type="text/javascript";q.async=true;q.src="//platform.twitter.com/widgets.js";var p=d.getElementsByTagName("script")[0];p.parentNode.insertBefore(q,p)})()}else{f.ajax({url:"//platform.twitter.com/widgets.js",dataType:"script",cache:true})}},digg:function(n){var o=n.options.buttons.digg;f(n.element).find(".buttons").append('
');var m=0;if(typeof __DBW==="undefined"&&m==0){m=1;(function(){var q=d.createElement("SCRIPT"),p=d.getElementsByTagName("SCRIPT")[0];q.type="text/javascript";q.async=true;q.src="//widgets.digg.com/buttons.js";p.parentNode.insertBefore(q,p)})()}},delicious:function(p){if(p.options.buttons.delicious.size=="tall"){var o="width:50px;",n="height:35px;width:50px;font-size:15px;line-height:35px;",q="height:18px;line-height:18px;margin-top:3px;"}else{var o="width:93px;",n="float:right;padding:0 3px;height:20px;width:26px;line-height:20px;",q="float:left;height:20px;line-height:20px;"}var m=p.shorterTotal(p.options.count.delicious);if(typeof m==="undefined"){m=0}f(p.element).find(".buttons").append('
'+m+'
Delicious Add
');f(p.element).find(".delicious").on("click",function(){p.openPopup("delicious")})},stumbleupon:function(n){var o=n.options.buttons.stumbleupon;f(n.element).find(".buttons").append('
');var m=0;if(typeof STMBLPN==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.stumbleupon.com/1/widgets.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})();s=g.setTimeout(function(){if(typeof STMBLPN!=="undefined"){STMBLPN.processWidgets();clearInterval(s)}},500)}else{STMBLPN.processWidgets()}},linkedin:function(n){var o=n.options.buttons.linkedin;f(n.element).find(".buttons").append('
');var m=0;if(typeof g.IN==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.linkedin.com/in.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{g.IN.init()}},pinterest:function(m){var n=m.options.buttons.pinterest;f(m.element).find(".buttons").append('');(function(){var o=d.createElement("script");o.type="text/javascript";o.async=true;o.src="//assets.pinterest.com/js/pinit.js";var p=d.getElementsByTagName("script")[0];p.parentNode.insertBefore(o,p)})()}},j={googlePlus:function(){},facebook:function(){fb=g.setInterval(function(){if(typeof FB!=="undefined"){FB.Event.subscribe("edge.create",function(m){ga("send","social","facebook","like",m)});FB.Event.subscribe("edge.remove",function(m){ga("send","social","facebook","unlike",m)});FB.Event.subscribe("message.send",function(m){ga("send","social","facebook","like",m)});clearInterval(fb)}},1000)},twitter:function(){tw=g.setInterval(function(){if(typeof twttr!=="undefined"){twttr.events.bind("tweet",function(m){if(m){ga("send","social","twitter","tweet")}});clearInterval(tw)}},1000)},digg:function(){},delicious:function(){},stumbleupon:function(){},linkedin:function(){function m(){ga("send","social","linkedin","share")}},pinterest:function(){}},b={googlePlus:function(m){g.open("https://plus.google.com/share?hl="+m.buttons.googlePlus.lang+"&url="+encodeURIComponent((m.buttons.googlePlus.url!==""?m.buttons.googlePlus.url:m.url)),"","toolbar=0, status=0, width=900, height=500")},facebook:function(m){g.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((m.buttons.facebook.url!==""?m.buttons.facebook.url:m.url))+"&t="+m.text+"","","toolbar=0, status=0, width=900, height=500")},twitter:function(m){g.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(m.text)+"&url="+encodeURIComponent((m.buttons.twitter.url!==""?m.buttons.twitter.url:m.url))+(m.buttons.twitter.via!==""?"&via="+m.buttons.twitter.via:"")+(m.buttons.twitter.hashtags!==""?"&hashtags="+encodeURIComponent(m.buttons.twitter.hashtags):""),"","toolbar=0, status=0, width=650, height=360")},digg:function(m){g.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((m.buttons.digg.url!==""?m.buttons.digg.url:m.url))+"&title="+m.text+"&related=true&style=true","","toolbar=0, status=0, width=650, height=360")},delicious:function(m){g.open("http://www.delicious.com/save?v=5&noui&jump=close&url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&title="+m.text,"delicious","toolbar=no,width=550,height=550")},stumbleupon:function(m){g.open("http://www.stumbleupon.com/badge/?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url)),"stumbleupon","toolbar=no,width=550,height=550")},linkedin:function(m){g.open("https://www.linkedin.com/cws/share?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&token=&isFramed=true","linkedin","toolbar=no,width=550,height=550")},pinterest:function(m){g.open("http://pinterest.com/pin/create/button/?url="+encodeURIComponent((m.buttons.pinterest.url!==""?m.buttons.pinterest.url:m.url))+"&media="+encodeURIComponent(m.buttons.pinterest.media)+"&description="+m.buttons.pinterest.description,"pinterest","toolbar=no,width=700,height=300")}};function i(m,n){this.element=m;this.options=f.extend(true,{},l,n);this.options.share=n.share;this._defaults=l;this._name=c;this.init()}i.prototype.init=function(){var m=this;if(this.options.urlCurl!==""){h.googlePlus=this.options.urlCurl+"?url={url}&type=googlePlus";h.stumbleupon=this.options.urlCurl+"?url={url}&type=stumbleupon"}f(this.element).addClass(this.options.className);if(typeof f(this.element).data("title")!=="undefined"){this.options.title=f(this.element).attr("data-title")}if(typeof f(this.element).data("url")!=="undefined"){this.options.url=f(this.element).data("url")}if(typeof f(this.element).data("text")!=="undefined"){this.options.text=f(this.element).data("text")}f.each(this.options.share,function(o,n){if(n===true){m.options.shareTotal++}});if(m.options.enableCounter===true){f.each(this.options.share,function(p,o){if(o===true){try{m.getSocialJson(p)}catch(n){}}})}else{if(m.options.template!==""){this.options.render(this,this.options)}else{this.loadButtons()}}f(this.element).hover(function(){if(f(this).find(".buttons").length===0&&m.options.enableHover===true){m.loadButtons()}m.options.hover(m,m.options)},function(){m.options.hide(m,m.options)});f(this.element).click(function(){m.options.click(m,m.options);return false})};i.prototype.loadButtons=function(){var m=this;f(this.element).append('
');f.each(m.options.share,function(o,n){if(n==true){k[o](m);if(m.options.enableTracking===true){j[o]()}}})};i.prototype.getSocialJson=function(p){var o=this,n=0,m=h[p].replace("{url}",encodeURIComponent(this.options.url));if(this.options.buttons[p].urlCount===true&&this.options.buttons[p].url!==""){m=h[p].replace("{url}",this.options.buttons[p].url)}if(m!=""&&o.options.urlCurl!==""){f.getJSON(m,function(q){if(typeof q.count!=="undefined"){var r=q.count+"";r=r.replace("\u00c2\u00a0","");n+=parseInt(r,10)}else{if(q.data&&q.data.length>0&&typeof q.data[0].total_count!=="undefined"){n+=parseInt(q.data[0].total_count,10)}else{if(typeof q[0]!=="undefined"){n+=parseInt(q[0].total_posts,10)}else{if(typeof q[0]!=="undefined"){}}}}o.options.count[p]=n;o.options.total+=n;o.renderer();o.rendererPerso()}).error(function(){o.options.count[p]=0;o.rendererPerso()})}else{o.renderer();o.options.count[p]=0;o.rendererPerso()}};i.prototype.rendererPerso=function(){var m=0;for(e in this.options.count){m++}if(m===this.options.shareTotal){this.options.render(this,this.options)}};i.prototype.renderer=function(){var n=this.options.total,m=this.options.template;if(this.options.shorterTotal===true){n=this.shorterTotal(n)}if(m!==""){m=m.replace("{total}",n);f(this.element).html(m)}else{f(this.element).html('
'+n+""+(this.options.title!==""?'":"")+"
")}};i.prototype.shorterTotal=function(m){if(m>=1000000){m=(m/1000000).toFixed(2)+"M"}else{if(m>=1000){m=(m/1000).toFixed(1)+"k"}}return m};i.prototype.openPopup=function(m){b[m](this.options);if(this.options.enableTracking===true){var n={googlePlus:{site:"Google",action:"+1"},facebook:{site:"facebook",action:"like"},twitter:{site:"twitter",action:"tweet"},digg:{site:"digg",action:"add"},delicious:{site:"delicious",action:"add"},stumbleupon:{site:"stumbleupon",action:"add"},linkedin:{site:"linkedin",action:"share"},pinterest:{site:"pinterest",action:"pin"},tumblr:{site:'tumblr',action:'share'}};ga("send","social",n[m].site,n[m].action)}};i.prototype.simulateClick=function(){var m=f(this.element).html();f(this.element).html(m.replace(this.options.total,this.options.total+1))};i.prototype.update=function(n,m){if(n!==""){this.options.url=n}if(m!==""){this.options.text=m}};f.fn[c]=function(m){var n=arguments;if(m===a||typeof m==="object"){return this.each(function(){if(!f.data(this,"plugin_"+c)){f.data(this,"plugin_"+c,new i(this,m))}})}else{if(typeof m==="string"&&m[0]!=="_"&&m!=="init"){return this.each(function(){var o=f.data(this,"plugin_"+c);if(o instanceof i&&typeof o[m]==="function"){o[m].apply(o,Array.prototype.slice.call(n,1))}})}}}})(jQuery,window,document); From 55b2e740501debe76313e208b02c4fc230199c18 Mon Sep 17 00:00:00 2001 From: famfam Date: Sun, 14 Jun 2015 18:02:51 +0200 Subject: [PATCH 36/37] Add email method for open popup --- jquery.sharrre.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jquery.sharrre.js b/jquery.sharrre.js index 714563b..f3e5a66 100644 --- a/jquery.sharrre.js +++ b/jquery.sharrre.js @@ -602,7 +602,8 @@ var pluginName = 'sharrre', stumbleupon: {site: 'stumbleupon', action: 'add'}, linkedin: {site: 'linkedin', action: 'share'}, pinterest: {site: 'pinterest', action: 'pin'}, - tumblr: {site: 'tumblr', action: 'share'} + tumblr: {site: 'tumblr', action: 'share'}, + mail: {site: 'mail', action: 'share'} }; //_gaq.push(['_trackSocial', tracking[site].site, tracking[site].action]); //ga('send', 'social', tracking[site].site, tracking[site].action); From c9d0ca15df9722f02aa688a25eec49c1ac0b6c03 Mon Sep 17 00:00:00 2001 From: famfam Date: Sun, 14 Jun 2015 18:03:38 +0200 Subject: [PATCH 37/37] Update jquery.sharrre.min.js Add email method for open popup --- jquery.sharrre.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.sharrre.min.js b/jquery.sharrre.min.js index 178cd89..65740ae 100644 --- a/jquery.sharrre.min.js +++ b/jquery.sharrre.min.js @@ -4,4 +4,4 @@ * Author: Julien Hany * License: MIT http://en.wikipedia.org/wiki/MIT_License or GPLv2 http://en.wikipedia.org/wiki/GNU_General_Public_License */ -(function(f,g,d,a){var c="sharrre",l={className:"sharrre",share:{googlePlus:false,facebook:false,twitter:false,digg:false,delicious:false,stumbleupon:false,linkedin:false,pinterest:false},shareTotal:0,template:"",title:"",url:d.location.href,text:d.title,urlCurl:"sharrre.php",count:{},total:0,shorterTotal:true,enableHover:true,enableCounter:true,enableTracking:false,hover:function(){},hide:function(){},click:function(){},render:function(){},buttons:{googlePlus:{url:"",urlCount:false,size:"medium",lang:"en-US",annotation:""},facebook:{url:"",urlCount:false,action:"like",layout:"button_count",width:"",send:"false",faces:"false",colorscheme:"",font:"",lang:"en_US"},twitter:{url:"",urlCount:false,count:"horizontal",hashtags:"",via:"",related:"",lang:"en"},digg:{url:"",urlCount:false,type:"DiggCompact"},delicious:{url:"",urlCount:false,size:"medium"},stumbleupon:{url:"",urlCount:false,layout:"1"},linkedin:{url:"",urlCount:false,counter:""},pinterest:{url:"",media:"",description:"",layout:"horizontal"}}},h={googlePlus:"",facebook:"https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?",twitter:"http://cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?",digg:"http://services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?",delicious:"http://feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?",stumbleupon:"",linkedin:"http://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?",pinterest:"http://api.pinterest.com/v1/urls/count.json?url={url}&callback=?"},k={googlePlus:function(n){var o=n.options.buttons.googlePlus;f(n.element).find(".buttons").append('
');g.___gcfg={lang:n.options.buttons.googlePlus.lang};var m=0;if(typeof gapi==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//apis.google.com/js/plusone.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{gapi.plusone.go()}},facebook:function(n){var o=n.options.buttons.facebook;f(n.element).find(".buttons").append('');var m=0;if(typeof FB==="undefined"&&m==0){m=1;(function(t,q,p){var r,u=t.getElementsByTagName(q)[0];if(t.getElementById(p)){return}r=t.createElement(q);r.id=p;r.src="//connect.facebook.net/"+o.lang+"/all.js#xfbml=1";u.parentNode.insertBefore(r,u)}(d,"script","facebook-jssdk"))}else{FB.XFBML.parse()}},twitter:function(n){var o=n.options.buttons.twitter;f(n.element).find(".buttons").append('');var m=0;if(typeof twttr==="undefined"&&m==0){m=1;(function(){var q=d.createElement("script");q.type="text/javascript";q.async=true;q.src="//platform.twitter.com/widgets.js";var p=d.getElementsByTagName("script")[0];p.parentNode.insertBefore(q,p)})()}else{f.ajax({url:"//platform.twitter.com/widgets.js",dataType:"script",cache:true})}},digg:function(n){var o=n.options.buttons.digg;f(n.element).find(".buttons").append('
');var m=0;if(typeof __DBW==="undefined"&&m==0){m=1;(function(){var q=d.createElement("SCRIPT"),p=d.getElementsByTagName("SCRIPT")[0];q.type="text/javascript";q.async=true;q.src="//widgets.digg.com/buttons.js";p.parentNode.insertBefore(q,p)})()}},delicious:function(p){if(p.options.buttons.delicious.size=="tall"){var o="width:50px;",n="height:35px;width:50px;font-size:15px;line-height:35px;",q="height:18px;line-height:18px;margin-top:3px;"}else{var o="width:93px;",n="float:right;padding:0 3px;height:20px;width:26px;line-height:20px;",q="float:left;height:20px;line-height:20px;"}var m=p.shorterTotal(p.options.count.delicious);if(typeof m==="undefined"){m=0}f(p.element).find(".buttons").append('
'+m+'
Delicious Add
');f(p.element).find(".delicious").on("click",function(){p.openPopup("delicious")})},stumbleupon:function(n){var o=n.options.buttons.stumbleupon;f(n.element).find(".buttons").append('
');var m=0;if(typeof STMBLPN==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.stumbleupon.com/1/widgets.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})();s=g.setTimeout(function(){if(typeof STMBLPN!=="undefined"){STMBLPN.processWidgets();clearInterval(s)}},500)}else{STMBLPN.processWidgets()}},linkedin:function(n){var o=n.options.buttons.linkedin;f(n.element).find(".buttons").append('
');var m=0;if(typeof g.IN==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.linkedin.com/in.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{g.IN.init()}},pinterest:function(m){var n=m.options.buttons.pinterest;f(m.element).find(".buttons").append('');(function(){var o=d.createElement("script");o.type="text/javascript";o.async=true;o.src="//assets.pinterest.com/js/pinit.js";var p=d.getElementsByTagName("script")[0];p.parentNode.insertBefore(o,p)})()}},j={googlePlus:function(){},facebook:function(){fb=g.setInterval(function(){if(typeof FB!=="undefined"){FB.Event.subscribe("edge.create",function(m){ga("send","social","facebook","like",m)});FB.Event.subscribe("edge.remove",function(m){ga("send","social","facebook","unlike",m)});FB.Event.subscribe("message.send",function(m){ga("send","social","facebook","like",m)});clearInterval(fb)}},1000)},twitter:function(){tw=g.setInterval(function(){if(typeof twttr!=="undefined"){twttr.events.bind("tweet",function(m){if(m){ga("send","social","twitter","tweet")}});clearInterval(tw)}},1000)},digg:function(){},delicious:function(){},stumbleupon:function(){},linkedin:function(){function m(){ga("send","social","linkedin","share")}},pinterest:function(){}},b={googlePlus:function(m){g.open("https://plus.google.com/share?hl="+m.buttons.googlePlus.lang+"&url="+encodeURIComponent((m.buttons.googlePlus.url!==""?m.buttons.googlePlus.url:m.url)),"","toolbar=0, status=0, width=900, height=500")},facebook:function(m){g.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((m.buttons.facebook.url!==""?m.buttons.facebook.url:m.url))+"&t="+m.text+"","","toolbar=0, status=0, width=900, height=500")},twitter:function(m){g.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(m.text)+"&url="+encodeURIComponent((m.buttons.twitter.url!==""?m.buttons.twitter.url:m.url))+(m.buttons.twitter.via!==""?"&via="+m.buttons.twitter.via:"")+(m.buttons.twitter.hashtags!==""?"&hashtags="+encodeURIComponent(m.buttons.twitter.hashtags):""),"","toolbar=0, status=0, width=650, height=360")},digg:function(m){g.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((m.buttons.digg.url!==""?m.buttons.digg.url:m.url))+"&title="+m.text+"&related=true&style=true","","toolbar=0, status=0, width=650, height=360")},delicious:function(m){g.open("http://www.delicious.com/save?v=5&noui&jump=close&url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&title="+m.text,"delicious","toolbar=no,width=550,height=550")},stumbleupon:function(m){g.open("http://www.stumbleupon.com/badge/?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url)),"stumbleupon","toolbar=no,width=550,height=550")},linkedin:function(m){g.open("https://www.linkedin.com/cws/share?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&token=&isFramed=true","linkedin","toolbar=no,width=550,height=550")},pinterest:function(m){g.open("http://pinterest.com/pin/create/button/?url="+encodeURIComponent((m.buttons.pinterest.url!==""?m.buttons.pinterest.url:m.url))+"&media="+encodeURIComponent(m.buttons.pinterest.media)+"&description="+m.buttons.pinterest.description,"pinterest","toolbar=no,width=700,height=300")}};function i(m,n){this.element=m;this.options=f.extend(true,{},l,n);this.options.share=n.share;this._defaults=l;this._name=c;this.init()}i.prototype.init=function(){var m=this;if(this.options.urlCurl!==""){h.googlePlus=this.options.urlCurl+"?url={url}&type=googlePlus";h.stumbleupon=this.options.urlCurl+"?url={url}&type=stumbleupon"}f(this.element).addClass(this.options.className);if(typeof f(this.element).data("title")!=="undefined"){this.options.title=f(this.element).attr("data-title")}if(typeof f(this.element).data("url")!=="undefined"){this.options.url=f(this.element).data("url")}if(typeof f(this.element).data("text")!=="undefined"){this.options.text=f(this.element).data("text")}f.each(this.options.share,function(o,n){if(n===true){m.options.shareTotal++}});if(m.options.enableCounter===true){f.each(this.options.share,function(p,o){if(o===true){try{m.getSocialJson(p)}catch(n){}}})}else{if(m.options.template!==""){this.options.render(this,this.options)}else{this.loadButtons()}}f(this.element).hover(function(){if(f(this).find(".buttons").length===0&&m.options.enableHover===true){m.loadButtons()}m.options.hover(m,m.options)},function(){m.options.hide(m,m.options)});f(this.element).click(function(){m.options.click(m,m.options);return false})};i.prototype.loadButtons=function(){var m=this;f(this.element).append('
');f.each(m.options.share,function(o,n){if(n==true){k[o](m);if(m.options.enableTracking===true){j[o]()}}})};i.prototype.getSocialJson=function(p){var o=this,n=0,m=h[p].replace("{url}",encodeURIComponent(this.options.url));if(this.options.buttons[p].urlCount===true&&this.options.buttons[p].url!==""){m=h[p].replace("{url}",this.options.buttons[p].url)}if(m!=""&&o.options.urlCurl!==""){f.getJSON(m,function(q){if(typeof q.count!=="undefined"){var r=q.count+"";r=r.replace("\u00c2\u00a0","");n+=parseInt(r,10)}else{if(q.data&&q.data.length>0&&typeof q.data[0].total_count!=="undefined"){n+=parseInt(q.data[0].total_count,10)}else{if(typeof q[0]!=="undefined"){n+=parseInt(q[0].total_posts,10)}else{if(typeof q[0]!=="undefined"){}}}}o.options.count[p]=n;o.options.total+=n;o.renderer();o.rendererPerso()}).error(function(){o.options.count[p]=0;o.rendererPerso()})}else{o.renderer();o.options.count[p]=0;o.rendererPerso()}};i.prototype.rendererPerso=function(){var m=0;for(e in this.options.count){m++}if(m===this.options.shareTotal){this.options.render(this,this.options)}};i.prototype.renderer=function(){var n=this.options.total,m=this.options.template;if(this.options.shorterTotal===true){n=this.shorterTotal(n)}if(m!==""){m=m.replace("{total}",n);f(this.element).html(m)}else{f(this.element).html('
'+n+""+(this.options.title!==""?'":"")+"
")}};i.prototype.shorterTotal=function(m){if(m>=1000000){m=(m/1000000).toFixed(2)+"M"}else{if(m>=1000){m=(m/1000).toFixed(1)+"k"}}return m};i.prototype.openPopup=function(m){b[m](this.options);if(this.options.enableTracking===true){var n={googlePlus:{site:"Google",action:"+1"},facebook:{site:"facebook",action:"like"},twitter:{site:"twitter",action:"tweet"},digg:{site:"digg",action:"add"},delicious:{site:"delicious",action:"add"},stumbleupon:{site:"stumbleupon",action:"add"},linkedin:{site:"linkedin",action:"share"},pinterest:{site:"pinterest",action:"pin"},tumblr:{site:'tumblr',action:'share'}};ga("send","social",n[m].site,n[m].action)}};i.prototype.simulateClick=function(){var m=f(this.element).html();f(this.element).html(m.replace(this.options.total,this.options.total+1))};i.prototype.update=function(n,m){if(n!==""){this.options.url=n}if(m!==""){this.options.text=m}};f.fn[c]=function(m){var n=arguments;if(m===a||typeof m==="object"){return this.each(function(){if(!f.data(this,"plugin_"+c)){f.data(this,"plugin_"+c,new i(this,m))}})}else{if(typeof m==="string"&&m[0]!=="_"&&m!=="init"){return this.each(function(){var o=f.data(this,"plugin_"+c);if(o instanceof i&&typeof o[m]==="function"){o[m].apply(o,Array.prototype.slice.call(n,1))}})}}}})(jQuery,window,document); +(function(f,g,d,a){var c="sharrre",l={className:"sharrre",share:{googlePlus:false,facebook:false,twitter:false,digg:false,delicious:false,stumbleupon:false,linkedin:false,pinterest:false},shareTotal:0,template:"",title:"",url:d.location.href,text:d.title,urlCurl:"sharrre.php",count:{},total:0,shorterTotal:true,enableHover:true,enableCounter:true,enableTracking:false,hover:function(){},hide:function(){},click:function(){},render:function(){},buttons:{googlePlus:{url:"",urlCount:false,size:"medium",lang:"en-US",annotation:""},facebook:{url:"",urlCount:false,action:"like",layout:"button_count",width:"",send:"false",faces:"false",colorscheme:"",font:"",lang:"en_US"},twitter:{url:"",urlCount:false,count:"horizontal",hashtags:"",via:"",related:"",lang:"en"},digg:{url:"",urlCount:false,type:"DiggCompact"},delicious:{url:"",urlCount:false,size:"medium"},stumbleupon:{url:"",urlCount:false,layout:"1"},linkedin:{url:"",urlCount:false,counter:""},pinterest:{url:"",media:"",description:"",layout:"horizontal"}}},h={googlePlus:"",facebook:"https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27{url}%27&callback=?",twitter:"http://cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?",digg:"http://services.digg.com/2.0/story.getInfo?links={url}&type=javascript&callback=?",delicious:"http://feeds.delicious.com/v2/json/urlinfo/data?url={url}&callback=?",stumbleupon:"",linkedin:"http://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?",pinterest:"http://api.pinterest.com/v1/urls/count.json?url={url}&callback=?"},k={googlePlus:function(n){var o=n.options.buttons.googlePlus;f(n.element).find(".buttons").append('
');g.___gcfg={lang:n.options.buttons.googlePlus.lang};var m=0;if(typeof gapi==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//apis.google.com/js/plusone.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{gapi.plusone.go()}},facebook:function(n){var o=n.options.buttons.facebook;f(n.element).find(".buttons").append('');var m=0;if(typeof FB==="undefined"&&m==0){m=1;(function(t,q,p){var r,u=t.getElementsByTagName(q)[0];if(t.getElementById(p)){return}r=t.createElement(q);r.id=p;r.src="//connect.facebook.net/"+o.lang+"/all.js#xfbml=1";u.parentNode.insertBefore(r,u)}(d,"script","facebook-jssdk"))}else{FB.XFBML.parse()}},twitter:function(n){var o=n.options.buttons.twitter;f(n.element).find(".buttons").append('');var m=0;if(typeof twttr==="undefined"&&m==0){m=1;(function(){var q=d.createElement("script");q.type="text/javascript";q.async=true;q.src="//platform.twitter.com/widgets.js";var p=d.getElementsByTagName("script")[0];p.parentNode.insertBefore(q,p)})()}else{f.ajax({url:"//platform.twitter.com/widgets.js",dataType:"script",cache:true})}},digg:function(n){var o=n.options.buttons.digg;f(n.element).find(".buttons").append('
');var m=0;if(typeof __DBW==="undefined"&&m==0){m=1;(function(){var q=d.createElement("SCRIPT"),p=d.getElementsByTagName("SCRIPT")[0];q.type="text/javascript";q.async=true;q.src="//widgets.digg.com/buttons.js";p.parentNode.insertBefore(q,p)})()}},delicious:function(p){if(p.options.buttons.delicious.size=="tall"){var o="width:50px;",n="height:35px;width:50px;font-size:15px;line-height:35px;",q="height:18px;line-height:18px;margin-top:3px;"}else{var o="width:93px;",n="float:right;padding:0 3px;height:20px;width:26px;line-height:20px;",q="float:left;height:20px;line-height:20px;"}var m=p.shorterTotal(p.options.count.delicious);if(typeof m==="undefined"){m=0}f(p.element).find(".buttons").append('
'+m+'
Delicious Add
');f(p.element).find(".delicious").on("click",function(){p.openPopup("delicious")})},stumbleupon:function(n){var o=n.options.buttons.stumbleupon;f(n.element).find(".buttons").append('
');var m=0;if(typeof STMBLPN==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.stumbleupon.com/1/widgets.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})();s=g.setTimeout(function(){if(typeof STMBLPN!=="undefined"){STMBLPN.processWidgets();clearInterval(s)}},500)}else{STMBLPN.processWidgets()}},linkedin:function(n){var o=n.options.buttons.linkedin;f(n.element).find(".buttons").append('
');var m=0;if(typeof g.IN==="undefined"&&m==0){m=1;(function(){var p=d.createElement("script");p.type="text/javascript";p.async=true;p.src="//platform.linkedin.com/in.js";var q=d.getElementsByTagName("script")[0];q.parentNode.insertBefore(p,q)})()}else{g.IN.init()}},pinterest:function(m){var n=m.options.buttons.pinterest;f(m.element).find(".buttons").append('');(function(){var o=d.createElement("script");o.type="text/javascript";o.async=true;o.src="//assets.pinterest.com/js/pinit.js";var p=d.getElementsByTagName("script")[0];p.parentNode.insertBefore(o,p)})()}},j={googlePlus:function(){},facebook:function(){fb=g.setInterval(function(){if(typeof FB!=="undefined"){FB.Event.subscribe("edge.create",function(m){ga("send","social","facebook","like",m)});FB.Event.subscribe("edge.remove",function(m){ga("send","social","facebook","unlike",m)});FB.Event.subscribe("message.send",function(m){ga("send","social","facebook","like",m)});clearInterval(fb)}},1000)},twitter:function(){tw=g.setInterval(function(){if(typeof twttr!=="undefined"){twttr.events.bind("tweet",function(m){if(m){ga("send","social","twitter","tweet")}});clearInterval(tw)}},1000)},digg:function(){},delicious:function(){},stumbleupon:function(){},linkedin:function(){function m(){ga("send","social","linkedin","share")}},pinterest:function(){}},b={googlePlus:function(m){g.open("https://plus.google.com/share?hl="+m.buttons.googlePlus.lang+"&url="+encodeURIComponent((m.buttons.googlePlus.url!==""?m.buttons.googlePlus.url:m.url)),"","toolbar=0, status=0, width=900, height=500")},facebook:function(m){g.open("http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent((m.buttons.facebook.url!==""?m.buttons.facebook.url:m.url))+"&t="+m.text+"","","toolbar=0, status=0, width=900, height=500")},twitter:function(m){g.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(m.text)+"&url="+encodeURIComponent((m.buttons.twitter.url!==""?m.buttons.twitter.url:m.url))+(m.buttons.twitter.via!==""?"&via="+m.buttons.twitter.via:"")+(m.buttons.twitter.hashtags!==""?"&hashtags="+encodeURIComponent(m.buttons.twitter.hashtags):""),"","toolbar=0, status=0, width=650, height=360")},digg:function(m){g.open("http://digg.com/tools/diggthis/submit?url="+encodeURIComponent((m.buttons.digg.url!==""?m.buttons.digg.url:m.url))+"&title="+m.text+"&related=true&style=true","","toolbar=0, status=0, width=650, height=360")},delicious:function(m){g.open("http://www.delicious.com/save?v=5&noui&jump=close&url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&title="+m.text,"delicious","toolbar=no,width=550,height=550")},stumbleupon:function(m){g.open("http://www.stumbleupon.com/badge/?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url)),"stumbleupon","toolbar=no,width=550,height=550")},linkedin:function(m){g.open("https://www.linkedin.com/cws/share?url="+encodeURIComponent((m.buttons.delicious.url!==""?m.buttons.delicious.url:m.url))+"&token=&isFramed=true","linkedin","toolbar=no,width=550,height=550")},pinterest:function(m){g.open("http://pinterest.com/pin/create/button/?url="+encodeURIComponent((m.buttons.pinterest.url!==""?m.buttons.pinterest.url:m.url))+"&media="+encodeURIComponent(m.buttons.pinterest.media)+"&description="+m.buttons.pinterest.description,"pinterest","toolbar=no,width=700,height=300")}};function i(m,n){this.element=m;this.options=f.extend(true,{},l,n);this.options.share=n.share;this._defaults=l;this._name=c;this.init()}i.prototype.init=function(){var m=this;if(this.options.urlCurl!==""){h.googlePlus=this.options.urlCurl+"?url={url}&type=googlePlus";h.stumbleupon=this.options.urlCurl+"?url={url}&type=stumbleupon"}f(this.element).addClass(this.options.className);if(typeof f(this.element).data("title")!=="undefined"){this.options.title=f(this.element).attr("data-title")}if(typeof f(this.element).data("url")!=="undefined"){this.options.url=f(this.element).data("url")}if(typeof f(this.element).data("text")!=="undefined"){this.options.text=f(this.element).data("text")}f.each(this.options.share,function(o,n){if(n===true){m.options.shareTotal++}});if(m.options.enableCounter===true){f.each(this.options.share,function(p,o){if(o===true){try{m.getSocialJson(p)}catch(n){}}})}else{if(m.options.template!==""){this.options.render(this,this.options)}else{this.loadButtons()}}f(this.element).hover(function(){if(f(this).find(".buttons").length===0&&m.options.enableHover===true){m.loadButtons()}m.options.hover(m,m.options)},function(){m.options.hide(m,m.options)});f(this.element).click(function(){m.options.click(m,m.options);return false})};i.prototype.loadButtons=function(){var m=this;f(this.element).append('
');f.each(m.options.share,function(o,n){if(n==true){k[o](m);if(m.options.enableTracking===true){j[o]()}}})};i.prototype.getSocialJson=function(p){var o=this,n=0,m=h[p].replace("{url}",encodeURIComponent(this.options.url));if(this.options.buttons[p].urlCount===true&&this.options.buttons[p].url!==""){m=h[p].replace("{url}",this.options.buttons[p].url)}if(m!=""&&o.options.urlCurl!==""){f.getJSON(m,function(q){if(typeof q.count!=="undefined"){var r=q.count+"";r=r.replace("\u00c2\u00a0","");n+=parseInt(r,10)}else{if(q.data&&q.data.length>0&&typeof q.data[0].total_count!=="undefined"){n+=parseInt(q.data[0].total_count,10)}else{if(typeof q[0]!=="undefined"){n+=parseInt(q[0].total_posts,10)}else{if(typeof q[0]!=="undefined"){}}}}o.options.count[p]=n;o.options.total+=n;o.renderer();o.rendererPerso()}).error(function(){o.options.count[p]=0;o.rendererPerso()})}else{o.renderer();o.options.count[p]=0;o.rendererPerso()}};i.prototype.rendererPerso=function(){var m=0;for(e in this.options.count){m++}if(m===this.options.shareTotal){this.options.render(this,this.options)}};i.prototype.renderer=function(){var n=this.options.total,m=this.options.template;if(this.options.shorterTotal===true){n=this.shorterTotal(n)}if(m!==""){m=m.replace("{total}",n);f(this.element).html(m)}else{f(this.element).html('
'+n+""+(this.options.title!==""?'":"")+"
")}};i.prototype.shorterTotal=function(m){if(m>=1000000){m=(m/1000000).toFixed(2)+"M"}else{if(m>=1000){m=(m/1000).toFixed(1)+"k"}}return m};i.prototype.openPopup=function(m){b[m](this.options);if(this.options.enableTracking===true){var n={googlePlus:{site:"Google",action:"+1"},facebook:{site:"facebook",action:"like"},twitter:{site:"twitter",action:"tweet"},digg:{site:"digg",action:"add"},delicious:{site:"delicious",action:"add"},stumbleupon:{site:"stumbleupon",action:"add"},linkedin:{site:"linkedin",action:"share"},pinterest:{site:"pinterest",action:"pin"},tumblr:{site:'tumblr',action:'share'},mail:{site:'mail',action:'share'}};ga("send","social",n[m].site,n[m].action)}};i.prototype.simulateClick=function(){var m=f(this.element).html();f(this.element).html(m.replace(this.options.total,this.options.total+1))};i.prototype.update=function(n,m){if(n!==""){this.options.url=n}if(m!==""){this.options.text=m}};f.fn[c]=function(m){var n=arguments;if(m===a||typeof m==="object"){return this.each(function(){if(!f.data(this,"plugin_"+c)){f.data(this,"plugin_"+c,new i(this,m))}})}else{if(typeof m==="string"&&m[0]!=="_"&&m!=="init"){return this.each(function(){var o=f.data(this,"plugin_"+c);if(o instanceof i&&typeof o[m]==="function"){o[m].apply(o,Array.prototype.slice.call(n,1))}})}}}})(jQuery,window,document);