"use strict";!function(e,s,n){var t="https://g.csdnimg.cn/user-tooltip/2.4/",i={company:"",domainGrey:"",domain:"",vip:"",writer:""},a={getUserProfileUrl:"https://me.csdn.net/api/external/user/getUserProfile",checkFollowUrl:"https://me.csdn.net/api/relation/check",doFollowUrl:"https://me.csdn.net/api/relation/create",doUnfollowUrl:"https://me.csdn.net/api/relation/destroy",ref:"miniprofile",defaultUserProfile:{username:"yanlinpu",avatarurl:"https://profile.csdnimg.cn/1/1/B/1_yanlinpu",vip:!1,expert:!1,nickname:"木林森001",fans_num:"2万",identity:[{name:"专家"},{name:"版主"}],medal:[{type:"203",codename:"111",image:"https://g.csdnimg.cn/static/user-medal/1024huodong.svg"}]}};if(void 0===e.csdn&&(e.csdn={}),!jQuery)return!1;!function(e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,s.getElementsByTagName("head")[0].appendChild(n)}(t+"user-tooltip.css"),e.csdn.userTooltip=function(t){function o(){v[m].flag&&(n("#csdn-userTooltip .person_deliver").mouseover(function(){n(this).hasClass("person_deliver_letter")&&n(this).html("取   消")}),n("#csdn-userTooltip .person_deliver").mouseout(function(){n(this).hasClass("person_deliver_letter")&&n(this).html("已关注")})),n("#csdn-userTooltip .person_deliver").click(function(){var s,t;if(y){var i=n(this);if(0==v[m].flag){if(!i.hasClass("person_deliver_letter_un"))return!1;s=a.doFollowUrl,n.ajax({type:"post",url:s,dataType:"json",xhrFields:{withCredentials:!0},crossDomain:!0,data:JSON.stringify({username:m}),success:function(s){200==parseInt(s.code)&&(i.html("已关注").removeClass("person_deliver_letter_un").addClass("person_deliver_letter"),i.mouseover(function(){i.html("取   消")}),i.mouseout(function(){i.html("已关注")})),e.csdn&&e.csdn.watchBtnChange&&e.csdn.watchBtnChange(1,m),v[m].flag=!0,v[m].followClass="person_deliver person_deliver_letter",v[m].followStr="已关注"}})}else t=a.doUnfollowUrl,n.ajax({type:"post",url:t,xhrFields:{withCredentials:!0},crossDomain:!0,data:JSON.stringify({username:m}),dataType:"json",success:function(s){200==parseInt(s.code)&&(i.html("关注").removeClass("person_deliver_letter").addClass("person_deliver_letter_un"),i.unbind("mouseover"),i.unbind("mouseout")),e.csdn&&e.csdn.watchBtnChange&&e.csdn.watchBtnChange(0,m),v[m].flag=!1,v[m].followClass="person_deliver person_deliver_letter_un",v[m].followStr="关注"}})}else e.location.href="https://passport.csdn.net/"})}function r(e){var s,n=e.offset(),t=n.left,i=n.top,a=e.width(),o=e.height(),r=e[0].getBoundingClientRect(),l={};return r&&Number(r.top,10)<162?(s="left:"+(t-50+a/2)+"px;top:"+(i+o+15)+"px",l.isBottom=!0):(s="left:-999999999px;top:"+(i-165)+"px",l.realPos={left:t-50+a/2,top:i}),l.position=s,l}function l(){n("#csdn-userTooltip").remove()}t&&n.extend(a,t);var c,d,p,m,u,f,h={},v={},g="",_=!1,w='';s.domain="csdn.net";var y=function(e){for(var n=s.cookie.split("; "),t=0;t关注";var w="
"+t+""+v+"码龄"+_+"年
"+d+h+"
";if(n("body").append(w),f.realPos){var y=n("#csdn-userTooltip"),T=y.height(),C=f.realPos.left,x=f.realPos.top-T-35;y.css({left:C,top:x})}}function l(){n("#csdn-userTooltip").length&&n("#csdn-userTooltip").remove(),m=u.attr("username");var s,l,c,d,T,C,x,U,b,k,j,B,P="";if(!(p.closest("#csdn-userTooltip").length<=0))return!1;n("#csdn-userTooltip").remove(),v[m]?(s=v[m].followClass,l=v[m].followStr,c=v[m].avatarurl,d=v[m].nickname,T=v[m].isVip,C=v[m].hasDomain,x=v[m].isBlogWriter,U=v[m].favsCount,b=v[m].interestname,k=v[m].huistr,B=v[m].age,P=r(u),f=T?""+i.vip+"":"",f+=x?""+i.writer+"":"",g=C?"
  • "+i.domain+""+C+".blog.csdn.net
  • ":"
  • "+i.domainGrey+"暂未设置自定义域名
  • ",g="
    "+g+"
    ",y?(s&&l&&(j=""+l+""),y===m&&(j=""),t(c,b,d,T,x,U,s,l,k,void 0,_,P,g,f,j,B),o()):(t(c,b,d,T,x,U,s,l,k,void 0,_,P,g,f,j,B),n("#csdn-userTooltip .person_deliver").click(function(){e.location.href="https://passport.csdn.net/"}))):n.ajax({type:"get",url:a.getUserProfileUrl+"?username="+m,contentType:"application/json",dataType:"json",xhrFields:{withCredentials:!0},crossDomain:!0,success:function(s){var l,c,d,p,m,T,C,x,U,b,k,B,F,D="",N="",S="",V="",I=!1;if(200===Number(s.code,10)){if(l=s.data||a.defaultUserProfile,!(B=l.username))return!1;if(c=l.avatarurl,d=l.nickname||B,F=l.years,p=l.fans_num,m=l.vip,T=l.domain,C=l.expert,x=l.medal?l.medal:[],U=x.length,U>0&&(I=!0),f=m?""+i.vip+"":"",f+=C?""+i.writer+"":"",g=T?"
  • "+i.domain+""+T+".blog.csdn.net
  • ":"
  • "+i.domainGrey+"暂未设置自定义域名
  • ",g="
    "+g+"
    ",I){x.length>99999?(b=99999,k=!0):b=x.length;for(var E=0;E胸章";k&&(S+='
  • '+w+x.length+"
  • "),S="
      "+S+"
    "}else S="
  • 一个勋章都没有...
  • ",S="
      "+S+"
    ";if(null!=l.identity)for(var G=0;G|":V+=l.identity[G].name)}if(y){var L=a.checkFollowUrl+"?follows="+B;n.ajax({type:"get",url:L,xhrFields:{withCredentials:!0},dataType:"json",success:function(e){var s;200===e.code&&e.data&&(0===e.data[B]?(D="person_deliver person_deliver_letter_un",N="关注",_=!1):(D="person_deliver person_deliver_letter",N="已关注",_=!0)),P=r(u),D&&D&&(s=""+N+""),y===B&&(s=""),t(c,V,d,m,C,p,D,N,S,U,_,P,g,f,s,F),h[B]={},h[B].avatarurl=c,h[B].nickname=d,h[B].isVip=m,h[B].hasDomain=T,h[B].isBlogWriter=C,h[B].favsCount=p,h[B].interestname=V,h[B].followClass=D,h[B].followStr=N,h[B].huistr=S,h[B].huicount=U,h[B].flag=_,h[B].age=F,v[B]=h[B],o()}})}else P=r(u),t(c,V,d,m,C,p,D,N,S,U,_,P,g,f,j,F),n("#csdn-userTooltip .person_deliver").click(function(){e.location.href="https://passport.csdn.net/"}),h[B]={},h[B].avatarurl=c,h[B].nickname=d,h[B].isVip=m,h[B].hasDomain=T,h[B].isBlogWriter=C,h[B].favsCount=p,h[B].interestname=V,h[B].huistr=S,h[B].huicount=U,h[B].age=F,v[B]=h[B]}},error:function(e){console.warn(e)}})}var s=s||e.event;return p=n(s.target||s.srcElement),u=n(this),clearTimeout(d),clearTimeout(c),null!=n(this).attr("username")&&(c=setTimeout(l,200)),!1}),n(s).on("mouseleave","img[username]",function(e){return clearTimeout(c),d=setTimeout(l,200),!1}),n(s).on("mouseleave","#csdn-userTooltip",function(e){return clearTimeout(d),l(),!1})}}(window,document,jQuery),$(function(){window.csdn.userTooltip()});