"use strict";!function(e,s,t){var n,o="https://g.csdnimg.cn/user-tooltip/2.5/",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://mp-action.csdn.net/interact/wrapper/pc/fans/v1/api/follow",doUnfollowUrl:"https://mp-action.csdn.net/interact/wrapper/pc/fans/v1/api/unFollow",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"}]}},l={ask:"ASK",bbs:"BBS",me:"ME",download:"DOWNLOAD",blog_detail:"BLOG_DETAIL",blog:"BLOG",live:"LIVE"};if(void 0===e.csdn&&(e.csdn={}),!jQuery)return!1;!function(e){var t=s.createElement("link");t.rel="stylesheet",t.type="text/css",t.href=e,s.getElementsByTagName("head")[0].appendChild(t)}(o+"user-tooltip.css"),e.csdn.userTooltip=function(o){function r(){_[f].flag&&(t("#csdn-userTooltip .person_deliver").mouseover(function(){t(this).hasClass("person_deliver_letter")&&t(this).html("取   消")}),t("#csdn-userTooltip .person_deliver").mouseout(function(){t(this).hasClass("person_deliver_letter")&&t(this).html("已关注")})),t("#csdn-userTooltip .person_deliver").click(function(){var s,o;if(b){var i=t(this);if(n||(n=e.location.hostname.indexOf("blog.csdn.net")>0?e.location.href.indexOf("/article/details")>=0?l.blog_detail:l.blog:l[e.location.hostname.split(".")[0]]?l[e.location.hostname.split(".")[0]]:"ME"),0==_[f].flag){if(!i.hasClass("person_deliver_letter_un"))return!1;s=a.doFollowUrl,t.ajax({type:"post",url:s,dataType:"json",xhrFields:{withCredentials:!0},contentType:"application/json",crossDomain:!0,data:JSON.stringify({follow:f,source:n,username:b}),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,f),_[f].flag=!0,_[f].followClass="person_deliver person_deliver_letter",_[f].followStr="已关注"}})}else o=a.doUnfollowUrl,t.ajax({type:"post",url:o,xhrFields:{withCredentials:!0},contentType:"application/json",crossDomain:!0,data:JSON.stringify({follow:f,source:n,username:b}),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,f),_[f].flag=!1,_[f].followClass="person_deliver person_deliver_letter_un",_[f].followStr="关注"}})}else e.location.href="https://passport.csdn.net/"})}function c(e){var s,t=e.offset(),n=t.left,o=t.top,i=e.width(),a=e.height(),l=e[0].getBoundingClientRect(),r={};return l&&Number(l.top,10)<162?(s="left:"+(n-50+i/2)+"px;top:"+(o+a+15)+"px",r.isBottom=!0):(s="left:-999999999px;top:"+(o-165)+"px",r.realPos={left:n-50+i/2,top:o}),r.position=s,r}function d(){t("#csdn-userTooltip").remove()}o&&t.extend(a,o);var p,m,u,f,h,v,g={},_={},w="",y=!1,T='';s.domain="csdn.net";var b=function(e){for(var t=s.cookie.split("; "),n=0;n关注";var w="
"+n+""+v+"码龄"+_+"年
"+d+h+"
";if(t("body").append(w),u.realPos){var y=t("#csdn-userTooltip"),T=y.height(),b=u.realPos.left,C=u.realPos.top-T-35;y.css({left:b,top:C})}}function l(){t("#csdn-userTooltip").length&&t("#csdn-userTooltip").remove(),f=h.attr("username");var s,n,l,d,p,m,C,x,U,k,B,j,D="";if(!(u.closest("#csdn-userTooltip").length<=0))return!1;t("#csdn-userTooltip").remove(),_[f]?(s=_[f].followClass,n=_[f].followStr,l=_[f].avatarurl,d=_[f].nickname,p=_[f].isVip,m=_[f].hasDomain,C=_[f].isBlogWriter,x=_[f].favsCount,U=_[f].interestname,k=_[f].huistr,j=_[f].age,D=c(h),v=p?""+i.vip+"":"",v+=C?""+i.writer+"":"",w=m?"
  • "+i.domain+""+m+".blog.csdn.net
  • ":"
  • "+i.domainGrey+"暂未设置自定义域名
  • ",w="
    "+w+"
    ",b?(s&&n&&(B=""+n+""),b===f&&(B=""),o(l,U,d,p,C,x,s,n,k,void 0,y,D,w,v,B,j),r()):(o(l,U,d,p,C,x,s,n,k,void 0,y,D,w,v,B,j),t("#csdn-userTooltip .person_deliver").click(function(){e.location.href="https://passport.csdn.net/"}))):t.ajax({type:"get",url:a.getUserProfileUrl+"?username="+f,contentType:"application/json",dataType:"json",xhrFields:{withCredentials:!0},crossDomain:!0,success:function(s){var n,l,d,p,m,u,f,C,x,U,k,j,F,P="",L="",N="",O="",S=!1;if(200===Number(s.code,10)){if(n=s.data||a.defaultUserProfile,!(j=n.username))return!1;if(l=n.avatarurl,d=n.nickname||j,F=n.years,p=n.fans_num,m=n.vip,u=n.domain,f=n.expert,C=n.medal?n.medal:[],x=C.length,x>0&&(S=!0),v=m?""+i.vip+"":"",v+=f?""+i.writer+"":"",w=u?"
  • "+i.domain+""+u+".blog.csdn.net
  • ":"
  • "+i.domainGrey+"暂未设置自定义域名
  • ",w="
    "+w+"
    ",S){C.length>99999?(U=99999,k=!0):U=C.length;for(var E=0;E胸章";k&&(N+='
  • '+T+C.length+"
  • "),N="
      "+N+"
    "}else N="
  • 一个勋章都没有...
  • ",N="
      "+N+"
    ";if(null!=n.identity)for(var I=0;I|":O+=n.identity[I].name)}if(b){var V=a.checkFollowUrl+"?follows="+j;t.ajax({type:"get",url:V,xhrFields:{withCredentials:!0},dataType:"json",success:function(e){var s;200===e.code&&e.data&&(0===e.data[j]?(P="person_deliver person_deliver_letter_un",L="关注",y=!1):(P="person_deliver person_deliver_letter",L="已关注",y=!0)),D=c(h),P&&P&&(s=""+L+""),b===j&&(s=""),o(l,O,d,m,f,p,P,L,N,x,y,D,w,v,s,F),g[j]={},g[j].avatarurl=l,g[j].nickname=d,g[j].isVip=m,g[j].hasDomain=u,g[j].isBlogWriter=f,g[j].favsCount=p,g[j].interestname=O,g[j].followClass=P,g[j].followStr=L,g[j].huistr=N,g[j].huicount=x,g[j].flag=y,g[j].age=F,_[j]=g[j],r()}})}else D=c(h),o(l,O,d,m,f,p,P,L,N,x,y,D,w,v,B,F),t("#csdn-userTooltip .person_deliver").click(function(){e.location.href="https://passport.csdn.net/"}),g[j]={},g[j].avatarurl=l,g[j].nickname=d,g[j].isVip=m,g[j].hasDomain=u,g[j].isBlogWriter=f,g[j].favsCount=p,g[j].interestname=O,g[j].huistr=N,g[j].huicount=x,g[j].age=F,_[j]=g[j]}},error:function(e){console.warn(e)}})}var s=s||e.event;return u=t(s.target||s.srcElement),h=t(this),clearTimeout(m),clearTimeout(p),null!=t(this).attr("username")&&(p=setTimeout(l,200)),t(this).attr("followtype")&&(n=t(this).attr("followtype")),!1}),t(s).on("mouseleave","img[username]",function(e){return clearTimeout(p),m=setTimeout(d,200),!1}),t(s).on("mouseleave","#csdn-userTooltip",function(e){return clearTimeout(m),d(),!1})}}(window,document,jQuery),$(function(){window.csdn.userTooltip()});