$('main').on("click", ".sharing a", function(e){//t,U,I,T){ e.preventDefault(); var t=$(this),n=t.attr('href'),U=t.data('href')||$('link[rel=canonical]').attr('href')||location.href,I=t.data('img')||$('meta[property$=image]').attr('content'),T=t.data('title')||$('meta[property$=title]').attr('content'),r=window,W=$(r),w=W.width()/2,h=W.height()/2,l; T=T.replace(/\s+/g,' ').trim(); if(n=='#facebook')l=r.open('https://www.facebook.com/sharer.php?'+$.param({u:U}),"Facebook","width=750,height=550,top="+(h-225)+",left="+(w-375)); else if(n=='#pinterest')l=r.open('https://www.pinterest.com/pin/create/button/?'+$.param({h:436,w:626,url:U,media:I,description:T}),"Pin It","width=626,height=436,top="+(h-218)+",left="+(w-313)); //else if(n=='#gplus')l=r.open('https://plus.google.com/share?'+$.param({url:U}),"Google+","width=600,height=600,top="+(h-300)+",left="+(w-300)); else if(n=='#twitter')l=r.open('https://twitter.com/share?'+$.param({url:U,text:T}),"Tweet","width=450,height=550,top="+(h-275)+",left="+(w-225)); //else if(n=='tumblr')l=r.open('http://tumblr.com/share?'+$.param({u:U}),"Tumblr","width=540,height=720,top="+(h-275)+",left="+(w-225)); //else if(n=='stumbleupon')l=r.open('http://www.stumbleupon.com/submit?'+$.param({url:U}),"StumbleUpon","width=500,height=740,top="+(h-275)+",left="+(w-225)); //else if(n=='linkedin')l=r.open('http://www.linkedin.com/shareArticle?'+$.param({url:U,mini:'true'}),"LinkedIn","width=450,height=550,top="+(h-275)+",left="+(w-225)); else if(n=="fbcomments"){ //add Facebook comments var b=t.closest('.blog:has(.fb-comments)'),sP=function(){return b.offset().top+b.height()-500;},sV=sP(); //FaceBook comments $('main .fb-comments').one('load',function(){ var t=$(this).attr('fb-xfbml-state','parse'); if(typeof FB!='undefined'&&FB.I)FB.XFBML.parse(this);else{ $.getScript('https://connect.facebook.net/en_US/sdk.js',function(){ FB.init({version:'v3.1',appId:'1504561889582721',xfbml:1}) FB.I=1; }); } }) $('.fb-comments',b).show().removeClass('lazyload').trigger('load'); $('html, body').animate({scrollTop:sV,step:function(){sV=sP()}},1500,function(){ var sI=setInterval(function(){ var s=sP(); if(!$('[data-src]',b).length&&s<=($('body').scrollTop()+10))clearInterval(sI); $('html, body').scrollTop(s); },200); $(window).one('scroll',function(){clearInterval(sI)}) }); return 0; } })