function setCopyBtn(){$(".CopyToClipboard").each(function(){var t=new ZeroClipboard.Client;t.setHandCursor(!0),t.addEventListener("load",function(t){}),t.addEventListener("mouseOver",function(t){var e=t.movie.parentNode.parentNode.parentNode.parentNode.parentNode.nextSibling.innerHTML;e=e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&"),t.setText(e)}),t.addEventListener("complete",function(t,e){alert("代码已经复制到你的剪贴板。")}),t.glue(this,this.parentNode)})}function computePos(){"object"==("undefined"==typeof toolBar?"undefined":_typeof(toolBar))&&(toolBar.setPosX(),toolBar.computePositon())}function getRecommendListUrl(){return null!==getRecommendListUrlArr?getRecommendListUrlArr:(getRecommendListUrlArr=[[],[]],$(".recommend-box div.recommend-item-box").each(function(t,e){if($(e).data("url")){var o=$(e).data("url").toLowerCase().split("://"),n=$(e).data("url").toLowerCase().split("article/details/");getRecommendListUrlArr[0].push(2==o.length?o[1]:o[0]),getRecommendListUrlArr[1].push(2==n.length?"article/details/"+n[1]:n[0])}}),getRecommendListUrlArr)}function baidudatatemp(t,e,o,n){var i="blog",a='博客';t.linkUrl.indexOf("download.csdn.net")>-1?(i="download",a='下载'):t.linkUrl.indexOf("edu.csdn.net")>-1&&(i="edu",a='课程');var s=highlight.map(function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")});10==setBaiduJsCount&&(a=""),s="("+s.join("|")+")";var c=new RegExp(s,"gi"),r=/<[^>]*>/g,l=t["abstract"].replace(r,"").replace(c,"$1"),d=t.dispTime.replace(/^(\d*)-/,""),m=t.linkUrl,p=t.title.replace(r,"").replace(c,"$1"),u=m.split("?")[0].split("/").splice(-1)[0],h='"extra":"{\\"utm_medium\\":\\"distribute.'+baiduSearchChannel+".none-task-"+i+"-2~default~baidujs_"+baiduSearchType+"~default-"+e+"-"+u+"-blog-"+articleId+baiduSearchIdentification+'\\",\\"dist_request_id\\":\\"'+distRequestId+'\\",\\"parent_index\\":\\"'+o+'\\"}",',f='
\t
\t\t
\t\t\t
'+a+'\t\t\t\t \t\t\t\t\t
'+p+'
\t\t\t\t
\t\t\t
'+d+'
";return f}function showDownRecommend(t){if(isGitCodeBlog)return!1;var e=highlight.map(function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")});e="("+e.join("|")+")";var o=new RegExp(e,"gi"),n=/<[^>]*>/g,i=t.linkUrl,a=t.title.replace(n,"").replace(o,"$1"),s='
相关资源:'+a+"
";$("#recommendDown").html(s)}function showResult(t,e){var o=[],n=recommendRegularDomainArr||["blog.csdn.net/.+/article/details/","download.csdn.net/download/","edu.csdn.net/course/detail/"],i=new RegExp(n.join("|"));if(!t||t.length<=0)return!1;if(t&&t.length>0){for(var a=0;a?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、"]/g,"").replace(/\s/g,"").toLowerCase();for(var a=0;a0)for(var c=[],a=0;a?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、"]/g,"").replace(/\s/g,"").toLowerCase();if(2==l.split("article/details/").length){var u=l.split("article/details/")[1];u=u.replace("/",""),d=u,u&&c.indexOf(u)===-1&&(c.push(u),m="article/details/"+u)}$.inArray(l.toLowerCase(),getRecommendListUrl()[0])==-1&&$.inArray(m.toLowerCase(),getRecommendListUrl()[1])==-1&&$.inArray(d,getRecommendListUrl()[1])==-1&&a<10&&p!==articleTitleContent&&articleId!=d&&e!==t[a].linkUrl&&o.push(t[a])}var h=$(".insert-baidu-box").children().not("script").not("dl"),f="",g=0,v=0,w=1;o=o.slice(0,setBaiduJsCount),(!baiduCount||baiduCount<=0)&&(baiduCount=2);for(var a=isBaiduPre?0:baiduCount;a0?2*baiduCount*v:0:2*baiduCount*v+baiduCount,x=$(".insert-baidu-box .recommend-item-box").eq(b),y=0;$(x).children().length&&$(x).find("a.tit").attr("data-report-click")&&(y=JSON.parse($(x).find("a.tit").attr("data-report-click")).index),f+=baidudatatemp(isBaiduPre?o[s]:o[s-baiduCount],isBaiduPre?a+s:s+v*baiduCount,y,w),w+=1}$(h[a]).length&&($(h[a]).after(f),v+=1),f="",g=v*baiduCount}if(g-1&&(e.splice(o,1),this.className=e.join(" ")),this},t.hasClass=function(t){return!!this.className.match(new RegExp("\\s*"+t+"\\s*"))},t},setMoviePath:function(t){this.moviePath=t},dispatch:function(t,e,o){var n=this.clients[t];n&&n.receiveEvent(e,o)},register:function(t,e){this.clients[t]=e},getDOMObjectPosition:function(t,e){for(var o={left:0,top:0,width:t.width?t.width:t.offsetWidth,height:t.height?t.height:t.offsetHeight};t&&t!=e;)o.left+=t.offsetLeft,o.top+=t.offsetTop,t=t.offsetParent;return o},Client:function(t){this.handlers={},this.id=ZeroClipboard.nextId++,this.movieId="ZeroClipboardMovie_"+this.id,ZeroClipboard.register(this.id,this),t&&this.glue(t)}};ZeroClipboard.Client.prototype={id:0,ready:!1,movie:null,clipText:"",handCursorEnabled:!0,cssEffects:!0,handlers:null,glue:function(t,e,o){this.domElement=ZeroClipboard.$(t);var n=99;this.domElement.style.zIndex&&(n=parseInt(this.domElement.style.zIndex,10)+1),"string"==typeof e?e=ZeroClipboard.$(e):"undefined"==typeof e&&(e=document.getElementsByTagName("body")[0]);var i=ZeroClipboard.getDOMObjectPosition(this.domElement,e);this.div=document.createElement("div");var a=this.div.style;if(a.position="absolute",a.left=""+i.left+"px",a.top=""+i.top+"px",a.width=""+i.width+"px",a.height=""+i.height+"px",a.zIndex=n,"object"==("undefined"==typeof o?"undefined":_typeof(o)))for(addedStyle in o)a[addedStyle]=o[addedStyle];e.appendChild(this.div),this.div.innerHTML=this.getHTML(i.width,i.height)},getHTML:function(t,e){var o="",n="id="+this.id+"&width="+t+"&height="+e;if(navigator.userAgent.match(/MSIE/)){var i=location.href.match(/^https/i)?"https://":"http://";o+=''}else o+='';return o},hide:function(){this.div&&(this.div.style.left="-2000px")},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide(),this.div.innerHTML="";var t=document.getElementsByTagName("body")[0];try{t.removeChild(this.div)}catch(e){}this.domElement=null,this.div=null}},reposition:function(t){if(t&&(this.domElement=ZeroClipboard.$(t),this.domElement||this.hide()),this.domElement&&this.div){var e=ZeroClipboard.getDOMObjectPosition(this.domElement),o=this.div.style;o.left=""+e.left+"px",o.top=""+e.top+"px"}},setText:function(t){this.clipText=t,this.ready&&this.movie.setText(t)},addEventListener:function(t,e){t=t.toString().toLowerCase().replace(/^on/,""),this.handlers[t]||(this.handlers[t]=[]),this.handlers[t].push(e)},setHandCursor:function(t){this.handCursorEnabled=t,this.ready&&this.movie.setHandCursor(t)},setCSSEffects:function(t){this.cssEffects=!!t},receiveEvent:function(t,e){switch(t=t.toString().toLowerCase().replace(/^on/,"")){case"load":if(this.movie=document.getElementById(this.movieId),!this.movie){var o=this;return void setTimeout(function(){o.receiveEvent("load",null)},1)}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var o=this;return setTimeout(function(){o.receiveEvent("load",null)},100),void(this.ready=!0)}this.ready=!0,this.movie.setText(this.clipText),this.movie.setHandCursor(this.handCursorEnabled);break;case"mouseover":this.domElement&&this.cssEffects&&(this.domElement.addClass("hover"),this.recoverActive&&this.domElement.addClass("active"));break;case"mouseout":this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")&&(this.domElement.removeClass("active"),this.recoverActive=!0),this.domElement.removeClass("hover"));break;case"mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case"mouseup":this.domElement&&this.cssEffects&&(this.domElement.removeClass("active"),this.recoverActive=!1)}if(this.handlers[t])for(var n=0,i=this.handlers[t].length;n-1?t("body").css({overflow:"auto","margin-left":"0"}):t("body").css({overflow:"auto"}),t(".imgViewDom").fadeOut(300)}e=e?e:"#content_views";var n=t(e+" img:not(.contentImg-no-view)"),i=navigator.userAgent.toLowerCase();if(0===n.length)return!1;for(var a="",s=0;s'}if(0===t(".imgViewDom").length){t("body").append('
'+a+'
');var r=new Swiper(".imgViewDom .swiper",{autoplay:!1,loop:!1,mousewheel:!0,keyboard:{enabled:!0,pageUpDown:!1},navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"}});t(".swiper-wrapper").on("click",function(){o()}),t(".imgViewDom a.close-btn").on("click",function(){o()}),t(document).keyup(function(e){if("none"!==t(".imgViewDom").css("display")){var n=e||event,i=n.which||n.keyCode;27==i&&o()}}),t(".imgViewDom").click(function(e){0===t(".imgViewDom>.swiper").has(e.target).length&&o()})}return r};window.CSDNviewImg=n,window.csdn=window.csdn||{},window.csdn.random_num=e}(jQuery),$(function(){function t(t){if(l&&c){var e=$(window).height(),o=$(document).scrollTop(),i=t.offset().top,a=t.height();io&&(n(t),c=!1)}}function e(t){return'
'+t.title+' '+t.titleRight+' '+t.topCenter+'
'+t.topRightNumber+' '+t.topRight+'
'+t.introTitle+'
'+t.intro+' '+t.buttonText+"
"}function o(o){if(o)var n={authorUserName:username,contentKey:articleTitle,pageSpm:JSON.parse(articleReport).spm,positions:542};else var n={authorUserName:username,contentKey:articleTitle,pageSpm:JSON.parse(articleReport).spm,positions:544};$.ajax({type:"GET",url:"https://kunpeng.csdn.net/ad/json/list",dataType:"json",data:n,xhrFields:{withCredentials:!0},success:function(n){200==n.code&&n.data.length?(l="articleContentAd",o?$("#content_views").append("
"+e(n.data[0])+"
"):$(i[Math.floor(a/2)]).after("
"+e(n.data[0])+"
"),r=n.data[0].exposureUrl,t($("#"+l))):l=""},error:function(t){l=""}})}function n(t){t.append('')}var i=$("#content_views").children(),a=i.length,s=$("#content_views").height(),c=!0,r="",l="";if(4===articleSource&&a>8&&s>300){var d=(null!=(_ref1=/(; )?(uuid_tt_dd|_javaeye_cookie_id_)=([^;]+)/.exec(window.document.cookie))?_ref1[3]:void 0)||"",m=d?d.substring(d.length-6)%16:0;o(m<=7)}$(document).on("scroll",function(){t($("#"+l))}),a>contentViewsCount&&s>contentViewsHeight}),$(function(){function t(t,e,o){clearTimeout(d),document.selection?l=document.selection.createRange().text:window.getSelection()&&(l=window.getSelection()),l=l.toString().replace(/\n/g,"").trim();var a=!0;if(""!=l){(l.length<=2||$.isNumeric(l)||null!==n(l)||null!==i(l))&&(a=!1);var s="//so.csdn.net/so/search?spm=1001.2101.3001.6607&from=pc_blog_select&q="+encodeURIComponent(l.toString()),c='
'+(a?'搜索':"")+' AI提问 评论 笔记
';$("body").append(c),$(document).off("click","#articleSearchTip .article-search"),$(document).on("click","#articleSearchTip .article-search",function(){window.csdn&&window.csdn.report&&window.csdn.report.reportClick({spm:"1001.2101.3001.6607",extra:JSON.stringify({searchword:l.toString()})})}),window.csdn&&window.csdn.report&&window.csdn.report.reportView({spm:"1001.2101.3001.10112",extra:JSON.stringify({searchword:l.toString()})}),$(document).off("click","#articleSearchTip .article-aichat"),$(document).on("click","#articleSearchTip .article-aichat",function(){window.csdn&&window.csdn.report&&window.csdn.report.reportClick({spm:"1001.2101.3001.10112",extra:JSON.stringify({searchword:l.toString()})}),setTimeout(function(){window.chatModelObj.setExtraData({utm_source:"vip_chatgpt_common_blog_pc_detail"}),window.chatModelObj.openChat(!0),l.toString().length>0&&window.chatModelObj.sendMessage(l.toString())},200)}),window.csdn.report&&"function"==typeof window.csdn.report.reportView&&(window.csdn.report.reportView({spm:"1001.2101.3001.6607",extra:JSON.stringify({searchword:l.toString()})}),window.csdn.report.reportView({spm:"1001.2101.3001.6773"})),$("#articleSearchTip").css({top:o.pageY-e-8,left:t})}}function e(t){var e='

'+t.format_path+'

已加入 GitHub加速计划

'+t.description+'
'+t.language+'

'+t.star_count+'

'+t.fork_count+"

"+t.updated_at_format+"更新
";return e}function o(t,o,n){$.ajax({url:"https://web-api.gitcode.com/api/v1/search/nauth/project/card",type:"get",data:{url:t},xhrFields:{crossDomain:!0,withCredentials:!0},success:function(i){200==i.status&&i.data&&!$.isEmptyObject(i.data)?($("body").append(e(i.data)),"none"===$(".git-hub-box").css("display")&&$(".git-hub-box").show(),m=t,$(".git-hub-box").css({top:o+"px",left:n+"px"}),window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportView({spm:"3001.9232"}),$(".git-hub-box").click(function(t){window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({spm:"3001.9232"});var e="https://link.csdn.net?from_id="+articleId+"&target="+encodeURIComponent(i.data.link);window.open(e)}),$("#git-hub-download").click(function(t){window.open(i.data.download_url)}),$(".git-hub-box").mouseleave(function(){$(".git-hub-box").hide(),u=!1}),$(".git-hub-box").mouseenter(function(){u=!0})):m=""},error:function(t){m=""}})}function n(t){var e="(https?|http|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]";return s=t.match(e),s}function i(t){var e=/[Γ∫∞​∀∈∋N∏∑ϕ⎡⎤⇒⇏⟹⇑⇓⇕⨿%†‡…⋯◯△▽⪇≦≰≨≯⋍≂≅≆∮]/g;return s=t.match(e),s}function a(t){var e=$("#commentQuote"),o=$("#pcCommentSideBox"),n=''+t+'';e.length?e.html(n):(o.prepend('
'+n+"
"),$("#commentSideBoxshadow").fadeIn()),$("input.bt-comment-show").trigger("click")}var c=0,r=0,l="",d=null;$("#content_views").mouseup(function(e){$(".article-search-tip").remove();var o=e.pageY-r,n=Math.min(e.pageX,c);return Math.abs(n)<=5&&Math.abs(o)<=5?(clearTimeout(d),!1):(o=o>0?o:0,clearTimeout(d),void(d=setTimeout(function(){t(n,o,e)},1e3)))}).mousedown(function(t){c=t.pageX,r=t.pageY,l="",$(".git-hub-box").hide(),$("#articleSearchTip").remove()});var m="",p=0,u=!1,h=null;$(document).on("mouseenter mouseleave","#article_content a",function(t){if("mouseenter"==t.type){var e=$(this).offset().top+20,n=$(this).offset().left;$(this).offset().top-p>246&&(e=$(this).offset().top-226),clearTimeout(h),$(this).attr("href").indexOf("github.com")==-1&&$(this).attr("href").indexOf("gitcode.com")==-1||(m!==$(this).attr("href")?($(".git-hub-box").length>=1&&$(".git-hub-box").remove(),o($(this).attr("href"),e,n)):($(".git-hub-box").show(),$(".git-hub-box").css({top:e+"px",left:n+"px"})))}else"mouseleave"==t.type&&(h=setTimeout(function(){u||$(".git-hub-box").hide()},300))}),$(window).scroll(function(){p=$(window).scrollTop()}),$(document).on("click",".article-href",function(t){var e=$(this).data("type");if(void 0!==e)switch(e){case"comment":if(getCookie("UserName"))if(l.toString().length){var o=$("#csdn-toolbar").height(),n=$(document).scrollTop();n<52&&(o=2*o),a(l.toString().replace(//g,">")),t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}else $("#articleSearchTip").remove(),showToast({text:"选中内容为空,请重新选中",bottom:"10%",zindex:9e3,speed:500,time:1500});else window.csdn.loginBox.show();break;case"cnote":if(getCookie("UserName"))if(l.toString().length){l=l.toString().replace(//g,">");var i=new Date,s=i.getMonth()+1,c=i.getDate(),r=i.getFullYear()+"年"+s+"月"+c+"日",d={noteTabName:"博客笔记",topicTitle:"博客摘录「 "+articleTitle+"」 "+r,content:articleDetailUrl?"文章来源:"+articleDetailUrl+"
":"",source:{hostname:"blog.csdn.net",url:articleDetailUrl,title:articleTitle,selection:l}};$.ajax({url:"https://note-ccloud.csdn.net/v1/community/content/sendNote",type:"post",contentType:"application/json",dataType:"json",data:JSON.stringify(d),xhrFields:{withCredentials:!0},success:function(t){},error:function(t){}});var m=articleTitle;articleTitle&&articleTitle.length>=80&&(m=articleTitle.slice(0,77)+"..."),blogApiAxios({article_id:"",title:"博客摘录「 "+m+"」"+r,description:"",content:"

"+l+"

\n",type:"original",status:2,read_type:"public",authorized_status:!1,check_original:!1,source:"pc_postedit",not_auto_saved:1,cover_type:1,vote_id:0,scheduled_time:0,is_new:1,tags:"笔记"}),t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}else $("#articleSearchTip").remove(),showToast({text:"选中内容为空,请重新选中",bottom:"10%",zindex:9e3,speed:500,time:1500});else window.csdn.loginBox.show()}}),$(document).on("click",".comment-quote-close",function(t){var e=$("#commentQuote");e.animate({height:0},300,function(){e.remove()})})}),window.apiOpenEditor=function(t){showToast({text:"请稍后再试",bottom:"10%",zindex:9e3,speed:500,time:2e3})},window.chatModelObj=new ChatModel({model:"chatdoc",title:"AI学习助手",keycode:"blog",darkMode:"Black"===skinStatus,simpleMode:!0,width:"65%",features:{sug:!1,roles:!1,tools:!1,collapseBtn:!1,skillTree:!1,modelControl:!1}}),function(){function t(t){o.hasClass("no-login")||($("div.article_content").removeAttr("style"),0==$(".column-mask").length&&$(".hide-article-box").hide(),o.hasClass("fans_read_more")&&($("#btnAttent").hasClass("attented")||t.originalEvent&&($(".tool-attend").trigger("click"),window.csdn.report.reportClick({mod:"popu_376",spm:"1001.2101.3001.4248",extend1:"粉丝登录阅读更多"}))))}function e(e,o){var n=($(window).height(),$("div.article_content")),i=n.height();$("#btn-readmore").attr("height",o),i>2e3?(n.css({height:"2000px",overflow:"hidden"}),e.click(t)):e.parent().hide()}0!=$(".btn-readmore").length&&$("#content_views").find("pre").each(function(t,e){e=$(e),e.addClass("set-code-show")});var o=$(".btn-readmore");$(".vipmaskclassname").length<=0&&(o.length>0||$(".vip-mask").length>0?currentUserName?e(o,3):e(o,2):0==$(".column-mask").length&&$(".hide-article-box").addClass("hide-article-style"));var n=window.location.hash,i=RegExp(/\#/);n.match(i)&&($(".btn-readmore").parent().hide(),$("div.article_content").removeAttr("style")),window.csdn=window.csdn?window.csdn:{},window.csdn.clearReadMoreBtn=t}(),$(function(){function t(){var t=$(".recommend-ask-box").find("a.btn-link-toask").data("href");t=t?t:$(".recommend-ask-box").find(".btn-gochat").data("href");var e=$(".recommend-ask-box").find("#txtChat").val();e=e&&e.length?e.trim():$(".recommend-ask-box").find("a.btn-link-toask").data("defaultvalue"),e=e?e:$(".recommend-ask-box").find("#txtChat").data("defaultvalue");var o=document.createElement("a");o.style.display="none",o.href=t+"&query="+encodeURIComponent(e),o.target="_blank",document.body.appendChild(o),o.click(),document.body.removeChild(o)}$(".recommend-ask-box").find("#txtChat").on("keyup",function(e){var o=e.which||e.keyCode;13===o&&t()}),$(".recommend-ask-box").find(".btn-gochat").on("click",function(){t()}),$(".recommend-ask-box").find(".btn-link-toask").on("click",function(){t()})}),$(function(){function t(t){t.list&&t.list.length&&($.each(t.list,function(t,e){var o="",n="";articleId==e.articleId&&(o="active"),e.preView&&(n='试读'),i.columnlistStr+='"}),t.total-t.page*t.size>0?(i.columnPage+=1,i.columnlistStr+='

查看更多

'):i.columnlistStr+='

暂无更多内容

',$(document).find(i.columnlistHeight).append(i.columnlistStr),i.columnlistStr="")}function e(t,e,o,n){$.ajax({type:"GET",url:blogUrl+t,dataType:"json",xhrFields:{withCredentials:!0},data:e,success:function(t){200==t.code&&o(t.data)},error:function(t){}})}function o(t,e){if(getCookie("UserName")){var o=blogUrl+"phoenix/web/v1/subscribe/subscribe";$.ajax({url:o,type:"post",dataType:"json",data:t,xhrFields:{withCredentials:!0},success:function(t){200===t.code&&(t.data.status&&showToast({text:t.data.msg,bottom:"10%",zindex:9003,speed:500,time:1500}),e.removeClass("articleColumnFreeBt").html("已订阅"))}})}else window.csdn.loginBox.show({spm:"1001.2101.3001.8607"})}function n(t,e,o){if($(document).find(t).length){var n=$(document).find(t).outerHeight(!0),i=$(document).find(e).outerHeight(!0),a=$(document).find(o).outerHeight(!0);$(document).find(o).css({height:n-i+a})}}var i={columnlistBox:"#columnlistBox",columnlistClose:".columnlist-close",columnlistContent:".columnlist-content-box",columnlistHeight:".columnlist-list-box",columnlistShow:$(".bt-columnlist-show"),columnlistShadow:$(".directory-boxshadow"),columnlistItem:$(".column-group"),columnlistUrl:"phoenix/web/v1/column/article-list",columnId:"",columnPage:1,columnlistStr:""};i.columnlistItem.on("click",function(t){$(this).children().length>1&&!$(t.target).is(".item-target")&&($(this).hasClass("open")?($(this).removeClass("open"),$(this).find(".dec").show()):($(this).addClass("open"),$(this).find(".dec").hide()))});var a="";studyLearnWord&&(a=''+studyLearnWord+""),i.columnlistShow.on("click",function(o){i.columnId=$(this).data("id");var s="",c="",r="",l="",d="",m="";isOwner||($(this).data("free")?s=$(this).data("subscribe")?'已订阅':'订阅专栏':($(this).data("join")?$(this).data("studyvip")?$(this).data("subscribe")?s='已订阅 8折续费 '+a+"":(s=' 会员已订阅 ', s+=' 会员免费订 ',s+=$(this).data("studysubscribe")?'8折续费 '+a+"":'8折续费 '+a+""):s=$(this).data("subscribe")?'已订阅 超级会员免费看 '+a+" ":'订阅专栏 超级会员免费看 '+a+" ":s=$(this).data("subscribe")?'已订阅':'订阅专栏',c='
¥'+$(this).data("price")+"
")),$(this).data("free")||$(this).data("status")||$(this).data("subscribe")||(s='

已下架不支持订阅

',c=""),l='
'+$(this).data("sum")+" 篇文章 "+$(this).data("people")+" 订阅
",d='
作者:'+nickName+"
"+c+'
",m='
专栏目录
',r='
'+l+d+m+'
',$("body").append(r),i.columnlistShadow.fadeIn(function(){$("html,body").addClass("forbidden-htmlbody-scroll"),$(document).find(i.columnlistBox).addClass("open"),n(i.columnlistBox,i.columnlistContent,i.columnlistHeight)}),e(i.columnlistUrl,{columnId:i.columnId,page:i.columnPage},t,i.columnlistBox);var p=o||window.event;p.stopPropagation?p.stopPropagation():p.cancelBubble=!0}),i.columnlistShadow.click(function(){$(i.columnlistClose).trigger("click")}),$(document).on("click",i.columnlistClose,function(){$(document).find(i.columnlistBox).removeClass("open"),i.columnlistShadow.fadeOut(function(){$("html,body").removeClass("forbidden-htmlbody-scroll"),$(document).find(i.columnlistBox).remove(),i.columnPage=1,i.columnId="",i.columnlistStr=""})}),$(document).on("click","#columnlistBox .look-more-article",function(o){if($(this).hasClass("active")){$(this).fadeOut(function(){$(this).remove()}),e(i.columnlistUrl,{columnId:i.columnId,page:i.columnPage},t,i.columnlistBox);var n=o||window.event;n.stopPropagation?n.stopPropagation():n.cancelBubble=!0}}),$(document).on("click",".articleColumnFreeBt",function(t){var e=$(this).data("id");o({columnId:e},$(this));var n=t||window.event;n.stopPropagation?n.stopPropagation():n.cancelBubble=!0}),$(window).resize(function(){n(i.columnlistBox,i.columnlistContent,i.columnlistHeight)})}),$(function(){function t(){var t="",e="",o="",n="",i="",a="",r="";isOwner||(s.columnInfoDom.data("free")?t=s.columnInfoDom.data("subscribe")?'已订阅':'订阅专栏':s.columnInfoDom.data("join")?s.columnInfoDom.data("studyvip")?s.columnInfoDom.data("subscribe")?t='已订阅 8折续费 '+c+"":(t=' 会员已订阅 ',t+=' 会员免费订 ',t+=s.columnInfoDom.data("studysubscribe")?'8折续费 '+c+"":'8折续费 '+c+""):t=s.columnInfoDom.data("subscribe")?'已订阅 超级会员免费看 '+c+" ":'订阅专栏 超级会员免费看 '+c+" ":t=s.columnInfoDom.data("subscribe")?'已订阅':'订阅专栏');var l=s.columnInfoDom.data("hotrank");l&&0!==l&&(e='该专栏为热销专栏榜 第'+l+"名");var d=s.columnInfoDom.data("description").toString();d&&d.length>0&&(o='
'+d+"
"),s.columnInfoDom.data("free")||s.columnInfoDom.data("status")||s.columnInfoDom.data("subscribe")||(t='

已下架不支持订阅

'),i='
'+s.columnInfoDom.data("sum")+" 篇文章 "+s.columnInfoDom.data("people")+" 订阅
",a='
'+e+o+'
'+t+"
",r='
专栏目录
',n='
'+i+a+r+"
",s.asideColumnInfoDom.append(n)}function e(t){t.list&&t.list.length&&($.each(t.list,function(t,e){var o="",n="";articleId==e.articleId&&(o="active"),e.preView&&(n='试读'),s.columnlistStr+='"}),t.total-t.page*t.size>0?(s.columnPage+=1,s.columnlistStr+='

查看更多

'):s.columnlistStr+='

暂无更多内容

',s.asideColumnInfoDom.find(s.columnlistHeight).append(s.columnlistStr),s.columnlistStr="")}function o(){t(),n(s.columnlistUrl,{columnId:s.columnInfoDom.data("id"),page:s.columnPage},e),$(document).on("click",".column-info-container .look-more-article",function(t){if($(this).hasClass("active")){$(this).fadeOut(function(){$(this).remove()}),n(s.columnlistUrl,{columnId:s.columnInfoDom.data("id"),page:s.columnPage},e);var o=t||window.event;o.stopPropagation?o.stopPropagation():o.cancelBubble=!0}}),$("#recommend-right").prepend(s.asideColumnInfoDom),i(s.asideColumnInfoDom,s.columnlistContent,s.columnlistHeight)}function n(t,e,o){$.ajax({type:"GET",url:blogUrl+t,dataType:"json",xhrFields:{withCredentials:!0},data:e,success:function(t){200==t.code&&o(t.data)},error:function(t){}})}function i(t,e,o){if(t.length){var n=t.outerHeight(!0),i=$(t).find(e).outerHeight(!0),a=$(t).find(o).outerHeight(!0);$(t).find(o).css({height:n-i+a})}}function a(t){for(var e=document.cookie.split("; "),o=0;o'),columnlistHeight:".columnlist-list-box",columnlistContent:".columnlist-content-box",columnlistUrl:"phoenix/web/v1/column/article-list",columnInfoDom:$(".bt-columnlist-show"),columnPage:1,columnlistStr:""},c="";studyLearnWord&&(c=''+studyLearnWord+""),window.csdn?window.csdn:window.csdn={},window.csdn.loadRightColumn=function(){$.ajax({type:"GET",url:blogUrl+"/phoenix/web/v1/ab",dataType:"json",xhrFields:{withCredentials:!0},data:{id:380,key:a("uuid_tt_dd")},success:function(t){if(200==t.code&&"control"!==t.data){var e=$("#recommend-right").children();e.each(function(t,e){$(e).hasClass("kind_person")||"asideArchive"!==!$(e).attr("id")||$(e).remove()}),o()}else window.csdn.report&&"function"==typeof window.csdn.report.reportView&&window.csdn.report.reportView({spm:"3001.10139"})},error:function(t){}})}}),$(function(){function t(){this.rewardSettingJson=null,this.rewardInfo={name:"",sendAmount:"",money:""},this.minSendAmount=10,this.minMoney=5,this.availableAmount=0,this.presetTitle=[],this.currentRedEnvolope=null,this.hasShowGuideBottom=getCookie("hasShowRRGuideBottom"),this.hasShowGuideSide=getCookie("hasShowRRGuideSide"),this.redEnvolope=$("#redEnvolope"),this.formRewardBox=$(".comment-reward-box"),this.dialogRewardModal=$(".comment-rewarddialog-box"),this.commentRewardForm=this.dialogRewardModal.find("#commentRewardForm"),this.txtName=this.commentRewardForm.find("#txtName"),this.txtSendAmount=this.commentRewardForm.find("#txtSendAmount"),this.txtMoney=this.commentRewardForm.find("#txtMoney"),this.getSetting()}function e(){this.commentForm=$("#commentform"),this.txtComment=$("#comment_content"),this.commentCountObj=this.commentForm.find("em"),this.commtCode=$("#commentCode"),this.domLi="",this.btnShowMore=$("#btnMoreComment"),this.commentBox=$("div.comment-list-box"),this.commentBoxDefault=$("div.has-comment-con"),this.commentPagination=$("#commentPage"),this.commentLineBox="",this.commentTxt=$("#comment_replyId"),this.cancelBtn=this.commentForm.find(".btn-cancel"),this.articleId=$("article_id"),this.curH=0,this.pageCount=0,this.pageIndex=1,this.curFloor=1,this.commentCount=0,this.commentPageObj=null,this.commentFontLimit=1e3,this.firstLoad=!0,this.pageSize=10,this.showAll=!1,this.commentFold={pageSize:10,pageIndex:1,pageCount:0,total:0,fold:"fold"},this.lookBadComment=$("#lookBadComment"),this.lookUnFlodComment=$("#lookUnFlodComment"),this.commentUnFold={pageSize:10,pageIndex:1,pageCount:0,total:0,fold:"unfold"},this.lookFlodComment=$("#lookFlodComment"),this.lookGoodComment=$("#lookGoodComment"),this.isCommentFold=!1,this.initHotComment=!0,this.bindBtnFoldMore(),this.commentFoldTextareaStr(),this.initTxt(),this.init(),this.bindBtn(),this.bindTxt(),this.commentCode(),this.comment(),this.lookMoreComment(),this.lookMoreFlodComment(),this.gosideComment(),this.commentSideTitClose(),this.cancelBtnBindEvent(),this.getPagination=function(t){var e=t,o=function(o,n){o&&(o.list&&0==o.list.length&&t-1>=1&&(e=t-1,n.commentPageObj.go(e),1==e&&$("#commentPage").hide()),n.pageCount=o.pageCount,n.commentCount=o.floorCount,n.commentPageObj.render({count:o.floorCount,current:e}),n.renderData(o.list))};this.getData(e,o)},this.bindLikedClick(),this.bindRedRewardClick()}function o(t){username===t.userName?window.isBloger='作者':window.isBloger=""}function n(){$("pre.code2").each(function(t,e){hljs.highlightBlock(e),hljs.getLines(e.innerHTML).length>1?hljs.lineNumbersBlock(e):hljs.lineNumbersBlock(e,{singleLine:!0}),$(e).removeClass("code2")})}function i(){$(document).on("click",".comment-reward-item",function(t){if(!getCookie("UserName"))return window.csdn.loginBox.show(),!1;var e=$(this).data("id");w.showRedEnvolope(e)})}function a(){$(document).on("click",".comment-like",function(t){if(!getCookie("UserName"))return window.csdn.loginBox.show(),!1;var e=$(this).hasClass("liked")?"undigg":"digg",o=$(this).data("commentid"),n=this,i={articleId:articleId,commentId:o};$.ajax({url:blogUrl+"phoenix/web/v1/comment/"+e,type:"post",dataType:"json",data:i,xhrFields:{withCredentials:!0},success:function(t){var e=$(n).find("span").text()?parseInt($(n).find("span").text()):0;if($(n).hasClass("liked")){var o=e-1;o=o>0?o:"",$(n).removeClass("liked"),$(n).find(".unclickImg").css("display","inline-block"),$(n).find(".clickedImg").css("display","none"),$(n).find("span").text(o).css("color","#999AAA"),window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({spm:"1001.2101.3001.6253",extend1:'{"praise":0}'})}else $(n).addClass("liked"),$(n).find(".unclickImg").css("display","none"),$(n).find(".clickedImg").css("display","inline-block"),$(n).find("span").text(e+1).css("color","#FC5531"),window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({spm:"1001.2101.3001.6253",extend1:'{"praise":1}'});$(n).parents(".right-box").children(".comment-like").html($(n).html()),$(".comment-like-img-hover").css("display","none")}})})}function s(t){var e="";return 0==t.length?"":(e=t.replace(//g,">"))}function c(){for(var t="",e=1;e<=72;e++){var o="";o=e<10?"00"+e:e>=10&&e<100?"0"+e:e,t+=''}return t}function r(t){var e=window.location.href.split(t)[1];return null!=e?e:""}var l="https://liveapi.csdn.net/";t.prototype.bindInit=function(){var t=this;this.rewardInfo.money=this.rewardSettingJson["default"].variables.DEFAULT_AMOUNT,this.rewardInfo.sendAmount=this.rewardSettingJson["default"].variables.DEFAULT_NUM;var e=$(".guide-rr-first");e.remove();var o=$(".rr-guide-box");o.remove();var n=function(e,o){var n=e.parents(".ipt-box"),i=n.find(".notice"),a=e.val().trim();if(0===a.length)"sendAmount"===o?i.text("请输入红包数量"):"money"===o&&i.text("红包金额最低"+t.minMoney+"元"),n.addClass("error");else{var s=!0;"sendAmount"===o?parseInt(a)"),s=!1):parseFloat(a)>parseFloat(t.availableAmount)?(t.commentRewardForm.find(".balance-info-box").addClass("error"),t.commentRewardForm.find(".link-charge").text("余额不足请充值")):(t.commentRewardForm.find(".balance-info-box").removeClass("error"),t.commentRewardForm.find(".link-charge").text("前往充值 >"))),s?n.removeClass("error"):n.addClass("error");var c=t.txtSendAmount.parents(".ipt-box"),r=t.txtSendAmount.val(),l=t.txtMoney.val();if(r&&parseFloat(l)>=5&&parseFloat(.1*r).toFixed(2)>parseFloat(l)){var d=Math.floor(parseFloat(l)/.1);c.find(".notice").text("红包个数范围为"+t.minSendAmount+"-"+d+"个"),c.addClass("error")}else parseInt(r)>10&&c.removeClass("error")}},i=function(t,e,o){var n=t.indexOf(e),i="";return n===-1?t:"-"===e&&0!==n?t.slice(0,n):("."===e&&t.match(/^(\.|-\.)/)&&(i=n?"-0":"0"),i+t.slice(0,n+1)+t.substr(n+1,2).replace(o,""))},a=function(t,e){t=e?i(t,".",/\./g):t.split(".")[0];var o=e?/[^-0-9.]/g:/[^-0-9]/g;return t.replace(o,"")},s=function(){var e=t.txtName.val(),o=t.txtSendAmount.val(),n=t.txtMoney.val();""!==e&&""!==o&&""!==n&&0===t.commentRewardForm.find(".ipt-box.error,.balance-info-box.error").length?(t.commentRewardForm.find(".btn-submit").removeAttr("disabled"),t.commentRewardForm.find(".pay-info").find(".price").text(parseFloat(n).toFixed(2)),t.commentRewardForm.find(".pay-info").show()):(t.commentRewardForm.find(".btn-submit").attr("disabled",!0),t.commentRewardForm.find(".pay-info").hide())};this.txtName.val(this.rewardInfo.name),this.commentRewardForm.find(".btn-random").click(function(){t.randomTitle()}),this.dialogRewardModal.find("a.btn-form-close").click(function(){t.hideRewardForm()}),this.commentRewardForm.find("input:text").keyup(function(){var t=$(this).attr("name");"sendAmount"===t?$(this).val(a($(this).val(),!1)):"money"===t&&$(this).val(a($(this).val(),!0)),n($(this),t),s()}),this.commentRewardForm.find("input:text").blur(function(){var t=$(this).attr("name");n($(this),t),s()}),this.formRewardBox.find(".btn-remove-reward").click(function(){t.formRewardBox.hide(),t.rewardInfo={name:"",sendAmount:"",money:""},t.txtName.val(t.rewardSettingJson["default"].defaultTitle),t.txtSendAmount.val(""),t.txtMoney.val(""),t.commentRewardForm.find(".error").removeClass("error")}),this.commentRewardForm.find(".btn-submit").click(function(){t.rewardInfo.name=t.txtName.val(),t.rewardInfo.sendAmount=t.txtSendAmount.val(),t.rewardInfo.money=t.txtMoney.val(),t.formRewardBox.find(".info").text(t.rewardInfo.name);var e=new Number(t.rewardInfo.money).toFixed(2);t.formRewardBox.find(".price").text(e+"元"),t.formRewardBox.show(),t.dialogRewardModal.hide()}),this.commentRewardForm.find(".btn-cancel").click(function(){t.hideRewardForm()})},t.prototype.getSetting=function(){var t=this;$.get("https://img-home.csdnimg.cn/data_json/jsconfig/redPacket.json",function(e){t.rewardSettingJson=e,t.rewardInfo.name=e["default"].defaultTitle,t.presetTitle=e["default"].presetTitle,t.bindInit(),t.formRewardBox.css(e["default"].redCardSty),t.redEnvolope.find(".top").css(e["default"].preOpenSty),t.redEnvolope.find(".red-openbtn").css(e["default"].preOpenBtnSty),t.redEnvolope.find("footer").css(e["default"].preFooterSty),t.redEnvolope.find("a.rule").attr("href",e.blog.ruleUrl)})},t.prototype.getRedPacketVerifyBatch=function(){var t=$(".comment-reward-item[data-uncheck='1']");if(t.length>0){for(var e=[],o=0;o0)for(var o=0;o .tt").text(c),s.find(".author > .tt").data("creatorUserName",i.creatorUserName);var r='红包规则',l="";switch(e.redPacketStatus){case"received":l='
'+e.currentUserReceivedInfo.receivedMoney+'
已放入你的CSDN钱包, 点击查看
已领取'+i.receivedAmount+"/"+i.totalAmount+"个,共"+i.receivedMoney+"/"+i.totalMoney+"元
"+r;break;case"completed":l='
'+i.totalAmount+"个红包,"+i.completeTimeInterval+"被抢光
"+r;break;case"expired":l='
该红包已过期,已领取'+i.receivedAmount+"/"+i.totalAmount+"个,共"+i.receivedMoney+"/"+i.totalMoney+"元
"+r}s.find(".receive-box header").html(l);var d=function(t){return t=t<10?"0"+t:t},m=function(t){var e=new Date(t);return d(e.getMonth()+1)+"-"+d(e.getDate())+" "+d(e.getHours())+":"+d(e.getMinutes())};if(e.receivedInfos&&e.receivedInfos.length>0){for(var p="",u=0;u';p+='
'+h.receivedMoney+"元"+f+"
"}s.find(".receive-box .receive-list").html(p)}o()},t.prototype.receiveRedPacket=function(t){var e=this.redEnvolope.find("#preOpen"),o=this.redEnvolope.find("#opened"),n=this;e.find(".red-openbtn").addClass("rotate-start"),$.ajax({type:"POST",url:l+"mp/live-gift/v1.0/redPacket/receiveRedPacket",contentType:"application/json; charset=utf-8",headers:{requestID:(new Date).getTime(),xappid:"pc_blog",xdeviceid:"pc_blog"},data:JSON.stringify({orderNo:t,username:currentUserName}),xhrFields:{withCredentials:!0},success:function(i){if(500===i.code)showToast({text:i.message,bottom:"10%",zindex:9e3,speed:500,time:2e3}),e.find(".red-openbtn").removeClass("rotate-start");else{200!==i.code&&i.message&&(400108103===i.code?showToast({html:i.message+"更多红包",bottom:"10%",zindex:9e3,speed:500,time:2e3}):showToast({text:i.message,bottom:"10%",zindex:9e3,speed:500,time:2e3}));var a=o.find(".author > .tt").data("creatorUserName");username!==currentUserName&&a!==username&&($("#btnAttent").hasClass("attented")||(window.followByRR=!0,$("#btnAttent").trigger("click"))),n.getReceiveList(t,function(){setTimeout(function(){e.find(".red-openbtn").addClass("red-hidebtn"),e.find(".top").addClass("slide-top"),e.find("footer").addClass("slide-bottom"),setTimeout(function(){e.css("display","none"),o.css("display","flex"),e.find(".top").removeClass("slide-top"),e.find("footer").removeClass("slide-bottom"),e.find(".red-openbtn").removeClass("rotate-start").removeClass("red-hidebtn")},800)},800)})}},error:function(){showToast({text:"请求失败,请重试",bottom:"10%",zindex:9e3,speed:500,time:2e3})}})},t.prototype.showRedEnvolope=function(t){var e=this;this.getReceiveList(t,function(){"received"!==e.currentRedEnvolope.redPacketStatus&&"expired"!==e.currentRedEnvolope.redPacketStatus&&"completed"!==e.currentRedEnvolope.redPacketStatus||(e.redEnvolope.find("#preOpen").hide(),e.redEnvolope.find("#opened").css("display","flex")),e.redEnvolope.show(),e.redEnvolope.find(".close-btn").one("click",function(){e.redEnvolope.hide(),e.redEnvolope.find("#preOpen").removeAttr("style"),e.redEnvolope.find("#opened").removeAttr("style")})})};'
  • '+username+'
    '+nickName+':这篇文章对你有帮助吗?作为一名程序工程师,在评论区留下你的困惑或你的见解,大家一起来交流吧!
','';e.prototype.lookMoreComment=function(){var t=this;$(document).on("click","#lookGoodComment",function(e){t.getPagination(t.commentUnFold.pageIndex)})},e.prototype.lookMoreFlodComment=function(){var t=this;$(document).on("click","#lookBadComment",function(e){t.getFoldList(t.commentFold)})},e.prototype.gosideComment=function(){$(document).on("click",".go-side-comment",function(){getCookie("UserName")?($("#commentSideBoxshadow").fadeIn(),$(this).hasClass("focus")&&$("#comment_content").focus()):window.csdn.loginBox.show()})},e.prototype.commentSideTitClose=function(){var t=this;$(document).on("click",".comment-side-tit-close",function(e){e.target.className.indexOf("comment-side-tit-close")>-1&&($("#commentSideBoxshadow").fadeOut(function(){t.isCommentFold&&(t.isCommentFold=!1,t.commentUnFold.pageIndex=1,t.getPagination(t.commentUnFold.pageIndex),$("#pcFlodCommentSideBox").hide(),$("#pcCommentSideBox").show(),$("#pcFlodCommentSideBox .comment-fold-content").html(""))}),$("#commentQuote").remove())}),$(document).keyup(function(t){var e=t.which,o=$("#commentSideBoxshadow");27==e&&"block"==o.css("display")&&($(t.target).is("#comment_content")||o.trigger("click"))})},e.prototype.getData=function(t,e){if(!getCookie("UserName"))return!1;var o=this;o.pageIndex=void 0!==t?t:o.pageIndex;var n=null,i="&commentId="+u;o.pageIndex>1&&(i=""),$.ajax({url:blogUrl+"phoenix/web/v1/comment/list/"+articleId+"?page="+o.pageIndex+"&size="+o.pageSize+"&fold=unfold"+i,type:"post",xhrFields:{withCredentials:!0},success:function(t){200===t.code&&(n=t.data, n&&(o.curFloor=n.floorCount-(o.pageIndex-1)*o.pageSize,o.commentUnFold.pageIndex+=1,o.commentUnFold.pageCount=n.pageCount,o.commentUnFold.total=n.floorCount,o.commentFold.total=n.foldCount,o.commentUnFold.pageIndex>o.commentUnFold.pageCount?(o.lookGoodComment.hide(),o.commentFold.total>0?o.lookFlodComment.show():o.lookFlodComment.hide()):(o.lookGoodComment.show(),o.lookFlodComment.hide()),$(".tool-item-comment .count").html(n.count),$(".comment-side-tit-count .count").html(n.count),$(".has-comment-tit .count").html(n.count),$(".has-comment-bt-left .count").html(n.count),$(".look-flod-comment .count").html(o.commentFold.total),$(".comment-fold-tit .count").html(o.commentFold.total),o.commentFold.total>0||o.lookFlodComment.hide(),n.count>0?(getCookie("UserName")||$("#pcCommentBox .unlogin-comment-tit").text(n.count+" 条评论"),this.firstLoad&&($("#pcCommentBox").removeClass("comment-box-nostyle"),$("#pcCommentBox .has-comment").css({display:"block"}))):getCookie("UserName")?($("#pcCommentBox").addClass("comment-box-nostyle"),$("#pcCommentBox .has-comment").css({display:"none"})):($("#pcCommentBox .unlogin-comment-tit").text("参与评论"),$("#pcCommentBox").removeClass("comment-box-nostyle"),$("#pcCommentBox .has-comment").css({display:"none"}))))},complete:function(){e&&e(n,o)}})},e.prototype.init=function(){window.localStorage.getItem("AM_comment_data")&&window.localStorage.getItem("AM_comment_id")==articleId&&(this.txtComment[0].focus(),this.txtComment.val(window.localStorage.getItem("AM_comment_data")),this.commentTxt.val(window.localStorage.getItem("AM_comment_replyId")),$(window).scrollTop(this.txtComment.offset().top));var t=function(t,e){if(null!==t){var o="";if(getCookie("UserName")||(o="登录 "),e.pageCount=t.pageCount,e.curFloor=t.floorCount,e.commentCount=t.floorCount,e.btnShowMore.html(""+o+"查看 "+t.count+' 条热评'),e.renderData(t.list),getCookie("UserName")?(e.btnShowMore.parent("div.opt-box").remove(),e.showAll=!0,t.floorCount<=e.pageSize?e.commentPagination.addClass("d-none"):0===$("#btnMoreComment").length&&e.commentPagination.removeClass("d-none")):t.floorCount<=3?(e.btnShowMore.parent("div.opt-box").remove(),e.showAll=!0):t.floorCount<=e.pageSize?e.commentPagination.addClass("d-none"):0===$("#btnMoreComment").length&&e.commentPagination.removeClass("d-none"),null===e.commentPageObj?t.pageCount>0&&(e.commentPageObj=new Paging,e.commentPageObj.init({target:e.commentPagination,pagesize:e.pageSize,count:e.commentCount,current:1,firstTpl:"",lastTpl:"",callback:function(t,o,n){e.getPagination(t)}})):e.commentPageObj.render({count:e.commentCount}),""!==u){var n=$("div.has-comment-con ul.comment-list:first-child").find("li.comment-line-box");$(n).each(function(t,e){if(u==$(e).data("commentid")){var o=$(document).scrollTop(),i=$("#csdn-toolbar").height(),a=16;o<52&&(i=2*i);var s=$(n)[t].offsetTop-i-a;return setTimeout(function(){$("html,body").animate({scrollTop:s},200)},850),!1}})}}else e.btnShowMore.parent("div.opt-box").remove(),e.showAll=!0};this.firstLoad?this.getData(1,t):blogMoveHomeArticle&&this.btnShowMore.parent("div.opt-box").remove()},e.prototype.initTxt=function(){var t=this;$("#comment_content").length&&$("#comment_content").focus(function(){t.addId(t);var e=t.commentFontLimit-parseInt($(this).val().length);t.commentCountObj.text(e>=0?e:0),t.cancelBtnToggle(!1),t.commentLineBox.length>0&&($("#commentEditBox").siblings(".comment-list-item").find("a.btn-reply").html("回复"),t.commentLineBox.find(".comment-edit-box").remove())}),getCookie("UserName")&&($(document).click(function(e){if(!$(e.target).is("div.comment-edit-box *")&&!$(e.target).is(".right_recommend_comment_button *")&&!$(e.target).is(".reply")&&($(".comment-operate-isshow").hide(),t.txtComment.length>0)){var o=t.commentFontLimit-t.txtComment.val().length;t.commentCountObj.text(o>=0?o:0)}}),$(document).click(function(t){$(t.target).is(".comment-line-box *")||($("#commentEditBox").siblings(".comment-list-item").find("a.btn-reply").html("回复"),$("#commentEditBox").remove())})),$("input.btn-comment-defualt").click(function(){$(".tool-item-comment").trigger("click")}),$(".tool-item-comment").click(function(){if(3===commentAuth){var t='\n
\n \n
\n ',e=document.createElement("div");return e.id="commentAuthAlertModal",e.classList.add("mask-dark"),e.innerHTML=t,document.body.appendChild(e),e.querySelector(".btn-modal-close").onclick=function(){e.remove()},!1}setTimeout(function(){$("#pcCommentBox").show(),$("#comment_content").focus()},0)})},e.prototype.bindBtn=function(){function t(t){return"svg"===this.nodeName||getCookie("UserName")?(e.commentCount>e.pageSize&&e.commentPagination.removeClass("d-none"),$(this).parent("div.opt-box").remove(),$(this).parent().parent("div.opt-box").remove(),e.showAll=!0,e.curH=0,void(window.event?window.event.cancelBubble=!0:t.stopPropagation())):(csdn.loginBox.show(),!1)}var e=this;$(document).on("click",".comment-operate-item",function(t){var o=$(t.target).data("type");if(void 0!==o)switch(o){case"report":var n=$(t.target).parents("li.comment-line-box"),i=n.data("commentid"),a=n.data("replyname");window.csdn.loginBox.key({biz:"blog",subBiz:"other_service",cb:function(){window.csdn.feedback({type:"blog",rtype:"comment",rid:i,reportedName:a,submitOptions:{contentUrl:articleDetailUrl},callback:function(){showToast({text:"感谢您的举报,我们会尽快审核!",bottom:"10%",zindex:9e3,speed:500,time:1500})}})}});break;case"reply":var s=$(t.target)[0].innerText;if($(this).find("a.btn-reply").text("回复"),$(t.target)[0].innerText="回复"==s?"收起":"回复",e.isCommentFold){if(!getCookie("UserName"))return window.csdn.loginBox.show(),!1;$("#commentEditBox").remove();var c=e.commentFoldTextareaStr("commentEditBox","New");if(!$("#commentEditBox").length&&"回复"==s){$(t.target).parents(".comment-list-item").after(c);var r=$(t.target).parents(".comment-line-box");e.addId(e,"new"),e.comment(),e.bindTxt(),curComment={},curComment.Id=r.data("commentid"),curComment.User=r.data("replyname"),curComment.text=r.find(".name").text()+(r.find(".nick-name").length?" 回复 "+r.find(".nick-name").text():"")+r.find(".comment").text(),e.cancelBtnToggle(!0),e.replayComment(curComment),e.txtComment.trigger("focus"),e.commentCode()}}else"回复"==s?"":$("#commentEditBox").remove();break;case"delete":var l=$(t.target).data("nickname"),d=$(t.target).parents("li.comment-line-box"),i=d.data("commentid");showConfirm({tit:"删除评论",text:'确认将 "'+l+'" 的评论删除吗?',isBlack:"Black"==skinStatus,rightText:"确定",zindex:9e3,success:function(){e.commentIsDelete(i)},cancel:function(){}});break;case"istop":var l=$(t.target).data("nickname"),m="false"!=$(t.target).attr("data-status"),p=$(t.target).parents("li.comment-line-box"),i=p.data("commentid");showConfirm({tit:m?"取消置顶":"置顶评论",text:m?'确认将 "'+l+'" 的评论取消置顶吗?':'确认将 "'+l+'" 的评论置顶吗?',isBlack:"Black"==skinStatus,rightText:"确定",zindex:9e3,success:function(){e.commentIsTop(i,m)},cancel:function(){}});break;case"blacklist":var m="false"!=$(t.target).attr("data-status"),u=$(t.target).data("username"),l=$(t.target).data("nickname");showConfirm({tit:m?"取消屏蔽":"屏蔽用户",text:isCurrentUserVip?m?'确认将 "'+l+'" 取消屏蔽吗?取消后对方即可在您的内容下进行评论':'确认将 "'+l+'" 屏蔽吗?屏蔽后对方将无法在您的内容下进行评论':"屏蔽用户为会员权益,您可加入会员行使该权益",isBlack:"Black"==skinStatus,rightText:isCurrentUserVip?"确定":"开通会员",zindex:9e3,success:function(){var t="";isCurrentUserVip?(t=m?"1001.2101.3001.6915":"1001.2101.3001.6913",e.commentIsBlack(username,u,m)):(window.open("https://www.csdn.net/vip?utm_source=commentblocking","_blank"),t="1001.2101.3001.6917"),window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({spm:t})},cancel:function(){}})}}),this.btnShowMore.click(t),this.btnShowMore.find("svg").click(t)},e.prototype.bindTxt=function(){var t=this;this.txtComment.keyup(function(){var e=t.commentCountObj,o=t.commentFontLimit-$(this).val().length;o<0?e.text(0):e.text(o),$(this).val().length||$(this).data("replayUser")?t.cancelBtnToggle(!0):t.cancelBtnToggle(!1)})},e.prototype.renderData=function(t){var e=this,o=e.commentFoldTextareaStr("commentEditBox","New");e.buildListDom(t,!1,this,!0),$(".comment-list li.comment-line-box").on("click",function(t){if($(t.target).data("flag")&&(e.commentLineBox&&e.commentLineBox[0]!=$(this)[0]&&e.commentLineBox.find(".comment-edit-box").remove(),0==$(this).find(".comment-edit-box").length)){if(getCookie("UserName")){getCookie("UserName")&&($(this).append(o),$("#closeNew").on("click",function(t){$(this).parents(".comment-edit-box").remove()}),e.addId(e,"new"),e.comment(),e.bindTxt(),curComment={},curComment.Id=$(this).data("commentid"),curComment.User=$(this).data("replyname"),curComment.text=$(this).find(".name").text()+($(this).find(".nick-name").length?" 回复 "+$(this).find(".nick-name").text():"")+$(this).find(".comment").text(),e.cancelBtnToggle(!0),e.replayComment(curComment),e.txtComment.trigger("focus"),e.commentCode());var n=$(document).scrollTop(),i=$("#csdn-toolbar").height();n<52&&(i=2*i)}else csdn.loginBox.show();e.commentLineBox=$(this)}}),n()},e.prototype.commentFoldTextareaStr=function(t,e){if($("#isShowCommentAuth").length&&1==$("#isShowCommentAuth").data("type"))var o=' | 博主筛选后可见';else var o="";var n='
还能输入1000个字符'+o+'
';return n},e.prototype.buildListDom=function(t,e,o,n){for(var i="",a="",s="",c=0;c',i+=o.buildHtml(r,d,!0,r.userName?r.userName:"",n),d>0){i+='
  • ',i+='
      ';for(var m=0;m1&&(i+='
      查看全部 '+d+' 条回复
      '),i+="
    ",i+="
  • "}if(i+="",e)a+=i;else{if(o.commentBox.append($(i)),2==o.commentUnFold.pageIndex&&0==c&&o.initHotComment&&t.length){var u=t[0].info,h="";u.content=this.replaceQuote(u.content);var f=this.getQuoteInfo(u.content);f.length>1?(quotename=f[1],quotecontent=this.getCodeInfo(f[2]),quotecontent=this.replaceNewUBB(quotecontent),s=this.getCodeInfo(f[3]),s=this.replaceNewUBB(s),s='引用“'+quotename+"”的评论:
    "+quotecontent+"
    "+s):(s=this.replaceNewUBB(f[0]),s=this.getCodeInfo(s));var g,v=null!==u.redEnvelopeInfo,b=v?JSON.parse(u.redEnvelopeInfo):null;v&&(g=JSON.stringify({spm:"3001.9224",extend1:{orderNo:u.orderNo}}),b.money=parseFloat(parseInt(b.money)/100).toFixed(2)),h='
    '+(u.gptInfo?'':"")+u.nickName+'热评'+(v?'
    '+b.money+"元
    ":"")+'
    '+s+"
    ",o.commentBoxDefault.html($(h)),o.initHotComment=!1,$("#pcCommentBox").show()}o.curFloor--}}return!t.length&&o.commentUnFold.total<=0&&o.commentBoxDefault.html(""),e?a:void w.getRedPacketVerifyBatch()},e.prototype.addId=function(t,e){"new"==e?(t.commentForm=$("#commentformNew"),t.txtComment=$("#comment_contentNew"),t.commentCountObj=t.commentForm.find("em"),t.commtCode=$("#commentCodeNew"),t.commentTxt=$("#comment_replyIdNew"),t.articleId=$("#article_idNew")):(t.commentForm=$("#commentform"),t.txtComment=$("#comment_content"),t.commentCountObj=t.commentForm.find("em"),t.commtCode=$("#commentCode"),t.commentTxt=$("#comment_replyId"),t.articleId=$("#article_id"))},e.prototype.bindBtnFoldMore=function(){var t=this;$(document).on("click","#lookFlodComment",function(){t.isCommentFold=!0,t.commentFold.pageIndex=1,t.getFoldList(t.commentFold),$("#pcFlodCommentSideBox").show(),$("#pcCommentSideBox").hide(),$("#pcCommentSideBox .comment-list-box").html("")}),$(document).on("click","#lookUnFlodComment",function(){t.isCommentFold=!1,t.commentUnFold.pageIndex=1,t.getPagination(t.commentUnFold.pageIndex),$("#pcFlodCommentSideBox").hide(),$("#pcCommentSideBox").show(),$("#pcFlodCommentSideBox .comment-fold-content").html("")}),e.prototype.getFoldList=function(e){$.ajax({url:blogUrl+"phoenix/web/v1/comment/list/"+articleId+"?page="+t.commentFold.pageIndex+"&size="+t.commentFold.pageSize+"&fold="+t.commentFold.fold,type:"post",xhrFields:{withCredentials:!0},success:function(e){if(200===e.code){result=e.data;result.foldCount;if($(".tool-item-comment .count").html(result.count),$(".comment-side-tit-count .count").html(result.count),$(".has-comment-tit .count").html(result.count),$(".has-comment-bt-left .count").html(result.count),$(".look-flod-comment .count").html(result.foldCount),$(".comment-fold-tit .count").html(result.foldCount),result.foldCount>0?t.lookFlodComment.show():t.lookFlodComment.hide(),result.list.length){var o=t.buildListDom(result.list,!0,t,!1),n=document.createElement("div");n.classList.add("comment-fold-con","comment-list-box","comment-operate-item"),n.innerHTML=o,$("#pcFlodCommentSideBox .comment-fold-content").append(n),t.commentFold.pageIndex+=1,t.commentFold.pageCount=result.pageCount,t.commentFold.pageIndex>t.commentFold.pageCount?t.lookBadComment.hide():t.lookBadComment.show()}}}})}};var d="";if(e.prototype.buildHtml=function(t,e,n,i,a){var s="",c="",r="",l="",m=!1,p="",u="";if(t.content=this.replaceUrl(t.content),n){d=i,p=this.getQuote(t.content),t.content=this.replaceQuote(t.content);var h=this.getQuoteInfo(t.content);h.length>1?(r=h[1],l=this.getCodeInfo(h[2]),l=this.replaceNewUBB(l),s=this.getCodeInfo(h[3]),s=this.replaceNewUBB(s),s='引用“'+r+"”的评论:
    "+l+"
    "+s):(s=this.replaceNewUBB(h[0]),s=this.getCodeInfo(s)),username===getCookie("UserName")&&(m=!0)}else{var h=this.getReplyInfo(t.content);c=h[1];var f=h.length>2?this.getQuoteInfo(h[2]):this.getQuoteInfo(h[0]);f.length>1?(r=f[1],l=this.getCodeInfo(f[2]),l=this.replaceNewUBB(l),s=this.getCodeInfo(f[3]),s=this.replaceNewUBB(s),s='引用“'+r+"”的评论:
    "+l+"
    "+s):(s=this.replaceNewUBB(f[0]),s=this.getCodeInfo(s))}if(o(t),n&&p&&""!=p&&(u='
    '+p+"
    "),n)var g="";else var g="comment-line-box-hide";var v,w=n&&null!==t.redEnvelopeInfo,b=w?JSON.parse(t.redEnvelopeInfo):null;w&&(v=JSON.stringify({spm:"3001.9224",extend1:{orderNo:t.orderNo}}),b.money=parseFloat(parseInt(b.money)/100).toFixed(2));var x="匿名用户"!=t.userName?blogUrl+t.userName:"javascript:void(0);",$='
  • '+t.userName+''+(t.gptInfo?'':"")+'
    '+(n?t.nickName+""+isBloger+" "+(t.isTop&&a?' 置顶 ':""):t.nickName+""+isBloger+' 回复 '+(t.parentNickName?t.parentNickName:"")+"")+''+t.dateFormat+'
    "+(w?'
    '+b.money+"元
    ":"")+'
    '+u+'
    '+this.setNewLine(s)+"
    "+(t.gptInfo?'
    '+t.gptInfo.text+"
    ":"")+"
  • ";return $},e.prototype.setNewLine=function(t){var e=/\
    ([\s\S]*?)\<\/pre\>/gi,o=[];if(t.replace(e,function(t){o.push(t)}),o.length)for(var n=t.replace(e,function(t){return"[csdnCommentPreCode]"}),i=n.replace(/\n/g,"
    "),a=0;a");return i},e.prototype.getReplyInfo=function(t){var e=t.split(/\[reply]([\s\S]*?)\[\/reply\][\r\n]{0,1}/gi);return e},e.prototype.getQuoteInfo=function(t){var e=t.split(/\[quote=([\w#\.]+)\]([\s\S]*?)\[\/quote\][\r\n]{0,2}/gi);return e},e.prototype.getCodeInfo=function(t){var e=t.replace(/\[code=([\w#\.]+)\]([\s\S]*?)\[\/code\]/gi,function(t,e,o){return""==$.trim(o)?"":'
    '+s(o.trim())+"
    "});return e},e.prototype.replaceNewUBB=function(t){return t=t.replace(/\[face\]([^\]]+):([^\]]+)\[\/face\]/gi,'表情包')},e.prototype.replaceUrl=function(t){var e=/(https?|http|ftp|file):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g,o=/\[code=([\w#\.]+)\]([\s\S]*?)\[\/code\]/gi,n=[];if(t.replace(o,function(t){n.push(t)}),n.length)for(var i=t.replace(o,function(t){return"[csdnCommentCode]"}),a=i.replace(e,function(t){return' 网页链接'}),s=0;s 网页链接'});return a},e.prototype.replaceQuote=function(t){return t=t.replace(/\[quote\]([\s\S]*?)\[\/quote\]/gi,"")},e.prototype.getQuote=function(t){var e="";return t.replace(/\[quote\]([\s\S]*?)\[\/quote\]/gi,function(t){e=t}),e=e.replace("[quote]","").replace("[/quote]","")},e.prototype.replayComment=function(t){var e=t.Id,o=t.User;this.txtComment.attr("placeholder","回复:"+t.text).data("replayUser",o),this.commentTxt.val(e)},e.prototype.commentCode=function(){var t=this;t.commtCode.find("a").click(function(e){var o="[code="+$(this).data("code")+"]\n\n[/code]",n=t.txtComment.val();(o+n).length<=t.commentFontLimit?(t.txtComment.val(n+o),"comment_content"==t.txtComment[0].id&&$("#comment-content").val(n+o),t.commtCode.parents(".comment-code-box").fadeOut()):showToast({text:"您输入的字数已经超过限定了",bottom:"10%",zindex:9e3,speed:500,time:1500});var i=e||window.event;i.stopPropagation?i.stopPropagation():i.cancelBubble=!0})},e.prototype.comment=function(){function t(t){if(!getCookie("UserName"))return e.setStorage();window.localStorage.removeItem("AM_comment_data");var o=$(t).find(":submit"),n={commentId:e.commentTxt.val(),content:e.txtComment.val(),articleId:articleId};if("block"===w.formRewardBox.css("display")&&Object.assign(n,w.rewardInfo),n.replyId&&$.trim(n.content)&&(n.content="[reply]"+e.txtComment.data("replayUser")+"[/reply]"+n.content),$(t).find("#comment_content").length&&$("#commentQuote").length&&""!==$("#commentQuote").text()&&(n.content="[quote]"+$("#commentQuote").text().substr(0,50)+"[/quote]"+n.content),""===$.trim(n.content)||""===e.txtComment.val())showToast({text:"请填写评论内容",bottom:"10%",zindex:9e3,speed:500,time:1500});else{var i=blogUrl+"phoenix/web/v1/comment/submit";o.prop("disabled",!0).val("提交中"),$.ajax({url:i,type:"post",dataType:"json",data:n,xhrFields:{withCredentials:!0},success:function(t){if(200===t.code){if(e.isCommentFold)e.commentFold.pageIndex=1,$("#pcFlodCommentSideBox .comment-fold-content").html(""),e.getFoldList(e.commentFold);else{e.commentForm.trigger("reset"),e.commentTxt.val(""),e.txtComment.data("replayUser","").attr("placeholder","想对作者说点什么"),e.cancelBtnToggle(!1),u=t.data,e.init(),e.removeStorage();var o=$("#commentQuote");o.length&&o.animate({height:0},300,function(){o.remove()}),e.commentUnFold.pageIndex=1,$("#pcCommentSideBox .comment-list-box").html("")}"block"===w.formRewardBox.css("display")&&w.formRewardBox.find(".btn-remove-reward").trigger("click"),showToast({text:"评论成功,审核后显示",bottom:"10%",zindex:9e3,speed:500,time:2e3})}else showToast({text:t.message,bottom:"10%",zindex:9e3,speed:500,time:2e3})},complete:function(){o.prop("disabled",!1).val("评论")}})}return!1}var e=this;e.commentForm.submit(function(e){e.preventDefault();var o=this;try{window.csdn.loginBox.key({biz:"blog",subBiz:"other_service",cb:function(){t(o)}})}catch(n){t(o)}})},e.prototype.insertRightCommnetPrompt=function(){if(window.localStorage.getItem("AM_comment_Prompt_show"))return!1;window.localStorage.setItem("AM_comment_Prompt_show",!0);var t=$(".right_recommend_comment"),e=$(".right_recommend_comment_Prompt");e.length>0?e.fadeIn(300):t.prepend('
    新的评论在这里
    '),setTimeout(function(){$(".right_recommend_comment_Prompt").fadeOut(500)},4e3)},e.prototype.setStorage=function(){return window.localStorage.setItem("AM_comment_data",this.txtComment.val()),window.localStorage.setItem("AM_comment_replyId",this.commentTxt.val()),window.localStorage.setItem("AM_comment_id",articleId),!!getCookie("UserName")||(window.csdn.loginBox.show(),!1)},e.prototype.removeStorage=function(){window.localStorage.removeItem("AM_comment_data"),window.localStorage.removeItem("AM_comment_replyId"),window.localStorage.removeItem("AM_comment_id")},e.prototype.bindLikedClick=a,e.prototype.bindRedRewardClick=i,e.prototype.cancelBtnToggle=function(t){t?this.cancelBtn.removeClass("d-none"):this.cancelBtn.addClass("d-none")},e.prototype.cancelBtnBindEvent=function(){var t=this;this.cancelBtn.on("click",function(){t.txtComment.attr("placeholder","想对作者说点什么").data("replayUser","").val(""),t.commentTxt.val(""),t.cancelBtnToggle(!1)})},e.prototype.commentIsBlack=function(t,e,o){var n=this,i="https://mp-action.csdn.net/interact/wrapper/pc/black/"+(o?"cancel":"save"),a=o?{username:t,usernameList:[e],bizNo:"blog"}:{username:t,blackUsername:e,bizNo:"blog"};$.ajax({url:i,type:"post",data:JSON.stringify(a),contentType:"application/json",dataType:"json",xhrFields:{withCredentials:!0},success:function(t){200===t.code?(setTimeout(function(){n.isCommentFold?(n.commentFold.pageIndex=1,$("#pcFlodCommentSideBox .comment-fold-content").html(""),n.getFoldList(n.commentFold)):(n.commentUnFold.pageIndex=1,$("#pcCommentSideBox .comment-list-box").html(""),n.getPagination(n.commentUnFold.pageIndex))},100),showToast({text:o?"取消屏蔽成功!":"屏蔽用户成功!",bottom:"10%",zindex:9e3,speed:500,time:1500})):showToast({text:o?"取消屏蔽失败,请刷新页面重新操作!":"屏蔽用户失败,请刷新页面重新操作!",bottom:"10%",zindex:9e3,speed:500,time:1500})}})},e.prototype.commentIsTop=function(t,e){var o=this,n=blogUrl+"phoenix/web/v1/comment/top",i={commentId:t,articleId:articleId,action:e?0:1};$.ajax({url:n,type:"post",dataType:"json",data:i,xhrFields:{withCredentials:!0},success:function(t){200===t.code?(setTimeout(function(){o.isCommentFold?(o.commentFold.pageIndex=1,$("#pcFlodCommentSideBox .comment-fold-content").html(""),o.getFoldList(o.commentFold)):(o.commentUnFold.pageIndex=1,$("#pcCommentSideBox .comment-list-box").html(""),o.getPagination(o.commentUnFold.pageIndex))},100),showToast({text:e?"取消置顶成功!":"置顶评论成功!",bottom:"10%",zindex:9e3,speed:500,time:1500})):showToast({text:e?"取消置顶失败,请重新操作!":"置顶评论失败,请重新操作!",bottom:"10%",zindex:9e3,speed:500,time:1500})}})},e.prototype.commentIsDelete=function(t){var e=this,o=$("#article_id").val(),n=blogUrl+"phoenix/web/v1/comment/delete",i={commentId:t,articleId:o};$.ajax({url:n,type:"post",dataType:"json",data:i,xhrFields:{withCredentials:!0},success:function(o){200===o.code?(setTimeout(function(){e.isCommentFold?(e.commentFold.pageIndex=1,$("#pcFlodCommentSideBox .comment-fold-content").html(""),e.getFoldList(e.commentFold)):(e.commentUnFold.pageIndex=1,$("#pcCommentSideBox .comment-list-box").html(""),e.getPagination(e.commentUnFold.pageIndex));var o=$("#pcCommentBox").find(".hot-comment-box");o.length>0&&o.data("commentid")===t&&(o.html(""),o.data("commentid",""),$("#pcCommentBox").hide())},100),showToast({text:"删除成功!",bottom:"10%",zindex:9e3,speed:500,time:1500})):showToast({text:"删除失败,请重新操作!",bottom:"10%",zindex:9e3,speed:500,time:1500})}})},$(document).on("keydown",".comment-content",function(t){var e=t||event;console.log(t),(e.ctrlKey&&13==e.which||13==e.which&&e.metaKey)&&("comment_content"==$(this).attr("id")?$("#commentform .btn-comment").trigger("click"):$("#commentformNew .btn-comment").trigger("click"))}),$(document).on("click",".second-look-more",function(t){$(this).hide(),$(this).siblings(".comment-line-box-hide").show()}),$(document).on("click",".comment-operate-item",function(t){if(getCookie("UserName")){if($(".comment-operate-isshow").fadeOut(),$(this).hasClass("comment-emoticon")){""==$(".comment-emoticon-img-box").html()&&$(".comment-emoticon-img-box").html(c()), $(this).find(".comment-emoticonNew").length&&$(this).find(".comment-operate-isshow").html($("#commentform .comment-emoticon-box").html());var e=$(this).find(".comment-emoticon-box");"block"===e.css("display")?e.fadeOut():($("#comment_content").one("focus",function(){e.fadeOut()}),e.fadeIn())}else if($(this).hasClass("comment-code")){var o=$(this).find(".comment-code-box");"block"===o.css("display")?o.fadeOut():($("#comment_content").one("focus",function(){o.fadeOut()}),o.fadeIn()),!$(this).hasClass("comment-codeNew")}else $(this).hasClass("comment-reward")&&w.showRewardForm();var n=t||window.event;n.stopPropagation?n.stopPropagation():n.cancelBubble=!0}else csdn.loginBox.show()}),$(document).on("click",".emoticon-monkey-img",function(t){var e=$(this).data("emoticon");if($(this).parents(".comment-emoticon-box").is(".comment-emoticonNew")){var o=$("#comment_contentNew").val()+e;o.length<=1e3?textareaPointLocation.insertAtCaret($("#comment_contentNew")[0],e):showToast({text:"您输入的字数已经超过限定了",bottom:"10%",zindex:9e3,speed:500,time:1500})}else{var o=$("#comment_content").val()+e;o.length<=1e3?textareaPointLocation.insertAtCaret($("#comment_content")[0],e):showToast({text:"您输入的字数已经超过限定了",bottom:"10%",zindex:9e3,speed:500,time:1500})}$(this).parents(".comment-emoticon-box").fadeOut();var n=t||window.event;n.stopPropagation?n.stopPropagation():n.cancelBubble=!0}),$(document).on("mouseenter",".comment-like",function(){$(this).hasClass("liked")?($(this).find(".clickedImg").css("display","none"),$(this).find(".comment-like-img-hover").css("display","block")):($(this).find(".unclickImg").css("display","none"),$(this).find(".comment-like-img-hover").css("display","block"))}),$(document).on("mouseleave",".comment-like",function(){$(this).hasClass("liked")?($(this).find(".clickedImg").css("display","block"),$(this).find(".comment-like-img-hover").css("display","none")):($(this).find(".unclickImg").css("display","block"),$(this).find(".comment-like-img-hover").css("display","none"))}),$(document).on("click",".unlogin-comment-box-new .unlogin-comment-bt",function(){window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({spm:"1001.2101.3001.6916"}),getCookie("UserName")||window.csdn.loginBox.show({spm:"1001.2101.3001.8611"})}),$(".blog-postTime").length>0){var m=$(".blog-postTime").data("time"),p="于 "+m+" 发布";$(".blog-postTime").html(p)}var u=r("#comments_");if(u&&!getCookie("UserName")){$("#pcCommentBox").show();var h=$(document).scrollTop(),f=$("#csdn-toolbar").height(),g=2*$("#pcCommentBox").height();h<52&&(f=2*f);var v=$("#pcCommentBox").offset().top-f-g;return setTimeout(function(){$("html,body").animate({scrollTop:v},200)},850),!1}var w=new t;window.csdn.comments?window.csdn.comments:{},window.csdn.Comments=e,window.csdn.comments=new window.csdn.Comments}),$(function(){if(1===articleType){var t=$("main .blog-content-box")[0],e=document.querySelector(".creativecommons span a");e=e?e.innerText:"";var o="";e?o="\r\n————————————————\r\n版权声明:本文为CSDN博主「"+nickName+"」的原创文章,遵循"+e+"版权协议,转载请附上原文出处链接及本声明。\r\n原文链接:"+curentUrl:(e=document.querySelector(".creativecommons"),e=e?e.innerText:"",e?o="\r\n————————————————\r\n"+e+"\r\n原文链接:"+curentUrl:(e="CC 4.0 BY-SA",o="\r\n————————————————\r\n版权声明:本文为CSDN博主「"+nickName+"」的原创文章,遵循"+e+"版权协议,转载请附上原文出处链接及本声明。\r\n原文链接:"+curentUrl)),csdn.copyright.init(t,o)}if(copyPopSwitch&&!getCookie("UserName")){var n=function(){window.csdn.loginBox.show({spm:"1001.2101.3001.9440"})};$("#content_views").unbind("keydown").bind("keydown",function(t){if(t.ctrlKey&&67==t.keyCode)return n(),!1}),$("#content_views").unbind("copy").bind("copy",function(t){return n(),!1})}}),$(function(){function t(t,o){if(!(o.length<2)){var n="";n+="
      ";for(var i=0,a=0,s=0,c=0,r=0,l=0,d=0;di?(n+='
      1. ',a++):m0&&(n+="
    1. ",a--),m==p)for(;a>0;)n+="
    ",a--;i=m;var u=o.eq(d).text();if(u=/^[\s]+$/.test(u)?u:u.replace(/^[\s]+/g,""),u=e(u),u.length>0)switch(m){case 1:++s,c=0,r=0,l=0;var h="";1===s&&(h="active"),n+="
  • '+u+"
  • ";break;case 2:++c,r=0,l=0,n+='
  • '+u+"
  • ";break;case 3:++r,l=0,n+='
  • '+u+"
  • ";break;case 4:++l,n+='
  • '+u+"
  • "}}for(;a>0;)n+="",a--;return n}}function e(t){return t.replace(/[<>&"]/g,function(t){return{"<":"<",">":">","&":"&",'"':"""}[t]})}function o(t){function e(t){return $(t).each(function(t,n){n.children&&e(n.children),++o}),o}var o=0;return e(t)}function n(t,e,o){var n=$("div.groupfile"),i=n.find("div.toc-box"),a=n.find("div.opt-box");if(e<=2&&($("#liTocBox").remove(),!isShowSideModel&&payColumn&&window.csdn.loadRightColumn()),e>2&&"0"==d&&$("#liTocBox").css("display","block"),e<=2&&"1"==d?($(".groupfile").remove(),$("#rightAsideConcision").remove()):isShowConcision?(isCookieConcision&&($(".recommend-right1").addClass("show-directory"),$("#mainBox").removeAttr("style")),isHasDirectoryModel=!0):$("#rightAsideConcision").remove(),e<=2&&($("#blog_artical_directory").hide(),$(".left_menu .menu_con").hide()),!$(".first_li")[0]){i.html(o(t,m)),s(e,a,i);var c=!1;$("#liTocBox").hover(function(){$("#liTocBox .toc-container").finish().fadeIn(500),$(this).find("button.btn-toc").addClass("active"),c=!1},function(t){c=!0;var e=$(this);setTimeout(function(){c&&($("#liTocBox .toc-container").finish().fadeOut(500),e.find("button.btn-toc").removeClass("active"))},300)})}}function i(){var t=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;t+=10;for(var e=0;e=180?($("#recommend-right").css({position:"fixed",top:t}),$("#recommend-right-concision").css({position:"fixed",top:t})):($("#recommend-right").removeAttr("style"),$("#recommend-right-concision").removeAttr("style")),0==$(document).scrollTop()&&($("#recommend-right").removeAttr("style"),$("#recommend-right-concision").removeAttr("style"))}function s(t,e,o){if(t>9){var n=25*$("div.toc-box").find("li:not(.sub-box)").length,i=225,a=n-i,s=0;e.find("button.btn-opt").click(function(){$(this).hasClass("nomore")||($(this).hasClass("prev")?(s-=25,o.scrollTop(s),s<=0&&$(this).addClass("nomore")):(s+=25,s>=25*(t-17)&&(s=25*(t-17)),o.scrollTop(s),s>=a&&$(this).addClass("nomore")),$(this).siblings().removeClass("nomore"))})}else e.remove()}function c(){function t(e){$(".openvippay")[0]||window.csdn.clearReadMoreBtn(),o.off("click",t)}function e(){var t=window.location.href,e=document.title;setTimeout(function(){history.pushState(null,e,t)},0)}var o=$(".toc-container .toc-box ol li a");return 0!==o.length&&(o.click(t),void o.click(e))}function r(t){var e="
      ";return $(t).each(function(t,o){e+=l(o,t)}),e+"
    "}function l(t,e){return t.children.length?"
  • "+t.title+'
  • '+r(t.children)+"
  • ":"
  • "+t.title+"
  • "}if(!window.hasOwnProperty("isGitCodeBlog")||!isGitCodeBlog){for(var d=1,m=$("#article_content").find("h1,h2,h3,h4"),p=$("#article_content").find("h1").length>0?1:2,u=0;u'+m.eq(u).html());$(".vip_article")[0]?($.ajax({type:"GET",url:blogUrl+"/phoenix/web/v1/get-article-catalog?articleId="+articleId,dataType:"json",xhrFields:{withCredentials:!0},success:function(t){200==t.code&&(n(t.data,o(t.data),r),c(),$("#groupfile .toc-box ol li a").each(function(t,e){e.href="#t"+t}),$("#directory .toc-box ol li a").each(function(t,e){e.href="#t"+t}),$("#rightAsideConcision .toc-box ol li a").each(function(t,e){e.href="#t"+t}),""===String($(".groupfile .toc-box").text()).replace(/(^\s*)|(\s*$)/g,"")?($("#asidedirectory").remove(),$("#groupfile").remove(),$("#rightAsideConcision").remove(),isHasDirectoryModel=!1):$("#groupfile").show())}}),$("#downloadEduApp").click(function(){getCookie("UserName")?window.open("https://vip.csdn.net/studyvip?utm_source=zhuanlan"):window.csdn.loginBox.show()})):(n("",m.length,t),c(),""===String($(".groupfile .toc-box").text()).replace(/(^\s*)|(\s*$)/g,"")?($("#asidedirectory").remove(),$("#groupfile").remove(),$("#rightAsideConcision").remove(),isHasDirectoryModel=!1):$("#groupfile").show()),$(document).on("toolbarHeightChange",function(t){var e=$("#csdn-toolbar").height()+8;$("#recommend-right").css("position")&&$("#recommend-right").css({top:e})});var h=$("#content_views").find("h1,h2,h3,h4"),f=[],g=$("#content_views").offset().top,v=$("#content_views").height(),w=$("#csdn-toolbar").height();$(h).each(function(t,e){f.push($(e)[0].offsetTop+g-2*w)}),f.push(v+g),$(window).resize(function(){f=[],g=$("#content_views").offset().top,v=$("#content_views").height(),w=$("#csdn-toolbar").height(),$(h).each(function(t,e){f.push($(e)[0].offsetTop+g-2*w)}),f.push(v+g)}),$(window).scroll(function(){$(".groupfile .toc-box li").removeClass("active"),i()}),i(),$(document).on("click",".groupfile .toc-box li a",function(t){$(".groupfile .toc-box li").removeClass("active"),$(this).parent().addClass("active")});var b=document.body.clientHeight||document.documentElement.clientHeight;if($("#groupfile").css("max-height",b/2+"px"),$(".groupfile-div").css("max-height",b/2+"px"),$(".groupfile-div1").css("max-height",b-48+"px"),$(document).scroll(function(){a()}),a(),$(document).on("click",".csdn-side-toolbar .option-box",function(t){isShowConcision&&setTimeout(function(){a()},100)}),$(".hide-article-box").length&&"none"!==$(".hide-article-box").css("display")){for(var x=$(".hide-article-box").offset().top,y=0,k=0;ky){var e=$("#getVipUrl").attr("href");e.indexOf("vip")>-1?window.open(e+"?utm_source=brv&sale_source=BgsN7mSaYF"):window.open(e)}}),$(".btn-readmore")[0]&&C.each(function(t,e){$(".groupfile .toc-box ol").find('a[href="#'+$(C[t]).find("a")[0].name+'"]').click(function(){$(".btn-readmore").trigger("click"),$(".btn-readmore").hasClass("no-login")?window.open("https://passport.csdn.net/account/login"):$("#btnAttent").trigger("click")})})}$(document).ready(function(){var t=$(".htmledit_views #main-toc").prevAll("h1,h2,h3,h4"),e=t.length,o=$('.htmledit_views p[id*="-toc"]').slice(1).filter(function(t,e){return $(e).find("a").length||$(e).css({margin:"0"}),$(e).find("a").length}),n=0;o.each(function(t,o){$(o).attr("id","");var i=$(o).css("margin-left").replace("px","")/40,a=0==i?0:48*i;if($(o).css({"padding-left":"24px",margin:"0","margin-left":a+"px","margin-bottom":"2px"}),e>0)$(o).find("a").attr("href","#t"+e),e++;else{var s=$(o).find("a").attr("href").replace("#","");s=s.replace(/%28/g,"(").replace(/%29/g,")").replace(/%7b/g,"{").replace(/%7d/g,"}"),$('[id="'+s+'"]').is("h1,h2,h3,h4")?$(o).find("a").attr("href","#t"+(t-n)):n++}});var i=$(".markdown_views .toc a");i.length&&i.each(function(t,e){var o=$(e).attr("href");o&&$(e).attr("href",o.replace(/%/g,"_"))});var a=$(".markdown_views").find("h1 a,h2 a,h3 a,h4 a");a.length&&a.each(function(t,e){var o=$(e).attr("id");o&&$(e).attr("id",o.replace(/%/g,"_"))}),$(document).on("click","#content_views a[href*=#],div.toc-box a[href*=#],li.tool-item-comment a[href*=#]",function(){var t=$("#csdn-toolbar").height(),e=$(document).scrollTop();if(e<52&&(t=2*t),location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname){var o=$('[id="'+this.hash.slice(1)+'"]');if(o=o.length&&o||$('[name="'+this.hash.slice(1)+'"]'),o.length){var n=o.offset().top;return $("html,body").animate({scrollTop:n-t},500),!1}}}),setTimeout(function(){if(window.location.href.indexOf("#comments")>-1){var t=$("#csdn-toolbar").height();$("html,body").animate({scrollTop:$("#commentBox").offset().top-t-48},500)}},1e3)})}}),$(function(){function t(t){var e=$(".article-resource-info-box");$.ajax({type:"GET",url:"https://download-console-api.csdn.net/plugin/blog/source/get",dataType:"json",data:{sid:t},xhrFields:{withCredentials:!0},success:function(t){if(200==t.code&&t.data&&t.data.hasOwnProperty("sid")){var o=t.data,n='\n \n '+o.title+'\n \n \n \n ';e.append(n),e.css({display:"flex"}),window.csdn.report.viewCheck()}else e.remove()},error:function(){e.remove()}})}resourceId&&t(resourceId)}),$(function(){function t(t){for(var e=document.cookie.split("; "),o=0;o0&&e.list[t]){var i=n.attr("class");i=a(i),e.language[i]&&v.push({lang:i,code:n[0].innerText.replace(/[\u00A0]/gi," "),key:"code_key_"+t,index:t,demo:n.parent()})}}),v.forEach(function(t,e){v[e].key="code_key_"+e,c="code-edithtml-box"+e,r="'
    运行
    ',t.demo[0].innerHTML=t.demo[0].innerHTML+r,$(".hljs-button").eq(t.index).addClass(n),$(t.demo).find(".hljs-button").attr("data-report-click",'{"spm":"3001.10243"}'),s(c,e),delete v[e].index,delete v[e].demo})}function i(t,e){try{var o;"ckeditor"==m?(o=$("code.hljs"),n(o,t,"","def",e)):(o=$("pre code"),n($("pre code"),t,"active","mddef",e)),window.csdn.report.viewCheck(),setTimeout(function(){window.localStorage.getItem(u)&&$(".code-edithtml-box").each(function(t,e){t==window.localStorage.getItem(u)&&($(e).find("button").trigger("click"),window.localStorage.removeItem(u))})},200)}catch(i){console.error("CopyButton error: ",i)}}function a(t){var e="";return t.split(" ").forEach(function(t){t.indexOf("language-")!=-1&&(e=t.replace("language-",""))}),e.toLowerCase()}function s(t,e){window.hRenderEditor("."+t,{index:e,codes:v,articleId:articleId,channel:"CSDN-Run",fromSource:f,onPostData:c,articleTitle:articleTitle,onAuth:function(t){t&&"UNKNOWN"==t.data?(w&&w.close(),w=window.open(g,"","width=850,height=600"),window.addEventListener("message",function(e){"passport_cs_csdn_login"==e.data.type&&(t.tCode=e.data.data,window.hUpdateTCode(e.data.data)),"passport_cs_csdn_reload"==e.data.type&&(window.localStorage.setItem(u,t.index),window.location.reload())})):r(window.hUpdateTCode,{index:e},"key")}},{})}function c(t){return new Promise(function(e,o){r(e,t,"")})}function r(e,o,n){t("UserName")?$.ajax({type:"GET",url:"https://passport.csdn.net/v1/login/cloud_studio/get_embed_code",dataType:"json",xhrFields:{withCredentials:!0},data:{strategy:f,authentic:"key"===n||"control"!==p||""},success:function(t){0==t.code&&(o.tCode=t.data.embedCode,e(n?t.data.embedCode:o)),1021==t.code&&l(o),1215==t.code&&(w&&w.close(),w=window.open(g,"","width=850,height=600"),window.addEventListener("message",function(t){"passport_cs_csdn_login"==t.data.type&&(o.tCode=t.data.data,e(n?t.data.data:o)),"passport_cs_csdn_reload"==t.data.type&&(window.localStorage.setItem(u,o.index),window.location.reload())}))},error:function(t){}}):l(o)}function l(t){window.csdn.loginBox.show({spm:"3001.10182",cb:function(e){"control"==p&&window.localStorage.setItem(u,t.index),window.location.reload()}})}function d(){try{var t=$(".abstract-content")[0],e=document.createRange();e.setStart(t,0),e.setEnd(t,t.childNodes.length);var o=(e.getBoundingClientRect().width,e.getBoundingClientRect().height),n=window.getComputedStyle(t,null),i=Number.parseInt(n.paddingTop,10)||0,a=Number.parseInt(n.paddingBottom,10)||0,s=i+a;if(o+s>t.clientHeight){if($(".abstract-ab").length<=0){var c="https://img-home.csdnimg.cn/images/20240708095038.png";"Black"==skinStatus&&(c="https://img-home.csdnimg.cn/images/20240708025423.png"),$(".ai-abstract-box").append('

    展开

    ')}$(".abstract-ab").show()}else $(".abstract-ab").hide()}catch(r){}}var m="",p="",u="CSDN_"+articleId+"_CS",h=document.querySelectorAll("pre code");document.querySelectorAll("div.htmledit_views").length>0?m="ckeditor":h.length>0&&(m="mdeditor");var f="gwzcw.8483411.8483411.8483411",g="https://cloudstudio.net/auth/realms/cloudstudio/protocol/openid-connect/auth?client_id=open-csdn&scope=r:user:id%20c:code_segment&response_type=code&redirect_uri=https%3A%2F%2Fpassport.csdn.net%2Fcloudstudiologin?article_id="+articleId+"&state=CSDN&fromSource="+f+"&kc_idp_hint=&channel=CSDN-Run";e()||o()||window.addEventListener("DOMContentLoaded",function(){$("code.hljs").length<=0&&$("pre code").length<=0||$.ajax({type:"GET",url:blogUrl+"/phoenix/web/v1/code-slice",dataType:"json",xhrFields:{withCredentials:!0},data:{articleId:articleId},success:function(e){200==e.code&&$.ajax({type:"GET",url:blogUrl+"/phoenix/web/v1/ab",dataType:"json",xhrFields:{withCredentials:!0},data:{id:392,key:t("uuid_tt_dd")},success:function(t){200==t.code&&(p=t.data,"exp1"===t.data&&(f="gwzcw.8483427.8483427.8483427",g="https://cloudstudio.net/auth/realms/cloudstudio/protocol/openid-connect/auth?client_id=open-csdn&scope=r:user:id%20c:code_segment&response_type=code&redirect_uri=https%3A%2F%2Fpassport.csdn.net%2Fcloudstudiologin?article_id="+articleId+"&state=CSDN&fromSource="+f+"&kc_idp_hint=&channel=CSDN-Run"),e.data&&e.data.list&&i(e.data,t.data))},error:function(t){}})},error:function(t){}})});var v=[],w=null;d(),window.addEventListener("resize",d),$(".ai-abstract").mouseleave(function(){$(this).removeClass("active")}),$(".abstract-ab").mouseenter(function(){$(".ai-abstract").addClass("active")})}),$(function(){var t=$('#article_content a[href^="#"]');t.each(function(t){$(this).attr("target","_self")})}),$(function(){function t(t,e){var o=e?window.csdn.report.getFullSpm(e):"",n="https://link.csdn.net?from_id="+articleId+"&target="+encodeURIComponent(t+"?utm_source=artical_gitcode"+(o?"&spm="+o:""));return n}function e(t){var e=[{unit:"K",base:1e3},{unit:"M",base:1e6}],o=2;try{var n=e;return n.reduce(function(e,n){var i=n.base,a=n.unit;if(t>=i){var s=Math.pow(10,o);e=""+parseFloat((Math.round(t*s/i)/s).toFixed(o))+a}return e},""+t)}catch(i){}return""+t}function o(o){var n=$("#gitAsideProjectInfo"),i=$("#gitProjectInfo"),a=(e(o.star_count),e(o.forks_count),t(o.web_url,"3001.10288")),s=t(o.web_url,"3001.10290"),c=function(t){return JSON.stringify({spm:"3001.10288",dest:a,extra:{type:t}})};if(n){var r=c("title"),l=c("fork"),d=c("star"),m=c("clone"),p=c("source"),u=c("more");n.find(".title a").attr("href",a).attr("data-report-click",r).text(o.name).attr("title",o.name),n.find("a.link-more").attr("href",a).attr("data-report-click",u),n.find("a.btn-star").attr("href",a).attr("data-report-click",d).find("span.count").text(e(o.star_count)),n.find("a.btn-fork").attr("href",a).attr("data-report-click",l).find("span.count").text(e(o.forks_count)),n.find("a.btn-clone").attr("href",a).attr("data-report-click",m),n.find("a.btn-source").attr("href",a).attr("data-report-click",p),n.show()}if(i){var h=JSON.stringify({spm:"3001.10290",dest:s});i.find("a").attr("href",s).attr("data-report-click",h).attr("data-report-view",h),i.find(".title").text("⚡️Github加速计划 / "+o.name).attr("title",o.name),i.find(".desc").text(o.description?o.description:"").attr("title",o.description?o.description:""),i.find(".icon-start").text(e(o.star_count)),i.find(".icon-fork").text(e(o.forks_count)),i.show(),window.csdn.report.viewCheck()}}function n(o){var n=$("#gitRelatedProjects");if(n){var i=n.find(".gitcode-related-box"),a="",s=n.find("a.link-more");s&&s.attr("href",t("https://gitcode.com"));for(var c=o.length>5?5:o.length,r=0;r\n \n
    \n

    '+l.name+'

    \n '+p+"\n
    \n "+(l.description?'

    '+l.description+"

    ":"")+"\n
    \n \n "}""!==a&&(i.html(a),window.csdn.report.viewCheck()),n.show()}}function i(){$.ajax({url:"https://datalinkapi.gitcode.com/api/v2/projects/byCArticleId",type:"get",data:{articleId:articleId},xhrFields:{crossDomain:!0,withCredentials:!0},success:function(t){if(t&&t.name){try{a(t.name)}catch(e){$("#gitRelatedProjects").remove()}try{o(t)}catch(e){$("#gitAsideProjectInfo").remove()}}else{$("#gitAsideProjectInfo").remove();try{a(articleTitle)}catch(e){$("#gitRelatedProjects").remove()}}},error:function(){$("#gitAsideProjectInfo").remove();try{a(articleTitle)}catch(t){$("#gitRelatedProjects").remove()}}})}function a(t){$.ajax({url:"https://web-api.gitcode.com/api/v1/search/nauth/query",type:"get",data:{q:t,type:"repo",p:1,pp:10,o:"desc"},xhrFields:{crossDomain:!0,withCredentials:!0},success:function(t){if(t&&t.content&&t.content.length>0)try{n(t.content)}catch(e){$("#gitRelatedProjects").remove()}else $("#gitRelatedProjects").remove()},error:function(){$("#gitRelatedProjects").remove()}})}window.hasOwnProperty("isGitCodeBlog")&&isGitCodeBlog&&i()}),function(){function t(t){var e="",o="",a="";i&&(e="active"),t.type?(o='作者:'+t.author+' '+actionNumberFormat(t.learnNum)+'人已学 课程详情',a=" curriculum-active"):o='加入社区';var s='";n.innerHTML=s}function e(){$.ajax({url:"https://devpress-api.csdn.net/api/internal/blog/nsInfo/blog/"+articleId,type:"GET",xhrFields:{withCredentials:!0},success:function(e){200==e.code&&e.data?t(e.data):n.remove()}})}function o(t,e){$.ajax({type:"POST",url:"https://devpress-api.csdn.net/v1/user/follow",contentType:"application/json; charset=utf-8",data:JSON.stringify({followTarget:t,type:1}),xhrFields:{withCredentials:!0},success:function(t){window.open(e)},error:function(t){window.open(e)}})}var n=document.getElementById("blogHuaweiyunAdvert"),i=document.getElementById("blogColumnPayAdvert");n&&(e(),$(document).on("click","#blogHuaweiyunAdvert .column-group",function(){if(getCookie("UserName")){var t=$(this).data("id"),e=$(this).data("url");o(t,e)}else window.csdn.loginBox.show()}))}(),$(".comment-box textarea.comment-content").on("select",function(){textareaPointLocation.setCaret(this)}).on("click",function(){textareaPointLocation.setCaret(this)}).on("keyup",function(){textareaPointLocation.setCaret(this)});var textareaPointLocation={setCaret:function(t){t.createTextRange&&(t.caretPos=document.selection.createRange().duplicate())},insertAtCaret:function(t,e){if(document.all)if(t.createTextRange&&t.caretPos){var o=t.caretPos;o.text=" "==o.text.charAt(o.text.length-1)?e+" ":e}else t.value=e;else if(t.setSelectionRange){var n=t.selectionStart,i=t.selectionEnd,a=t.value.substring(0,n),s=t.value.substring(i);t.value=a+e+s}else showToast({text:"This version of Mozilla based browser does not support setSelectionRange",bottom:"10%",zindex:9e3,speed:500,time:1500})}};$(function(){function t(){function t(){$("#publicPrompt").remove(),$(document).off("click",".publicPrompt-close",t),$(document).off("click",".publicPrompt-mask",t)}var e={success:''};this.data={},this.data.status="success",this.data.titleStr="收藏成功",this.data.textStr='已收藏至 个人中心',this.data.imgUrl="",this.init=function(t){return $.extend(this.data,t),this.addStyle(),this.bindDom(),this},this.show=function(t){$.extend(this.data,t),this.insetStructure(this.data)},this.bindDom=function(){$(document).on("click",".publicPrompt-close",t),$(document).on("click",".publicPrompt-mask",t)},this.insetStructure=function(t){var o='

    '+e[t.status]+t.titleStr+'

    '+t.textStr+'
    ';$("body").append(o)},this.addStyle=function(){var t=document.createElement("style");t.type="text/css",t.innerHTML=["#publicPrompt{","position: fixed;z-index: 99999;top: 0;left: 0;width: 100%;height: 100%;","}","#publicPrompt .publicPrompt-mask{","position: absolute;top: 0;left: 0;width: 100%;height: 100%;","background-color: rgba(0,0,0,0.5);","}","#publicPrompt .publicPrompt-content{","position: absolute;z-index: 2;top: 30%;left: 50%;margin-left: -175px;","background-color: #fff;width: 350px;padding: 16px;","}","#publicPrompt .publicPrompt-content .publicPrompt-title{","font-size: 16px;color: #3D3D3D;","}","#publicPrompt .publicPrompt-title svg{margin-right:4px;}","#publicPrompt .publicPrompt-title .success{fill:#89cb62;width: 20px;height: 20px;vertical-align: sub;}","#publicPrompt .publicPrompt-close{","position: absolute;top: 16px;right: 16px;cursor: pointer;","}","#publicPrompt .publicPrompt-text{","text-align: center;margin-top: 16px;margin-bottom: 16px;font-size: 14px;","}","#publicPrompt .publicPrompt-text a{","color: #3399EA;text-decoration: underline;","}","#publicPrompt .publicPrompt-qr{","display: block;width: 116px;height: 116px;padding: 8px;margin: 0 auto;border: 1px solid #EBEBEB;","}",".publicPrompt-footer-text{","font-size: 14px;color: #4D4D4D;margin-top:8px;text-align: center;","}"].join(""),document.getElementsByTagName("head")[0].appendChild(t)}}window.csdn?window.csdn:{},window.csdn.publicPrompt=t}),$(function(){function t(t,e){l.hide(),m=t,m?c.text("您举报的评论来自文章:"):c.text("举报内容:"),r.css({"z-index":9999}).show(),s.css({"z-index":1e4}).show()}function e(){s.find("#frmReport").trigger("reset"),r.css({"z-index":150}).hide(),s.hide(),$(".ipt-textarea").val(""),$(".box-botoom ul li").removeClass("box-active"),$(".box-content-bottom ul li").removeClass("box-active"),$(".box-content").eq(0).show().siblings().hide(),$("#cllcont").hide(),$(".content-input").val(""),flag=!1,i="",a=""}function o(t){showToast({text:t,bottom:"10%",zindex:9999,speed:500,time:1500})}var n='

    举报

    选择你想要举报的内容(必选)
    • 内容涉黄
    • 政治相关
    • 内容抄袭
    • 涉嫌广告
    • 内容侵权
    • 侮辱谩骂
    • 样式问题
    • 其他
    '; $("body").append(n);var i="",a="";$(".box-botoom ul li").on("click",function(){flag=!1,$(this).addClass("box-active").siblings().removeClass("box-active"),i=$(this).attr("data"),$(".content-input").val(""),$(".box-content").eq($(this).index()).show().siblings().hide(),"6"==$(this).attr("data")?$("#cllcont").hide():$("#cllcont").show(),"8"==$(this).attr("data")?$("#cllcont").hide():$("#cllcont").show(),$(".ipt-textarea")[0].value="",$(".box-content-bottom ul li").removeClass("box-active"),"7"==$(this).attr("data")?$(".box-content-span").html("补充说明(必填)"):$(".box-content-span").html("补充说明(选填)"),a=""}),$(".box-content-bottom ul li").on("click",function(){$(this).addClass("box-active").siblings().removeClass("box-active"),a=$(this).attr("sub_type"),flag=!0});var s=$("div.report-box"),c=s.find("#reptTit"),r=$("div.mask-dark"),l=$("#rptOriginalurl"),d=s.find('textarea[name="description"]'),m=!1,p=0;s.find(".btn-close").click(e),r.click(e);var u="";$(".box-active").on("click",function(){if(!i)return o("请选择你想要举报的内容!"),!1;switch(i){case"3":if(u=$("#originalurl").val(),""==u||"http://"==u)return o("举报抄袭必须提供原创文章地址!"),$("#originalurl").focus(),!1;break;case"7":if(u=d.val(),!u)return o("请填写补充说明!"),d.focus(),!1;break;case"5":if(!flag)return o("请选择具体原因"),!1;break;case"6":if(!flag)return o("请选择具体原因"),!1;break;case"8":if(!flag)return o("请选择具体原因"),!1}var t={articleId:articleId,commentId:m?p:"",subType:a,type:i,originalUrl:u,description:d.val()},n=m?"report-comment":"report-article";$.ajax({url:blogUrl+"/phoenix/web/v1/"+n,type:"post",dataType:"json",data:t,xhrFields:{withCredentials:!0},success:function(t){200==t.code?(e(),sessionStorage.removeItem("usename"),sessionStorage.removeItem("articleId"),o("感谢您的举报,我们会尽快审核!"),$(".ipt-textarea").val(""),$(".box-botoom ul li").removeClass("box-active"),$(".box-content-bottom ul li").removeClass("box-active"),$(".box-content").eq(0).show().siblings().hide(),$("#cllcont").hide(),$(".content-input").val(""),flag=!1,i="",a="",u="",e()):o("举报失败")}})}),$("div.comment-box").on("click","a.btn-report",function(){p=$(this).parents("li.comment-line-box").data("commentid")}),window.showReport=t}),$(function(){}),$(function(){function t(){$("code.has-numbering").each(function(t,e){$(e).css("position","absolute"),$(e).parent("pre.prettyprint").css({position:"relative",height:$(e).outerHeight()+20+"px"})})}window.csdn=window.csdn?window.csdn:{},window.csdn.setSafariCodestyle=t}),$(function(){0==$(".btn-readmore").length&&($("#content_views").find("pre").each(function(t,e){e=$(e),e.find("code").height()>340?(e.addClass("set-code-hide"),e.append('
    ')):e.addClass("set-code-show")}),$(window).resize().scroll(),$(document).on("click",".hide-preCode-bt",function(){return $(this).parents("pre").removeClass("set-code-hide").addClass("set-code-show"),$(this).parents(".hide-preCode-box").hide().remove(),$(window).resize().scroll(),window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({spm:"1001.2101.3001.7365"}),!1}))}),$(function(){}),window.csdn.insertcallbackBlock=computePos,$(function(){function t(){var t="Black"===skinStatus?"-dark":"",o=blogStaticHost+"dist/pc/img/sideSearch.png";o="exp"!==sideToolbarResult?o:blogStaticHost+"dist/pc/img/toolbar/search"+t+".png";var n=document.referrer;if(n&&n.indexOf("so.csdn.net")>-1){var i=' 搜索 ';$(".csdn-side-toolbar").prepend(i);var a='