123 |
- 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"==typeof toolBar&&(toolBar.setPosX(),toolBar.computePositon())}function getRecommendListUrl(){var t=[[],[]];return $(".recommend-box div.recommend-item-box").each(function(e,o){if($(o).data("url")){var i=$(o).data("url").toLowerCase().split("://"),n=$(o).data("url").toLowerCase().split("article/details/");t[0].push(2==i.length?i[1]:i[0]),t[1].push(2==n.length?"article/details/"+n[1]:n[0])}}),t}function baidudatatemp(t,e){var o=highlight.map(function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")});o="("+o.join("|")+")";var i=new RegExp(o,"gi"),n=/<[^>]*>/g,a=t["abstract"].replace(n,"").replace(i,"<em>$1</em>"),s=t.dispTime.replace(/^(\d*)-/,""),c=t.linkUrl,r=t.title.replace(n,"").replace(i,"<em>$1</em>"),l='"extra":"{\\"utm_medium\\":\\"distribute.pc_relevant.none-task-blog-baidujs_'+baiduSearchType+"-"+e+'\\"}",',d='<div class="recommend-item-box baiduSearch clearfix" data-report-view=\'{"mod":"popu_387",'+l+'"spm":"1001.2101.3001.4242","dest":"'+c+'","strategy":"baidujs_'+baiduSearchType+'","ab":"new","index":"'+e+'"}\'>\t <div class="content-box">\t\t <div class="content-blog display-flex">\t\t\t <div class="title-box">\t\t\t\t <a href="'+c+'" target="_blank" data-report-click=\'{"mod":"popu_387",'+l+'"spm":"1001.2101.3001.4242","dest":"'+c+'","strategy":"baidujs_'+baiduSearchType+'","ab":"new","index":"'+e+'"}\' data-report-query="utm_medium=distribute.pc_relevant.none-task-blog-baidujs_'+baiduSearchType+"-"+e+'&spm=1001.2101.3001.4242">\t\t\t\t\t <div class="tit ellipsis-online ellipsis-online-1">'+r+'</div>\t\t\t\t </a>\t\t\t </div> <div class="info-box display-flex"> <div class="info display-flex"> <span class="info-block">'+s+'</span> </div> </div> </div> <div class="desc-box"> <a href="'+c+'" target="_blank" data-report-click=\'{"mod":"popu_387",'+l+'"spm":"1001.2101.3001.4242","dest":"'+c+'","strategy":"baidujs_'+baiduSearchType+'","ab":"new","index":"'+e+'"}\' data-report-query="utm_medium=distribute.pc_relevant.none-task-blog-baidujs_'+baiduSearchType+"-"+e+'&spm=1001.2101.3001.4242"> <div class="desc ellipsis-online ellipsis-online-1">'+a+"</div> </a> </div> </div> </div>";return d}function showResult(t){var e=[],o=recommendRegularDomainArr||["blog.csdn.net/.+/article/details/","download.csdn.net/download/","edu.csdn.net/course/detail/ "],i=new RegExp(o.join("|"));if(!t||t.length<=0)return!1;if(t&&t.length>0)for(var n=0;n<t.length;n++)if(t[n].linkUrl.split("?")[0].toLowerCase().indexOf(curentUrl.split("://")[1].toLowerCase())===-1&&i.test(t[n].linkUrl)&&""!==t[n].title){var a=t[n].linkUrl.split("?")[0].split("://"),s=2==a.length?a[1]:a[0],c=t[n].linkUrl.split("?")[0];2==s.split("article/details/").length&&(c="article/details/"+s.split("article/details/")[1]),$.inArray(s.toLowerCase(),getRecommendListUrl()[0])==-1&&$.inArray(c.toLowerCase(),getRecommendListUrl()[1])==-1&&n<10&&e.push(t[n])}var r=$(".insert-baidu-box").children().not("script").not("dl"),l="",d=0,m=0;(!baiduCount||baiduCount<=0)&&(baiduCount=2);for(var n=isBaiduPre?0:baiduCount;n<r.length;n+=baiduCount){for(var p=n;p<n+baiduCount;p++)(isBaiduPre?e[p]:e[p-baiduCount])&&(l+=baidudatatemp(isBaiduPre?e[p]:e[p-baiduCount],isBaiduPre?n+p:p+m*baiduCount));$(r[n]).length&&($(r[n]).after(l),m+=1),l="",d=m*baiduCount}if(d<e.length)for(var h=(isBaiduPre?2*m-1:2*m)*baiduCount+(r.length-1)%baiduCount,n=d;n<e.length;n++)$(".insert-baidu-box").append(baidudatatemp(e[n],h)),h+=1,d+=1}var ZeroClipboard={version:"1.0.7",clients:{},moviePath:"https://csdnimg.cn/public/highlighter/ZeroClipboard.swf",nextId:1,$:function(t){return"string"==typeof t&&(t=document.getElementById(t)),t.hide=function(){this.style.display="none"},t.show=function(){this.style.display="block"},t.addClass=function(t){this.removeClass(t),this.className+=" "+t},t.removeClass=function(t){for(var e=this.className.split(/\s+/),o=-1,i=0;i<e.length;i++)e[i]==t&&(o=i,i=e.length);return o>-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 i=this.clients[t];i&&i.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 i=99;this.domElement.style.zIndex&&(i=parseInt(this.domElement.style.zIndex,10)+1),"string"==typeof e?e=ZeroClipboard.$(e):"undefined"==typeof e&&(e=document.getElementsByTagName("body")[0]);var n=ZeroClipboard.getDOMObjectPosition(this.domElement,e);this.div=document.createElement("div");var a=this.div.style;if(a.position="absolute",a.left=""+n.left+"px",a.top=""+n.top+"px",a.width=""+n.width+"px",a.height=""+n.height+"px",a.zIndex=i,"object"==typeof o)for(addedStyle in o)a[addedStyle]=o[addedStyle];e.appendChild(this.div),this.div.innerHTML=this.getHTML(n.width,n.height)},getHTML:function(t,e){var o="",i="id="+this.id+"&width="+t+"&height="+e;if(navigator.userAgent.match(/MSIE/)){var n=location.href.match(/^https/i)?"https://":"http://";o+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+n+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+t+'" height="'+e+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+i+'"/><param name="wmode" value="transparent"/></object>'}else o+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+t+'" height="'+e+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+i+'" wmode="transparent" />';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 i=0,n=this.handlers[t].length;i<n;i++){var a=this.handlers[t][i];"function"==typeof a?a(this,e):"object"==typeof a&&2==a.length?a[0][a[1]](this,e):"string"==typeof a&&window[a](this,e)}}},$(document).ready(function(){$(".article_content pre").each(function(){var t=$(this);if(void 0!=t.attr("class")){if(t.attr("class").indexOf("brush:")!=-1){var e=t.attr("class").split(";")[0].split(":")[1];t.attr("name","code"),t.attr("class",e)}t.attr("class")&&t.attr("name","code")}}),$(".article_content textarea[name=code]").each(function(){var t=$(this);t.attr("class").indexOf(":")!=-1&&t.attr("class",t.attr("class").split(":")[0])}),window.clipboardData||setTimeout("setCopyBtn()",500)}),function(t){function e(t,e){var o=e-t+1;return Math.floor(Math.random()*o+t)}t.fn.extend({selection:function(){var e="",o=this[0];if(document.selection){var i=document.selection.createRange();e=i.text}else if("number"==typeof o.selectionStart){var n=o.selectionStart,a=o.selectionEnd;n!=a&&(e=o.value.substring(n,a))}return t.trim(e)},parseHtml:function(e){var o=this[0],i=t(this).val();if(document.selection){var n=document.selection.createRange();n.text?n.text=e:t(this).val(i+e)}else if("number"==typeof o.selectionStart){var a=o.selectionStart,s=o.selectionEnd,c=i.substring(0,a),r=i.substring(s);t(this).val(c+e+r)}else t(this).val(i+e);o.selectionStart=o.selectionEnd=t(this).val().length,o.focus()}});var o=t("div.pulllog-box");o.find("button.btn-close").click(function(){o.remove()}),o.find(".pulllog-login").click(function(t){getCookie("UserName")?window.location.reload():(window.csdn.loginBox.show(),t.preventDefault())});var i=function(e){var e=e?e:"body",o=t(e+" img"),i=navigator.userAgent.toLowerCase();return 0!==o.length&&(0===t(".imgViewDom").length&&(t("body").append('<div class="imgViewDom disnone" style="display: none;"><img src=""></div>'),t("body").append("<style>.imgViewDom{display:none;position:fixed;top:0;left:0;height:100%;width:100%;z-index:99999999;background: rgba(255, 255, 255,0.8);overflow: auto;display:-webkit-box;-webkit-box-align:center;-webkit-box-pack:center;display:-moz-box;-moz-box-align:center;-moz-box-pack:center;display:-o-box;-o-box-align:center;-o-box-pack:center;display:-ms-box;-ms-box-align:center;-ms-box-pack:center; display:box;box-align:center;box-pack:center;}.imgViewDom img{cursor: zoom-out;}</style>"),t(".imgViewDom").on("click",function(){i.indexOf("windows ")>-1?t("body").css({overflow:"auto","margin-left":"0"}):t("body").css({overflow:"auto"}),t(".imgViewDom").fadeOut(500).children("img").attr("src","")})),void o.bind("click",function(e){e.currentTarget.src&&(t(".imgViewDom").fadeIn(500).children("img").css({width:e.currentTarget.naturalWidth,height:e.currentTarget.naturalheight}).attr("src",e.currentTarget.src),i.indexOf("windows ")>-1?t("body").css({overflow:"hidden","margin-left":"-17px"}):t("body").css({overflow:"hidden"}))}))};window.CSDNviewImg=i,window.csdn=window.csdn||{},window.csdn.random_num=e}(jQuery),$(function(){function t(t){if(l&&c){var e=$(window).height(),o=$(document).scrollTop(),n=t.offset().top,a=t.height();n<o+e&&n+a>o&&(i(t),c=!1)}}function e(t){return'<a target="_blank" href="'+t.clickUrl+'"> <div class="ad-top"> <div class="ad-top-tit"> <span class="ad-top-topic">'+t.title+'</span> <span class="ad-top-type">'+t.titleRight+'</span> <span class="ad-top-num">'+t.topCenter+'</span> </div> <div class="ad-top-tag"> <span class="ad-top-count">'+t.topRightNumber+'</span> <span class="ad-top-text">'+t.topRight+'</span> </div> </div> <div class="ad-con"> <div class="ad-con-tit">'+t.introTitle+'</div> <div class="ad-con-box"> <span class="ad-con-txt">'+t.intro+'</span> <span class="ad-con-go">'+t.buttonText+"</span> </div> </div> </a>"}function o(o){if(o)var i={authorUserName:username,contentKey:articleTitle,pageSpm:JSON.parse(articleReport).spm,positions:542};else var i={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:i,xhrFields:{withCredentials:!0},success:function(i){200==i.code&&i.data.length?(l="articleContentAd",o?$("#content_views").append("<div id="+l+">"+e(i.data[0])+"</div>"):$(n[Math.floor(a/2)]).after("<div id="+l+">"+e(i.data[0])+"</div>"),r=i.data[0].exposureUrl,t($("#"+l))):l=""},error:function(t){l=""}})}function i(t){t.append('<img src="'+r+'" style="display:none;width:0px;height:0px" alt="">')}var n=$("#content_views").children(),a=n.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))})}),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 i=($(window).height(),$("div.article_content")),n=i.height();$("#btn-readmore").attr("height",o),n>2e3?(i.css({height:"2000px",overflow:"hidden"}),e.click(t)):e.parent().hide()}var o=$(".btn-readmore");$(".article-footer-bookmark-btn").click(window.csdn.articleCollection),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 i=window.location.hash,n=RegExp(/\#/);i.match(n)&&($(".btn-readmore").parent().hide(),$("div.article_content").removeAttr("style")),window.csdn=window.csdn?window.csdn:{},window.csdn.clearReadMoreBtn=t}(),$(function(){function t(){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.commentPagination=$("#commentPage"),this.commentLineBox="",this.commentTxt=$("#comment_replyId"),this.cancelBtn=$(".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.initTxt(),this.init(),this.firstLoad=!1,this.bindBtn(),this.bindTxt(),this.commentCode(),this.comment(),this.cancelBtnBindEvent(),this.getPagination=function(t){var e=function(e,o){if(e){o.pageCount=e.pageCount,o.commentCount=e.floorCount,o.commentPageObj.render({count:e.floorCount,current:t}),o.renderData(e.list);var i=$(".comment-box").offset().top-44;$(document).scrollTop(i)}};this.getData(t,e)},this.bindLikedClick()}function e(t){username===t.userName?isBloger='<img class="is_bloger" src="'+blogStaticHost+'dist/components/img/bloger@2x.png"/>':isBloger=""}function o(){$(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"),i=this,n={articleId:articleId,commentId:o};$.ajax({url:blogUrl+"phoenix/web/v1/comment/"+e,type:"post",dataType:"json",data:n,xhrFields:{withCredentials:!0},success:function(t){var e=$(i).find("span").text()?parseInt($(i).find("span").text()):0;if($(i).hasClass("liked")){var o=e-1;o=o>0?o:"",$(i).removeClass("liked"),$(i).find(".unclickImg").css("display","inline-block"),$(i).find(".clickedImg").css("display","none"),$(i).find("span").text(o).css("color","#999AAA")}else $(i).addClass("liked"),$(i).find(".unclickImg").css("display","none"),$(i).find(".clickedImg").css("display","inline-block"),$(i).find("span").text(e+1).css("color","#FC5531");$(i).parents(".right-box").children(".comment-like").html($(i).html()),$(".comment-like-img-hover").css("display","none")}})})}function i(t){var e="";return 0==t.length?"":(e=t.replace(/</g,"<"),e=e.replace(/>/g,">"))}function n(){currentUserName||csdn.loginBox.show()}function a(t){var e=window.location.href.split(t)[1];return null!=e?e:""}var s='<ul class="comment-list"> <li class="comment-line-box d-flex"> <div style="display: flex;width: 100%;"> <a target="_blank" href="'+blogUrl+username+'"> <img src="'+avatar+'" username="'+username+'" alt="'+username+'" class="avatar"> </a> <div class="right-box "><div class="new-info-box clearfix"> <a target="_blank" href="'+blogUrl+username+'"><span class="name ">'+nickName+'<img class="is_bloger" src="'+blogStaticHost+'dist/components/img/bloger@2x.png"></span></a><span class="colon">:</span><span class="floor-num"></span><span class="new-comment">这篇文章对你有帮助吗?作为一名程序工程师,在评论区留下你的困惑或你的见解,大家一起来交流吧!</span> </div></div></div></li></ul>',c='<img class="read-reply-img" src="'+blogStaticHost+'dist/pc/img/replyComment.png">';t.prototype.getData=function(t,e){var o=this;o.pageIndex=void 0!==t?t:o.pageIndex;var i=null;$.ajax({url:blogUrl+"phoenix/web/v1/comment/list/"+articleId+"?page="+o.pageIndex+"&size="+o.pageSize+"&commentId="+l,type:"post",xhrFields:{withCredentials:!0},success:function(t){200===t.code&&(i=t.data,i?(o.commentBox.show(),o.commentPagination.show(),o.curFloor=i.floorCount-(o.pageIndex-1)*o.pageSize,$(".comment-sofa-flag").remove()):(o.commentBox.hide(),o.commentPagination.hide()))},complete:function(){e&&e(i,o)}})},t.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(currentUserName||(o="登录 ",e.commentBox.css({overflow:"hidden"})),e.pageCount=t.pageCount,e.curFloor=t.floorCount,e.commentCount=t.floorCount,e.btnShowMore.html("<span>"+o+"查看 "+t.count+' 条热评</span><img class="look-more-comment" src="'+blogStaticHost+'dist/pc/img/arrowDownComment.png">'),e.renderData(t.list),currentUserName?(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"),e.showAll||e.countInitHeight()):t.floorCount<=3?(e.btnShowMore.parent("div.opt-box").remove(),e.commentBox.css("max-height","none"),e.showAll=!0):(t.floorCount<=e.pageSize?e.commentPagination.addClass("d-none"):0===$("#btnMoreComment").length&&e.commentPagination.removeClass("d-none"),e.showAll||e.countInitHeight()),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,i){e.getPagination(t)}})):e.commentPageObj.render({count:e.commentCount}),""!==l){var i=$("div.comment-list-box ul.comment-list:first-child").find("li.comment-line-box");$(i).each(function(t,e){if(l==$(e).data("commentid")){var o=$(e).parents("li.replay-box");o.length>0&&o.parent("ul.comment-list").find("a.btn-read-reply").trigger("click");var n=$(document).scrollTop(),a=$("#csdn-toolbar").height(),s=16;n<52&&(a=2*a);var c=$(i)[t].offsetTop-a-s;return setTimeout(function(){$("html,body").animate({scrollTop:c},200)},850),!1}})}}else e.btnShowMore.parent("div.opt-box").remove(),e.showAll=!0};commentscount||!this.firstLoad?this.getData(1,t):($(".comment-sofa-flag").show(),blogMoveHomeArticle&&(this.commentBox.append(s),this.btnShowMore.parent("div.opt-box").remove(),$(".comment-list-container").show()))},t.prototype.countInitHeight=function(){var t=this;t.curH=0,t.commentBox.find(">ul.comment-list:lt(3)").each(function(e){t.curH+=$(this).height()}),t.curH+=27,t.commentBox.css("max-height",t.curH)},t.prototype.initTxt=function(){var t=this;$("#comment_content").focus(function(){t.addId(t),t.commentCountObj.text(1e3-parseInt($(this).val().length)),t.cancelBtnToggle(!1),$(this).addClass("open"),t.commentLineBox.length>0&&t.commentLineBox.find(".comment-edit-box").remove(),$(".bt-comment-show").hide()}),$(document).click(function(e){$(e.target).is("div.comment-edit-box *")||$(e.target).is(".right_recommend_comment_button *")||$(e.target).is(".reply")||($("#comment_content").removeClass("open"),$(".bt-comment-show").show(),$(".comment-emoticon-box").hide(),$(".comment-emoticon-img").attr("src",$(".comment-emoticon-img").data("url")+"emoticon.png"),t.commentCountObj.text(t.commentFontLimit))}),$(document).click(function(t){$(t.target).is(".comment-line-box *")||$("#commentEditBox").remove()}),$(".bt-comment-show").click(function(){$(this).hide(),t.txtComment.addClass("open")}),$(".tool-item-comment").click(function(){setTimeout(function(){$(".bt-comment-show").hide(),$("#comment_content").addClass("open")},0)})},t.prototype.bindBtn=function(){function t(t){return"svg"===this.nodeName||currentUserName?(e.commentBox.css("max-height","none"),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;e.commentBox.click(function(t){var o=$(t.target).data("type");if(void 0!==o)switch(o){case"report":window.csdn.userLogin.loadAjax(function(t){showReport(!0)});break;case"readreply":var i=$(t.target).parents("li").siblings("li.replay-box");$(t.target).hasClass("open")?($(t.target).removeClass("open"),$(t.target).html(c+$(t.target).data("count")),i.hide(),e.curH&&e.commentBox.css("max-height",e.curH)):($(t.target).addClass("open").data("txt",$(t.target).text()),$(t.target).html(c+"收起评论"),i.show(),e.curH&&e.commentBox.css("max-height",e.curH+i.height()+10));break;case"delete":var n=$(t.target).parents("li.comment-line-box"),a=n.data("commentid");e.deleteComment(a)}}),this.btnShowMore.click(t),this.btnShowMore.find("svg").click(t),$(document).on("click",".show_loginbox",function(){if(e.setStorage()){var t=getCookie("UserName"),o=blogUrl+t;window.open(o,"_blank")}})},t.prototype.bindTxt=function(){var t=this;this.txtComment.blur(function(){}),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)})},t.prototype.renderData=function(t){var e=this,o="";if(1==$("#rightBox").data("type"))var o='<span class="tip">评论将由博主筛选后显示,对所有人可见 |</span>';var i='<div class="comment-edit-box d-flex" id="commentEditBox"><a id="commentseditNew"></a><div class="user-img"><a href="'+$(".comment-edit-box .user-img a").attr("href")+'" target="_blank" rel="noopener"><img class="" src="'+$(".comment-edit-box .user-img a img").attr("src")+'"></a></div><form id="commentformNew"><textarea class="comment-content open" name="comment_content" id="comment_contentNew" placeholder="优质评论可以帮助作者获得更高权重" maxlength="1000"></textarea><div class="comment-emoticon comment-emoticon-new"><img class="comment-emoticon-img" data-url="'+blogStaticHost+'dist/pc/img/" src="'+blogStaticHost+'dist/pc/img/emoticon.png" alt="表情包"></div><span class="comment-emoticon-tip">插入表情</span><div class="opt-box"> <!-- d-flex --><div id="ubbtools" class="add_code"><a href="#insertcode" code="code" target="_self"><i class="icon iconfont icon-daima"></i></a></div><input type="hidden" id="comment_replyIdNew" name="comment_replyIdNew"><input type="hidden" id="article_idNew" name="article_idNew" value="'+$("#article_id").val()+'" ><input type="hidden" id="comment_userIdNew" name="comment_userIdNew" value=""><input type="hidden" id="commentIdNew" name="commentIdNew" value=""><div class="dropdown" id="myDrap"><a class="dropdown-face d-flex align-items-center" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><div class="txt-selected text-truncate">添加代码片</div><svg class="icon d-block" width="200px" height="100.00px" viewBox="0 0 2048 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M597.33333292 298.666667h853.333334L1023.99999992 725.333333 597.33333292 298.666667z" /></svg></a><ul class="dropdown-menu" id="commentCodeNew" aria-labelledby="drop4"><li><a data-code="html">HTML/XML</a></li><li><a data-code="objc">objective-c</a></li><li><a data-code="ruby">Ruby</a></li><li><a data-code="php">PHP</a></li><li><a data-code="csharp">C</a></li><li><a data-code="cpp">C++</a></li><li><a data-code="javascript">JavaScript</a></li><li><a data-code="python">Python</a></li><li><a data-code="java">Java</a></li><li><a data-code="css">CSS</a></li><li><a data-code="sql">SQL</a></li><li><a data-code="plain">其它</a></li></ul></div> <div class="right-box right-box-new">'+o+'<span id="tip_comment" class="tip">还能输入<em>1000</em>个字符</span><input type="button" class="btn btn-sm btn-cancel" id="closeNew" value="取消回复"><a ><input type="submit" class="btn btn-sm btn-comment" value="发表评论"></a></div></div></form></div>';this.commentBox.html(""),blogMoveHomeArticle&&1==this.pageIndex&&this.commentBox.append(s);for(var n='<ul class="comment-list">',a=0;a<t.length;a++){var c=t[a].info,r=t[a].sub,l=void 0!==r?r.length:0,n='<ul class="comment-list">';if(n+=this.buildHtml(c,l,!0,c.userName?c.userName:""),l>0){n+='<li class="replay-box" style="display:block">',n+='<ul class="comment-list">';for(var d=0;d<l;d++){var m=r[d];null!==m&&(n+=this.buildHtml(m,0,!1,m.parentUserName?m.parentUserName:""))}n+="</ul>",n+="</li>"}n+="</ul>",this.commentBox.append($(n)),$(".comment-list-container").show(),this.curFloor--}$(".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(currentUserName){currentUserName&&($(this).append(i),$("#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 o=$(document).scrollTop(),n=$("#csdn-toolbar").height();o<52&&(n=2*n)}else csdn.loginBox.show();e.commentLineBox=$(this)}}),$("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")})},t.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"))};var r="";t.prototype.buildHtml=function(t,o,i,n){var a="",s="",c="",l="";if(i){r=n;var d=this.getQuoteInfo(t.content);d.length>1?(c=d[1],l=this.getCodeInfo(d[2]),l=this.replaceNewUBB(l),a=this.getCodeInfo(d[3]),a=this.replaceNewUBB(a),a='<span class="quote">引用“<font color="black">'+c+"</font>”的评论:</span><blockquote>"+l+"</blockquote>"+a):(a=this.replaceNewUBB(d[0]),a=this.getCodeInfo(a))}else{var d=this.getReplyInfo(t.content);s=d[1];var m=d.length>2?this.getQuoteInfo(d[2]):this.getQuoteInfo(d[0]);m.length>1?(c=m[1],l=this.getCodeInfo(m[2]),l=this.replaceNewUBB(l),a=this.getCodeInfo(m[3]),a=this.replaceNewUBB(a),a='<span class="quote">引用“<font color="black">'+c+"</font>”的评论:</span><blockquote>"+l+"</blockquote>"+a):(a=this.replaceNewUBB(m[0]),a=this.getCodeInfo(a))}if(t.tag){var p="https://blog.csdn.net/blogdevteam/article/details/103478461",h='<a class="comment-tag" target="_blank" href="'+p+'">'+t.tag+'<img class="comment-tag-img" src="'+blogStaticHost+"dist/components/img/commentTagArrow"+skinStatus+'.png" title="'+t.tag+'"></a>';u=t.parentTag?'<a class="comment-tag" target="_blank" href="'+p+'">'+t.parentTag+'<img class="comment-tag-img" src="'+blogStaticHost+"dist/components/img/commentTagArrow"+skinStatus+'.png" title="'+t.parentTag+'"></a>':""}else var h="",u="";e(t);var f="匿名用户"!=t.userName?blogUrl+t.userName:"javascript:void(0);",g='<li class="comment-line-box d-flex" data-commentid="'+t.commentId+'" data-replyname="'+t.userName+'"><div style="display: flex;width: 100%;"> <a target="_blank" href="'+f+'"><img src="'+t.avatar+'" username="'+t.userName+'" alt="'+t.userName+'" class="avatar"></a> <div class="right-box '+(s?"reply-box":"")+'" > <div class="new-info-box clearfix" > '+h+'<a target="_blank" href="'+f+'"><span class="name '+(i?"":"mr-8")+'">'+(i?t.nickName+isBloger+"</span></a>":t.nickName+isBloger+'</span></a><span class="text">回复</span>'+(r===t.parentUserName?"":u+'<span class="nick-name">'+(t.parentNickName?t.parentNickName:"")))+'</span><span class="colon">:</span>'+(i?'<span class="floor-num"></span>':'<span class="text" ></span>')+'<span class="new-comment">'+a+'</span><span class="date" title="'+t.postTime+'">'+t.dateFormat+'</span><span class="new-opt-floating"><a class="btn-bt btn-reply" data-type="reply" data-flag="true">回复</a>'+(isOwner||currentUserName===t.userName?'<a class="btn-bt btn-delete" data-type="delete">删除</a>':"")+'<a class="btn-bt btn-report"><img class="btn-report-img" src="'+blogStaticHost+'dist/pc/img/commentMore.png" title=""><span data-type="report" class="hide-report">举报</span></a></span></div><div class="comment-like '+(t.diggArr.indexOf(currentUserName)!=-1?"liked":"")+'" data-commentid='+t.commentId+' ><img class="comment-like-img unclickImg" src="'+blogStaticHost+'dist/pc/img/commentUnHeart.png" title="点赞"><img class="comment-like-img comment-like-img-hover" style="display:none" src="'+blogStaticHost+'dist/pc/img/commentActiveHeart.png" title="点赞"><img class="comment-like-img clickedImg" src="'+blogStaticHost+'dist/pc/img/commentActiveHeart.png" title="点赞">'+(0!==parseInt(t.digg)?"<span>"+t.digg+"</span>":"<span></span>")+"</div></div></div></li>";
- return g},t.prototype.getReplyInfo=function(t){var e=t.split(/\[reply]([\s\S]*?)\[\/reply\][\r\n]{0,1}/gi);return e},t.prototype.getQuoteInfo=function(t){var e=t.split(/\[quote=([\w#\.]+)\]([\s\S]*?)\[\/quote\][\r\n]{0,2}/gi);return e},t.prototype.getCodeInfo=function(t){var e=t.replace(/\[code=([\w#\.]+)\]([\s\S]*?)\[\/code\]/gi,function(t,e,o){return""==$.trim(o)?"":'<pre name="code2" class="code2 '+e+'"><code>'+i(o.trim())+"</code></pre>"});return e},t.prototype.replaceNewUBB=function(t){return t=t.replace(/\[face\]([^\]]+):([^\]]+)\[\/face\]/gi,'<img src="//g.csdnimg.cn/static/face/$1/$2" alt="表情包"/>')},t.prototype.replayComment=function(t){var e=t.Id,o=t.User;this.txtComment.attr("placeholder","回复:"+t.text).data("replayUser",o),this.commentTxt.val(e)},t.prototype.commentCode=function(){var t=this;this.commtCode.find("a").click(function(){var e="[code="+$(this).data("code")+"]\n\n[/code]",o=t.txtComment.val();t.txtComment.val(o+e)})},t.prototype.comment=function(){function t(t){if(!currentUserName)return e.setStorage();window.localStorage.removeItem("AM_comment_data");var o=$(t).find(":submit"),i={commentId:e.commentTxt.val(),content:e.txtComment.val(),articleId:articleId};if(i.replyId&&$.trim(i.content)&&(i.content="[reply]"+e.txtComment.data("replayUser")+"[/reply]"+i.content),""===$.trim(i.content))showToast({text:"请填写评论内容",bottom:"10%",zindex:9e3,speed:500,time:1500});else{var n=blogUrl+"phoenix/web/v1/comment/submit";$.ajax({url:n,type:"post",dataType:"json",data:i,xhrFields:{withCredentials:!0},beforeSend:function(){o.prop("disabled",!0).val("提交中")},success:function(t){200===t.code?(e.commentForm.trigger("reset"),e.commentTxt.val(""),e.txtComment.data("replayUser","").attr("placeholder","想对作者说点什么"),e.cancelBtnToggle(!1),l=t.data,e.init(),e.removeStorage(),showToast({text:"评论成功,审核后显示",bottom:"10%",zindex:9e3,speed:500,time:1500})):showToast({text:t.message,bottom:"10%",zindex:9e3,speed:500,time:1500})},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.userLogin.loadAjax(function(e){t(o)})}catch(i){t(o)}})},t.prototype.deleteComment=function(t){var e=this,o=$("#article_id").val();if(confirm("你确定要删除这篇评论吗?")){var i=blogUrl+"phoenix/web/v1/comment/delete",n={commentId:t,articleId:o};$.ajax({url:i,type:"post",dataType:"json",data:n,xhrFields:{withCredentials:!0},success:function(t){200===t.code?e.commentPageObj.go(e.pageIndex):showToast({text:"删除失败,请重新操作!",bottom:"10%",zindex:9e3,speed:500,time:1500})}})}},t.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('<div class="right_recommend_comment_Prompt"><div class="text">新的评论在这里</div><div class="arrow"></div></div>'),setTimeout(function(){$(".right_recommend_comment_Prompt").fadeOut(500)},4e3)},t.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)},t.prototype.removeStorage=function(){window.localStorage.removeItem("AM_comment_data"),window.localStorage.removeItem("AM_comment_replyId"),window.localStorage.removeItem("AM_comment_id")},t.prototype.bindLikedClick=o,t.prototype.cancelBtnToggle=function(t){t?this.cancelBtn.removeClass("d-none"):this.cancelBtn.addClass("d-none")},t.prototype.cancelBtnBindEvent=function(){var t=this;this.cancelBtn.on("click",function(){t.txtComment.attr("placeholder","想对作者说点什么").data("replayUser","").val(""),t.commentTxt.val(""),t.cancelBtnToggle(!1)})},$(document).on("click",".comment-emoticon",function(t){if(currentUserName){var e=$(this).find(".comment-emoticon-img").data("url");$(this).is(".comment-emoticon-new")?$(this).siblings(".comment-emoticon-tip").after('<div class="comment-emoticon-box comment-emoticon-box-new">'+$("#commentform .comment-emoticon-box").html()+"</div>"):$("#comment_content").focus(),$(this).siblings(".comment-content").addClass("open"),$(this).siblings(".comment-content").is(".open")?$(this).find(".comment-emoticon-img").attr("src",e+"emoticonClick.png"):$(this).find(".comment-emoticon-img").attr("src",e+"emoticon.png"),$(this).siblings(".comment-emoticon-box").fadeIn()}else csdn.loginBox.show()}),$(document).on("click",".emoticon-monkey-img",function(t){var e=$(this).data("emoticon");$(this).parents(".comment-emoticon-box").is(".comment-emoticon-box-new")?$("#comment_contentNew").val($("#comment_contentNew").val()+e):$("#comment_content").val($("#comment_content").val()+e),$(this).parents(".comment-emoticon-box").fadeOut()}),$(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("focus","#comment_content",n);var l=a("#comments_");window.csdn.comments?window.csdn.comments:{},window.csdn.Comments=t,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:"CC 4.0 BY-SA";var o="\r\n————————————————\r\n版权声明:本文为CSDN博主「"+nickName+"」的原创文章,遵循"+e+"版权协议,转载请附上原文出处链接及本声明。\r\n原文链接:"+curentUrl;csdn.copyright.init(t,o)}}),$(function(){function t(t,o){if(!(o.length<2)){var i="";i+="<ol>";for(var n=0,a=0,s=0,c=0,r=0,l=0;l<o.length;l++){var d=parseInt(o[l].tagName.substr(1),10);if(n||(n=d),d>n?(i+='<li class="sub-box"><ol>',a++):d<n&&a>0&&(i+="</ol></li>",a--),1==d)for(;a>0;)i+="</ol>",a--;n=d;var m=o.eq(l).text();if(m=/^[\s]+$/.test(m)?m:m.replace(/^[\s]+/g,""),m=e(m),m.length>0)switch(d){case 1:++s,c=0,r=0;var p="";1===s&&(p="active"),i+="<li class="+p+'><a href="#t'+l+'">'+m+"</a></li>",o.eq(l).html('<a name="t'+l+'"></a>'+o.eq(l).html());break;case 2:++c,r=0,i+='<li><a href="#t'+l+'">'+m+"</a></li>",o.eq(l).html('<a name="t'+l+'"></a>'+o.eq(l).html());break;case 3:++r,i+='<li><a href="#t'+l+'">'+m+"</a></li>",o.eq(l).html('<a name="t'+l+'"></a>'+o.eq(l).html())}}for(;a>0;)i+="</ol>",a--;return i}}function e(t){return t.replace(/[<>&"]/g,function(t){return{"<":"<",">":">","&":"&",'"':"""}[t]})}function o(t){function e(t){return $(t).each(function(t,i){i.children&&e(i.children),++o}),o}var o=0;return e(t)}function i(t,e,o){var i=$("div.groupfile"),n=i.find("div.toc-box"),a=i.find("div.opt-box");if(e<=2&&$("#liTocBox").remove(),e>2&&"0"==d&&$("#liTocBox").css("display","block"),e<=2&&"1"==d&&$(".groupfile").remove(),e<=2&&($("#blog_artical_directory").hide(),$(".left_menu .menu_con").hide()),!$(".first_li")[0]){n.html(o(t,m)),s(e,a,n);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 n(){var t=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;t+=10;for(var e=0;e<u.length-1;e++){if(t<=u[0]){var o="#"+$(h[0]).find("a")[0].name,i=$("#groupfile").find('a[href="'+o+'"]')[0],n=$("#directory").find('a[href="'+o+'"]')[0];$(i).parent().addClass("active"),$(n).parent().addClass("active")}if(u[e]<=t&&t<=u[e+1]){var o="#"+$(h[e]).find("a")[0].name,i=$("#groupfile").find('a[href="'+o+'"]')[0],n=$("#directory").find('a[href="'+o+'"]')[0];$(i).parent().addClass("active"),$(n).parent().addClass("active"),$(i).length&&$("#groupfile .align-items-stretch").animate({scrollTop:$(i)[0].offsetTop+"px"},0),$(n).length&&$("#directory .align-items-stretch").animate({scrollTop:$(n)[0].offsetTop+"px"},0)}}}function a(){var t=$("#csdn-toolbar").height()+8;b+$(document).scrollTop()-($("#recommend-right").height()+$("#csdn-toolbar").height()+8)>=180?$("#recommend-right").css({position:"fixed",top:t}):$("#recommend-right").removeAttr("style"),0==$(document).scrollTop()&&$("#recommend-right").removeAttr("style")}function s(t,e,o){if(t>9){var i=25*$("div.toc-box").find("li:not(.sub-box)").length,n=225,a=i-n,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="<ol>";return $(t).each(function(t,o){e+=l(o,t)}),e+"</ol>"}function l(t,e){return t.children.length?"<li><a>"+t.title+'</a></li><li class="sub-box">'+r(t.children)+"</li>":"<li><a>"+t.title+"</a></li>"}for(var d=1,m=$("#article_content").find("h1,h2,h3"),p=0;p<m.length;p++)m.eq(p).html('<a name="t'+p+'"></a>'+m.eq(p).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&&(i(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}),""===String($(".groupfile .toc-box").text()).replace(/(^\s*)|(\s*$)/g,"")?($("#asidedirectory").remove(),$("#groupfile").remove()):$("#groupfile").show())}}):(i("",m.length,t),c(),""===String($(".groupfile .toc-box").text()).replace(/(^\s*)|(\s*$)/g,"")?($("#asidedirectory").remove(),$("#groupfile").remove()):$("#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"),u=[],f=$("#content_views").offset().top,g=$("#content_views").height(),v=$("#csdn-toolbar").height();$(h).each(function(t,e){u.push($(e)[0].offsetTop+f-2*v)}),u.push(g+f),$(window).scroll(function(){$(".groupfile .toc-box li").removeClass("active"),n()}),n(),$(document).on("click",".groupfile .toc-box li a",function(t){$(".groupfile .toc-box li").removeClass("active"),$(this).parent().addClass("active")}),$(window).resize(function(){});var b=document.body.clientHeight||document.documentElement.clientHeight;if($("#groupfile").css("max-height",b/2+"px"),$(".groupfile-div").css("max-height",b/2+"px"),$(document).scroll(function(){a()}),a(),$(".hide-article-box").length&&"none"!==$(".hide-article-box").css("display")){for(var w=$(".hide-article-box").offset().top,x=0,y=0;y<u.length-1;y++)u[y]<=w&&w<=u[y+1]&&(x=y+1);var C=h.slice(x,h.length);$(".vip_article")[0]&&$(document).click(".groupfile .toc-box ol a",function(t){if(parseInt($(t.target)[0].hash.split("#t")[1])>x){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"),e=t.length,o=$('.htmledit_views p[id*="-toc"]').slice(1);o.each(function(t,o){$(o).attr("id",""),e>0?($(o).find("a").attr("href","#t"+e),e++):$(o).find("a").attr("href","#t"+t)}),$(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=$(this.hash);if(o=o.length&&o||$("[name="+this.hash.slice(1)+"]"),o.length){var i=o.offset().top;return $("html,body").animate({scrollTop:i-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(){var t=$('#article_content a[href^="#"]');t.each(function(t){$(this).attr("target","_self")})}),$(function(){function t(){function t(){$("#publicPrompt").remove(),$(document).off("click",".publicPrompt-close",t),$(document).off("click",".publicPrompt-mask",t)}var e={success:'<svg class="icon success" aria-hidden="true"><use xlink:href="#csdnc-check"></use></svg>'};this.data={},this.data.status="success",this.data.titleStr="收藏成功",this.data.textStr='已收藏至 <a href="https://i.csdn.net/#/uc/favorite-list" target="_blank">个人中心</a>',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='<div id="publicPrompt"><div class="publicPrompt-mask"></div><div class="publicPrompt-content"><div class="publicPrompt-title-box"><h3 class="publicPrompt-title">'+e[t.status]+t.titleStr+'</h3><span class="publicPrompt-close"><svg class="icon" aria-hidden="true"><use xlink:href="#csdnc-times"></use></svg></span><div class="publicPrompt-text">'+t.textStr+'</div><img class="publicPrompt-qr" src="'+t.imgUrl+'" alt=""><div class="publicPrompt-footer-text">下载APP随时查看</div></div></div></div>';$("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,n="",a=""}function o(t){showToast({text:t,bottom:"10%",zindex:9999,speed:500,time:1500})}var i=' <div class="report-box"> <div class="pos-boxer"> <div class="pos-content"> <div class="box-title"> <p>举报</p> <svg class="icon btn-close" aria-hidden="true"> <use xlink:href="#csdnc-times"></use> </svg> </div> <div class="box-header"> <div class="box-top"><span>选择你想要举报的内容(必选)</span></div> <div class="box-botoom"> <ul> <li data="1" type="nei">内容涉黄</li> <li data="2" type="nei">政治相关</li> <li data="3" type="nei">内容抄袭</li> <li data="4" type="nei">涉嫌广告</li> <li data="5" type="nei">内容侵权</li> <li data="6" type="nei">侮辱谩骂</li> <li data="8" type="nei">样式问题</li> <li data="7" type="nei">其他</li> </ul> </div> </div> <div> <div class="box-content" > </div> <div class="box-content" > </div> <div class="box-content" style="display:none;"> <div class="box-content-top"> <span>原文链接(必填)</span> </div> <div class="box-content-bottom" style="padding-bottom: 16px;"> <div class="box-input" style="height: 32px;line-height: 32px;"> <input class="content-input" type="text" id="originalurl" name="originalurl" placeholder="请输入被侵权原文链接"> </div> </div> </div> <div class="box-content" > </div> <div class="box-content" style="display:none;"> <div class="box-content-top"> <span>请选择具体原因(必选)</span> </div> <div class="box-content-bottom"> <ul> <li sub_type="1">包含不实信息</li> <li sub_type="2">涉及个人隐私</li> </ul> </div> </div> <div class="box-content" style="display:none;"> <div class="box-content-top"> <span>请选择具体原因(必选)</span> </div> <div class="box-content-bottom"> <ul> <li sub_type="1">侮辱谩骂</li> <li sub_type="2">诽谤</li> </ul> </div> </div> <div class="box-content" style="display:none;"> <div class="box-content-top"> <span>请选择具体原因(必选)</span> </div> <div class="box-content-bottom"> <ul> <li sub_type="1">搬家样式</li> <li sub_type="2">博文样式</li> </ul> </div> </div> <div class="box-content" style="display:none;"> </div> </div> <div id="cllcont" style="display:none;"> <div class="box-content-top"> <span class="box-content-span">补充说明(选填)</span> </div> <div class="box-content-bottom"> <div class="box-input" > <textarea class="ipt ipt-textarea" style="padding:0;" name="description" placeholder="请详细描述您的举报内容"></textarea> </div> </div> </div> </div> <div class="pos-footer"> <p class="btn-close">取消</p> <p class="box-active">确定</p> </div> </div></div>';$("body").append(i);var n="",a="";$(".box-botoom ul li").on("click",function(){flag=!1,$(this).addClass("box-active").siblings().removeClass("box-active"),n=$(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 h="";$(".box-active").on("click",function(){if(!n)return o("请选择你想要举报的内容!"),!1;switch(n){case"3":if(h=$("#originalurl").val(),""==h||"http://"==h)return o("举报抄袭必须提供原创文章地址!"),$("#originalurl").focus(),!1;break;case"7":if(h=d.val(),!h)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:n,originalUrl:h,description:d.val()},i=m?"report-comment":"report-article";$.ajax({url:blogUrl+"/phoenix/web/v1/"+i,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,n="",a="",h="",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 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(){function t(t,e,i){var n=new Date,a=(n.getTime(),o(n,i)),s=new Date;s.setTime(a),document.cookie=t+"="+e+";expires="+s.toGMTString()+";domain=.csdn.net;path=/"}function e(t){return document.cookie.length>0&&(c_start=document.cookie.indexOf(t+"="),c_start!=-1)?(c_start=c_start+t.length+1,c_end=document.cookie.indexOf(";",c_start),c_end==-1&&(c_end=document.cookie.length),unescape(document.cookie.substring(c_start,c_end))):null}function o(t,e){var o=e.split(":"),i=parseInt(o[0]),n=parseInt(o[1]),a=parseInt(o[2]);t.setHours(i),t.setMinutes(n),t.setSeconds(a);var s=Date.parse(t);return s}var i=$("#overTheScreen"),n=$(".over-the-screen-close");!currentUserName&&showPcWindowAd&&(e("over_the_screen")||(i.fadeIn(),setTimeout(function(){n.fadeIn()},500),t("over_the_screen",(new Date).getTime(),"24:00:00"))),$(".over-the-screen-close").on("click",function(){i.fadeOut()}),document.addEventListener("visibilitychange",function(){i.fadeOut()},!1)}),window.csdn.insertcallbackBlock=computePos,$(function(){function t(){var t=document.referrer;if(t&&t.indexOf("so.csdn.net")>-1){var i='<a class="option-box search" data-type="search"> <img src="'+blogStaticHost+'dist/pc/img/sideSearch.png" alt="" srcset=""> <span class="show-txt">搜索</span> </a>';$(".csdn-side-toolbar").prepend(i);var n='<div class="side-search-box"><div class="side-search-content"> <span class="search-txt">'+o+'</span><span class="search-bt no" data-type="no">否</span><span class="search-bt yes" data-type="yes">是</span> </div><div>';if($(".csdn-side-toolbar .search").append(n),!getCookie("referrer_search")){var a=0;timer=setInterval(function(){a++,3==a&&$(".side-search-box").fadeIn(1500),7==a&&($(".side-search-box").fadeOut(1500),clearInterval(timer))},1e3),e("referrer_search",(new Date).getTime())}$(".csdn-side-toolbar .search").on("click",function(t){getCookie("referrer_search")||clearInterval(timer),window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({spm:"1001.2101.3001.5543",dest:articleDetailUrl,extend1:o}),$(".side-search-box").fadeIn(500),setTimeout(function(){$(".side-search-box").fadeOut(1500)},1e4)}),$(".side-search-box .search-bt").on("click",function(t){getCookie("referrer_search")||clearInterval(timer);var e="";e="yes"===$(t.target).data("type")?"yes":"no",window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&(window.csdn.report.reportClick({spm:"1001.2101.3001.5543",dest:articleDetailUrl,extend1:o,ab:e}),t.stopPropagation()),$(".side-search-box .side-search-content").html("感谢您的反馈!").css({width:"92px"}),setTimeout(function(){$(".csdn-side-toolbar .search").fadeOut(800,function(){$(this).remove()})},1e3)})}}function e(t,e){var o=2,i=new Date;i.setTime(i.getTime()+36e5*o),document.cookie=t+"="+escape(e)+";expires="+i.toGMTString()+";domain=.csdn.net;path=/"}getSideToolbarTime=setInterval(function(){$(".csdn-side-toolbar").length>0&&(clearInterval(getSideToolbarTime),t())},1e3);var o="此内容解决你搜索的问题?";"control"===showSearchText&&(o="此内容是您要找的内容?"),"secondText"===showSearchText&&(o="此内容解决你搜索的问题?")}),$("#recommend-item-box-tow").children().length<=0&&$("#recommend-item-box-tow").remove(),baiduKey&&(csdn.afterCasInit=function(t,e){return!!t&&void csdn.baiduSearch(t,function(t){needInsertBaidu&&isRecommendModule&&showResult(t)})}),$(function(){function t(t,e){e?(t.find("img.isactive").show(),t.find("img.isdefault").hide(),t.attr("data-flag","true"),t.find("span.name")[0].style="color:#FC5531;"):(t.find("img.isactive").hide(),t.find("img.isdefault").show(),t.attr("data-flag",""),t.find("span.name")[0].style="")}function e(){var t=$("#toolBarBox").offset().top,e=$("#toolBarBox").offset().left,o=$(".left-toolbox").height(),i=$("#toolBarBox").width(),n=window.innerHeight,a=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;t+o-n-a>0?($("#toolBarBox .left-toolbox").css({position:"fixed",left:e+"px",bottom:"0",width:i+"px"}),$("#toolBarBox").addClass("more-toolbox-active")):($("#toolBarBox .left-toolbox").css({position:"relative",left:"0px",bottom:"0",width:i+"px"}),$("#toolBarBox").removeClass("more-toolbox-active"))}function o(){new QRCode(document.getElementById("shareCode"),{text:share_card_url+"&utm_source=po_popup",width:144,height:144,colorDark:"#000000",colorLight:"#ffffff",correctLevel:QRCode.CorrectLevel.H})}function i(t,e){if(x.skinBoxshadow.html(""),t){var o='<div class="reward-success reward-tip"> <svg t="1513153231313" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4182" id="mx_n_1513153231314" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><defs><style type="text/css"></style></defs><path d="M512 0C228.8 0 0 228.8 0 512s228.8 512 512 512 512-228.8 512-512S795.2 0 512 0z m244.8 392L467.2 691.2c-8 9.6-24 12.8-36.8 12.8-12.8 0-27.2-3.2-36.8-12.8L267.2 560c-16-16-16-43.2 0-59.2s41.6-16 57.6 0l105.6 110.4 267.2-278.4c16-16 41.6-16 57.6 0s16 43.2 1.6 59.2z" p-id="4183" fill=""></path></svg> <span>'+e+"</span> </div>";x.skinBoxshadow.append(o)}else{var i='<div class="reward-error reward-tip"> <svg t="1513590447537" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9504" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><defs><style type="text/css"></style></defs><path d="M512 0C228.8 0 0 228.8 0 512s228.8 512 512 512 512-228.8 512-512S795.2 0 512 0z m0 832c-35.2 0-64-28.8-64-64s28.8-64 64-64 64 28.8 64 64-28.8 64-64 64z m64-320c0 35.2-28.8 64-64 64s-64-28.8-64-64V256c0-35.2 28.8-64 64-64s64 28.8 64 64v256z" p-id="9505" fill=""></path></svg> <span>'+e+"</span> </div>";x.skinBoxshadow.append(i)}x.skinBoxshadow.fadeIn(200),setTimeout(function(){x.skinBoxshadow.fadeOut(200),x.skinBoxshadow.html("")},1500)}function n(t){getCookie("UserName")?$.ajax({url:blogUrl+"/phoenix/web/v1/article/like",type:"post",dataType:"json",data:{articleId:articleId},xhrFields:{withCredentials:!0},success:function(t){if(200==t.code){if(t.data.status)$("#is-like-img").hide(),$("#is-like-imgactive").show(),$("#is-like-span").text("已赞"),$("#is-like-span")[0].style="color:#fc5531 !important;",$("#spanCount")[0].style="color:#fc5531 !important;",window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({mod:"1582594662_001",spm:"1001.2101.3001.4241",dest:"",extend1:'{"praise":1}'});else{$("#is-like-imgactive").hide(),$("#is-like-img").show(),$("#is-like-span").text("点赞");var e="color:#555666 !important;";"Black"===skinStatus&&(e="color:#ccccd8 !important;"),$("#is-like-span")[0].style=e,$("#spanCount")[0].style=e,window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({mod:"1582594662_001",spm:"1001.2101.3001.4241",dest:"",extend1:'{"praise":0}'})}$("#spanCount").text(t.data.like_num>0?t.data.like_num:"")}else i(!1,t.message);u()}}):window.csdn.loginBox.show()}function a(){window.csdn.userLogin.loadAjax(function(t){$.ajax({url:blogUrl+"/phoenix/web/v1/collect",dataType:"json",type:"POST",xhrFields:{withCredentials:!0},data:{articleId:articleId},success:function(t){200===t.code&&s(t.data.status)},error:function(){}})})}function s(t){t?($("#is-collection-imgactive").show(),$("#is-collection-img").hide(),$("#is-collection").text("已收藏"),$("#blog_detail_zk_collection .un-collect-status").hide(),$("#blog_detail_zk_collection .collect-status").show(),$("#blog_detail_zk_collection span.name").text("已收藏"),w&&(w=!1,$(".get-collection").text()?$(".get-collection").text(1*$("#get-collection").text()+1):$(".get-collection").text("1"))):($("#is-collection-imgactive").hide(),$("#is-collection-img").show(),$("#is-collection").text("收藏"),$("#blog_detail_zk_collection .un-collect-status").show(),$("#blog_detail_zk_collection .collect-status").hide(),$("#blog_detail_zk_collection span.name").text("收藏"),w=!0,$(".get-collection").text()?1*$("#get-collection").text()-1<=0?$(".get-collection").text(""):$(".get-collection").text(1*$("#get-collection").text()-1):$(".get-collection").text("")),u()}function c(){getCookie("UserName")?window.csdn.collectionBox.show(window.csdn.collectionBox.params):window.csdn.loginBox.show()}function r(){if(getCookie("UserName")){var t=articleDetailUrl.split("/article/details/")[1];$.ajax({url:blogUrl+"phoenix/web/v1/isCollect",type:"GET",xhrFields:{withCredentials:!0},data:{articleId:t},success:function(t){200==t.code&&t.data.status?($("#is-collection-img").hide(),$("#is-collection-imgactive").show(),$("#is-collection").text("已收藏"),$("#blog_detail_zk_collection .un-collect-status").hide(),$("#blog_detail_zk_collection .collect-status").show(),$("#blog_detail_zk_collection span.name").text("已收藏"),w=!1):($("#is-collection-img").show(),$("#is-collection-imgactive").hide(),$("#is-collection").text("收藏"),$("#blog_detail_zk_collection .un-collect-status").show(),$("#blog_detail_zk_collection .collect-status").hide(),$("#blog_detail_zk_collection span.name").text("收藏")),u()}})}}function l(){x.rewardBtCoin.find(".reward-bt-active").is(".reward-bt-money")?d(x.rewardBox.find(".choosed").data("id"),x.moneyNum,2):d(x.rewardBox.find(".choosed").data("id"),x.coinNum,1)}function d(t,e,o){t<=e?m(!0,e,o):m(!1,e,o)}function m(t,e,o){if(t)x.isHaveMoney.html('<span class="tip">'+(1==o?"C币剩余:":"钱包余额:")+e+(1==o?"C币":"元")+'</span><a class="bt-go reward-sure">确定</a>');else{var i="";i=1!=o?'data-report-click=\'{"mod":"1597646289_003","spm":"1001.2101.3001.4302"}\'':'data-report-click=\'{"mod":"1597646289_004","spm":"1001.2101.3001.4304"}\'',
- x.isHaveMoney.html('<span class="tip">您的'+(1==o?"C币":"余额")+'不足,请先充值哦~</span><a class="bt-go" '+i+' target="_blank" href="'+(1==o?"https://mall.csdn.net/vip?type=v2":"https://i.csdn.net/#/wallet/balance/recharge")+'" data-report-query="utm_source=RewardVip">去充值</a>')}}function p(t){if(getCookie("UserName")){var e=$(".tool-attend");e.is(".tool-unbt-attend")?(e.removeClass("tool-unbt-attend").addClass("tool-bt-attend").text("关注"),y&&(window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({mod:"1592215036_002",spm:"1001.2101.3001.4132",extend1:"已关注"}),y=!1)):(e.removeClass("tool-bt-attend").addClass("tool-unbt-attend").text("已关注"),y&&(window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({mod:"1592215036_002",spm:"1001.2101.3001.4132",extend1:"关注"}),y=!1))}else window.csdn.loginBox.show();u()}function h(e,o){$(document).mouseup(function(i){if(!e.is(i.target)&&0===e.has(i.target).length&&!o.is(i.target)&&0===o.has(i.target).length){e.fadeOut(200),t($("#tool-share"),!1);var n=i||window.e;n&&n.stopPropagation?n.stopPropagation():n.cancelBubble=!0}})}function u(){"block"===$("#is-like-imgactive").css("display")&&"block"===$("#is-collection-imgactive").css("display")&&$(".tool-unbt-attend").length>0?$("#health-companies").removeClass("active"):$("#health-companies").addClass("active")}function f(){"block"!==$(this).find("img.isactive").css("display")?(C=!0,$(this).find("img.isactive").show(),$(this).find("img.isdefault").hide()):C=!1}function g(){$("#is-like-span")[0].style="",$("#spanCount")[0].style="",C&&!$(this).attr("data-flag")&&($(this).find("img.isactive").hide(),$(this).find("img.isdefault").show())}var v=!0;$(document).on("click",".article-info-box .slide-toggle",function(){v?$(this).text("收起"):$(this).text("版权"),$(this).parents(".article-info-box").find(".slide-content-box").slideToggle(),v=!v});var b='{"mod":"1585297308_001","dest":"'+articleDetailUrl+'","extend1":"pc","ab":"new"}';canRead&&($(".hide-article-box").length?$(document).on("click",".hide-article-box .btn-readmore",function(){$("#content_views").after("<div data-report-view="+b+"><div>")}):$("#content_views").after("<div data-report-view="+b+"><div>")),$("#blog_detail_zk_collection").click(function(){window.csdn.articleCollection()}),o(),$("#tool-share").on("click",function(){"block"!==$("#tool-QRcode").css("display")&&t($(this),!0),$("#tool-QRcode").show()}),$("#QRcode-close").on("click",function(){$("#tool-QRcode").fadeOut(200),t($("#tool-share"),!1)}),h($("#tool-QRcode"),$("#tool-share")),$("#tool-reward").on("click",function(){$("#reward").show()}),$("#is-like").on("click",function(){n()}),$("#btn-readmore-zk").on("click",function(){$("#btn-readmore").show()}),$("#btn-readmore").on("click",function(){var t=$(window).height();t*$(this).attr("height");$(".hide-article-box").show(),$("div.article_content")[0].style="height:2000px; overflow: hidden;",e(),$("#btn-readmore").hide(),$(".btn-readmore-gz")&&$(".btn-readmore-gz span").text("阅读全文")}),$(document).on("click",".is-collection",function(){getCookie("UserName")?window.csdn.collectionBox.show(window.csdn.collectionBox.params):window.csdn.loginBox.show()}),$(document).on("click",".tool-more .article-report",function(){getCookie("UserName")?showReport(!1):window.csdn.loginBox.show()}),e(),$(window).scroll(function(){e()}),$(window).resize(function(){e()}),$(".btn-readmore").click(e),""!==articleDetailUrl||void 0!==articleDetailUrl?collectionUrl=articleDetailUrl:collectionUrl=curentUrl;var w=!0;window.csdn.collectionBox.params={url:collectionUrl,title:articleTitle,description:articleDesc,author:username,source_id:articleId,source:"blog",collectionCallBack:function(t){s(t)}},window.csdn=window.csdn?window.csdn:{},window.csdn.articleCollection=c,r();var x={rewardItem:$("#toolreward"),rewardBox:$("#reward"),skinBoxshadow:$(".skin-boxshadow"),isHaveMoney:$("#reward .is-have-money"),coinNum:0,moneyNum:0,coinNumInit:5,rewardShowMore:$(".reward-user-box"),rewardBtCoin:$(".change-bt-box")};x.rewardBox.find(".choose_money").each(function(t,e){$(e).html("¥"+$(e).data("id"))}),l(),x.rewardBtCoin.find(".reward-bt").on("click",function(){x.rewardBtCoin.find(".reward-bt").removeClass("reward-bt-active"),$(this).addClass("reward-bt-active"),$(this).is(".reward-bt-money")?x.rewardBox.find(".choose_money").each(function(t,e){$(e).html("¥"+$(e).data("id"))}):x.rewardBox.find(".choose_money").each(function(t,e){$(e).html($(e).data("id")+"C币")}),l()}),x.rewardItem.on("click",function(){"block"!==$("#reward").css("display")&&t($(this).parents(".tool-item"),!0),getCookie("UserName")?$.ajax({url:blogUrl+"phoenix/web/v1/reward/getUserAmount",type:"GET",xhrFields:{withCredentials:!0},success:function(t){200==t.code&&$.each(t.data,function(t,e){100==e.code&&(x.coinNum=e.availableAmount),7e3==e.code&&(x.moneyNum=e.availableAmount)}),l(),x.rewardBox.fadeIn(200)},error:function(){x.rewardBox.fadeIn(200)}}):window.csdn.loginBox.show()}),x.rewardBox.find(".choose_money").click(function(){x.rewardBox.find(".choose_money").removeClass("choosed"),$(this).addClass("choosed"),l()}),x.rewardBox.on("click",".reward-sure",function(){x.rewardBtCoin.find(".reward-bt-active").is(".reward-bt-money")?(rewardCoinType="balance",dataJson={amount:100*x.rewardBox.find(".choosed").data("id"),articleId:articleId}):(rewardCoinType="coin",dataJson={coin:1*x.rewardBox.find(".choosed").data("id"),articleId:articleId}),$.ajax({url:blogUrl+"/phoenix/web/v1/reward/"+rewardCoinType,type:"POST",data:dataJson,xhrFields:{withCredentials:!0},success:function(t){if(200==t.code){x.skinBoxshadow.html("");var e='<img style="position:fixed;margin:auto;left:0px;top:0px;right:0px;bottom:0px" src="'+blogUrl+'static_files/static_blog/images/reward.gif" alt="打赏" title="打赏">';x.skinBoxshadow.append(e),x.rewardBox.fadeOut(200),x.skinBoxshadow.fadeIn(200),setTimeout(function(){x.skinBoxshadow.fadeOut(200),x.skinBoxshadow.html(""),window.location.reload()},4e3),window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&("balance"==rewardCoinType?window.csdn.report.reportClick({mod:"1582594662_001",spm:"1001.2101.3001.4303"}):window.csdn.report.reportClick({mod:"1582594662_002",spm:"1001.2101.3001.4301"}))}else i(!1,t.message)},error:function(t){i(!1,"操作失败,请重试")}})}),x.rewardBox.on("click",".reward-close",function(e){x.rewardBox.fadeOut(200),t($(this).parents(".tool-item"),!1);var o=e||window.e;o&&o.stopPropagation?o.stopPropagation():o.cancelBubble=!0}),$(".tool-subscribe").on("click",function(){$("#bt-click").trigger("click")});var y=!1;$("#btnAttent").on("click",function(){p()}),$(".tool-attend").on("click",function(t){t.originalEvent&&(y=!0),$("#btnAttent").trigger("click")}),$("#health-companies").on("click",function(){$(this).hasClass("active")&&(window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({spm:"1001.2101.3001.4429"}),"block"==$("#is-like-img").css("display")&&n(),"block"==$("#is-collection-img").css("display")&&a(),$(".tool-bt-attend").length>0&&($(".tool-attend").trigger("click"),window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({mod:"1592215036_002",spm:"1001.2101.3001.4132",extend1:"关注"})),$("#is-like-imgactive-animation-like").show().addClass("active-animation"),$("#is-collection-img-collection").show().addClass("active-animation"),$(".tool-item-follow").show().addClass("active-animation"),setTimeout(function(){$("#is-like-imgactive-animation-like").hide().removeClass("active-animation"),$("#is-collection-img-collection").hide().removeClass("active-animation"),$(".tool-item-follow").hide().removeClass("active-animation")},800))});var C=!1;$(".toolbox-list .tool-item").hover(f,g),$("#blog_detail_zk_collection").hover(f,g),$("#health-companies").on({mouseover:function(){$(this).is(".active")&&($(".triplet-prompt img.close-prompt").css("display","none"),$(".triplet-prompt").css("width","300px"),$(".triplet-prompt").fadeIn(500))},mouseout:function(){$(".triplet-prompt").fadeOut(500)}})}),$(function(){function t(t,e){var o=6,i=new Date;i.setTime(i.getTime()+36e5*o),document.cookie=t+"="+escape(e)+";expires="+i.toGMTString()+";domain=.csdn.net;path=/"}function e(t){var e,o=new RegExp("(^| )"+t+"=([^;]*)(;|$)");return(e=document.cookie.match(o))?unescape(e[2]):null}if(!currentUserName){var o=$("div.article_content"),i=o.offset().top,n=o.height(),a=document.body.clientHeight||document.documentElement.clientHeight,s=$(document).scrollTop();$(document).scroll(function(){s=$(document).scrollTop(),e("unlogin_scroll_step")||e("UserName")||showPcWindowAd||(s+a-i>n/2||s+a-i>2*a)&&(window.csdn.loginBox.show(),t("unlogin_scroll_step",(new Date).getTime()))})}}),"undefined"!=typeof document.addEventListener&&document.addEventListener("DOMContentLoaded",function(){return"undefined"==typeof Chart?void("undefined"!=typeof console&&console.log("ERROR: You must include chart.min.js on this page in order to use Chart.js")):void[].forEach.call(document.querySelectorAll("div.chartjs"),function(t){var e,o;e="undefined"!=typeof chartjs_colors?chartjs_colors:"undefined"!=typeof chartjs_colors_json?JSON.parse(chartjs_colors_json):{fillColor:"rgba(151,187,205,0.5)",strokeColor:"rgba(151,187,205,0.8)",highlightFill:"rgba(151,187,205,0.75)",highlightStroke:"rgba(151,187,205,1)",data:["#B33131","#B66F2D","#B6B330","#71B232","#33B22D","#31B272","#2DB5B5","#3172B6","#3232B6","#6E31B2","#B434AF","#B53071"]},o="undefined"!=typeof chartjs_config?chartjs_config:"undefined"!=typeof chartjs_config_json?JSON.parse(chartjs_config_json):{Bar:{animation:!1},Doughnut:{animateRotate:!1},Line:{animation:!1},Pie:{animateRotate:!1},PolarArea:{animateRotate:!1}};var i=t.getAttribute("data-chart"),n=JSON.parse(t.getAttribute("data-chart-value"));if(n&&n.length&&i){t.innerHTML="";var a=document.createElement("canvas");a.height=t.getAttribute("data-chart-height"),t.appendChild(a);var s=document.createElement("div");s.setAttribute("class","chartjs-legend"),t.appendChild(s);var c,r=a.getContext("2d"),l=new Chart(r);if("bar"!=i)for(c=0;c<n.length;c++)n[c].color=e.data[c],n[c].highlight=e.data[c];if("bar"==i||"line"==i){var d={datasets:[{label:"",fillColor:e.fillColor,strokeColor:e.strokeColor,highlightFill:e.highlightFill,highlightStroke:e.highlightStroke,data:[]}],labels:[]};for(c=0;c<n.length;c++)n[c].value&&(d.labels.push(n[c].label),d.datasets[0].data.push(n[c].value));s.innerHTML=""}"bar"==i?l.Bar(d,o.Bar):"line"==i?l.Line(d,o.Line):"polar"==i?s.innerHTML=l.PolarArea(n,o.PolarArea).generateLegend():"pie"==i?s.innerHTML=l.Pie(n,o.Pie).generateLegend():s.innerHTML=l.Doughnut(n,o.Doughnut).generateLegend()}})}),$(function(){new CSDNviewImg("#content_views");linkPage&&window.csdn.middleJump?window.csdn.middleJump({el:"#content_views",url:"https://link.csdn.net"}):$("#content_views").find("a").click(function(t){if(this.href&&"_self"!==this.target){t.preventDefault();var e=window.open(this.href,"_blank");e.focus()}})}),$(function(){function t(t,e,i){$.get(blog_address+"/phoenix/article/privacy?articleId="+t+"&index="+e+"&reason="+i,function(t){var e=t;e.result?(alert("文章已私密!"),location.reload()):e.content?o(e.content):alert("无法私密,请到后台私密!")})}function o(t){$(".super-private").hide(),$(".private-error").height(126).show().children(".private-content").text(t)}function n(){$(".private-form").removeClass("active").addClass("no-active")}var a={markdown_line:function(){$(".markdown_views pre").addClass("prettyprint"),$("pre.prettyprint code").each(function(){var t=$(this).text().split("\n").length+($(this).hasClass("hljs")?1:0),e=$("<ul/>").addClass("pre-numbering").hide();for($(this).addClass("has-numbering").parent().append(e),i=1;i<t;i++)e.append($("<li/>").text(i));e.fadeIn(1700)}),$(".pre-numbering li").css("color","#999"),setTimeout(function(){$(".math").each(function(t,e){$(this).find("span").last().css("color","#fff")})}),setTimeout(function(){$(".toc a[target='_blank']").attr("target",""),$("a.reversefootnote,a.footnote").attr("target","")},500)},html_line:function(){function t(){$(".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.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)})}$(".article_content pre").each(function(){var t=$(this);try{if(t.attr("class").indexOf("brush:")!=-1){var e=t.attr("class").split(";")[0].split(":")[1];t.attr("name","code"),t.attr("class",e)}t.attr("class")&&t.attr("name","code")}catch(o){}}),$(".article_content textarea[name=code]").each(function(){var t=$(this);t.attr("class").indexOf(":")!=-1&&t.attr("class",t.attr("class").split(":")[0])}),$(".highlighter").each(function(t,e){hljs.highlightBlock(e),hljs.lineNumbersBlock(e)}),window.clipboardData||setTimeout(t,1e3)}},s=$(".markdown_views")[0];s?(a.markdown_line(),/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&window.csdn.setSafariCodestyle()):a.html_line(),$(document).on("click",".input-mod",function(){$(".select-option").show(),$(".select-button").removeClass("rotate0").addClass("rotate180")}),$(document).on("input porpertychange",".private-input",function(){n(),$(this).val().length>120&&$(this).val($(this).val().substr(0,120)),$(".textarea-box .number").text(120-$(this).val().length),$(this).val().length>0&&$(".private-form").removeClass("no-active").addClass("active")}),$(document).on("click",".select-option li",function(){$(".super-private").height(126),$(".private-content .other").hide(),n(),$(".select-active").text($(this).text()).data("index",$(this).data("index")),$(this).data("isinput")?($(".super-private").height(240),$(".private-content .other").show()):$(".private-form").removeClass("no-active").addClass("active"),$(".select-button").addClass("rotate0").removeClass("rotate180"),$(".select-option").fadeOut()}),$(document).on("click",".select-button",function(){"block"===$(".select-option").css("display")?($(".select-option").fadeOut(),$(this).removeClass("rotate180").addClass("rotate0")):($(this).removeClass("rotate0").addClass("rotate180"),$(".select-option").fadeIn()),e.stopPropagation(),e.cancelBubble=!0}),$(document).on("click",".private-close, .close-active",function(){$(".super-private").hide(),$(".mask-dark").hide()}),$(document).on("click",".private-footer .active",function(){var e=$(".select-active").data("index"),o=$(".reason").val();e||alert("请选择原因"),text="text",t(articleId,e,o)})}),$(function(){$("article").find("table").map(function(){$(this).wrap('<div class="table-box" />')})}),$(window).bind("load",function(){var t=$(".hot-words-highlight").length,e=2*$("#csdn-toolbar").height();t&&($(".hot-word-tip-box").fadeIn(),$(".hot-word-tip-box .hot-word-count").text("1/"+t),$(".blog-content-box").find(".hot-words-highlight").each(function(e,o){e<t-1&&$(this).append(""),e<t&&$(this).attr("data-index",e).addClass("highlight-index"+e)}),$(".blog-content-box .hot-words-highlight").on({click:function(){var o=$(this).data("index")+1;if(o&&$(".hot-words-highlight").is(".highlight-index"+o)){var i=$(".highlight-index"+o).offset().top,n=$(".blog-content-box").offset().top;$("body,html").animate({scrollTop:i-n-e+"px"},1e3)}$(".hot-word-tip-box .hot-word-count").text(o+"/"+t)},mouseover:function(){var t=$(this).data("index")+1;if(t&&$(".hot-words-highlight").is(".highlight-index"+t)){var e=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop,o=$(this).width(),i=$(this).offset().left+o-8,n=$(this).offset().top-e-20;$("body").append('<span class="next-word" style="left:'+i+"px;top:"+n+'px">下一个</span>')}},mouseout:function(){$(".next-word").remove()}}),$(".hot-word-tip-box .hot-word-clear").click(function(){$(".blog-content-box span[class*=highlight-index]").removeClass("hot-words-highlight"),$(".hot-word-tip-box").fadeOut()}))}),!function(t){function e(){var e=navigator.userAgent.toLowerCase();return t.ActiveXObject||"ActiveXObject"in t?"ie":e.indexOf("firefox")>=0?"firefox":e.indexOf("chrome")>=0?"chrome":e.indexOf("opera")>=0?"opera":e.indexOf("safari")>=0?"safari":void 0}var o=t.document,i=function(e,i,n,a,s,c){function r(t,o,n){var a=(t+o)/2;if(n<=0||o-t<c)return a;var s="("+e+":"+a+i+")";return l(s).matches?r(a,o,n-1):r(t,a,n-1)}var l,d,m,p;t.matchMedia?l=t.matchMedia:(d=o.getElementsByTagName("head")[0],m=o.createElement("style"),d.appendChild(m),p=o.createElement("div"),p.className="mediaQueryBinarySearch",p.style.display="none",o.body.appendChild(p),l=function(t){m.sheet.insertRule("@media "+t+"{.mediaQueryBinarySearch {text-decoration: underline} }",0);var e="underline"==getComputedStyle(p,null).textDecoration;return m.sheet.deleteRule(0),{matches:e}});var h=r(n,a,s);return p&&(d.removeChild(m),o.body.removeChild(p)),h},n={};n.ie=function(){return t.screen.deviceXDPI/t.screen.logicalXDPI},n.firefox=function(){return t.devicePixelRatio?t.devicePixelRatio:i("min--moz-device-pixel-ratio","",0,10,20,1e-4)},n.opera=function(){return t.outerWidth/t.innerWidth},n.chrome=function(){if(t.devicePixelRatio)return t.devicePixelRatio;var e=o.createElement("div");e.innerHTML="1",e.setAttribute("style","font:100px/1em sans-serif;-webkit-text-size-adjust:none;position: absolute;top:-100%;"),o.body.appendChild(e);var i=1e3/e.clientHeight;return i=Math.round(100*i)/100,o.body.removeChild(e),i},n.safari=function(){return t.outerWidth/t.innerWidth},t.detectZoom=function(){return n[e()]()}}(this),$(function(){function system(){var t=navigator.userAgent.toLowerCase();return t.indexOf("win")>=0?"win":t.indexOf("mac")>=0?"mac":void 0}function round2(number,fractionDigits){with(Math)return round(number*pow(10,fractionDigits))/pow(10,fractionDigits)}function iszoom(t){return"win"==t.system&&1!=t.zoom||("mac"==t.system&&t.zoom%1!=0&&t.zoom%2!=0||void 0)}function keyUpEvent(t){var e={win:{add:187,minus:189,origin:48},mac:{add:187,minus:189,origin:48}},o=e[system()];if(t.ctrlKey||t.metaKey)if(t.keyCode==o.add||t.keyCode==o.minus){var i={zoom:round2(detectZoom(),2),system:system()};LeftPopShow(iszoom(i),leftPopRendering,RenderData)}else t.keyCode!=o.add&&t.keyCode!=o.origin||BOXDOM.animate(CLOSEANI,2e3)}function keydownEvent(t){setTimeout(keyUpEvent,300,t)}function setStorage(t,e){return localStorage.setItem(t,e)}function getStorage(t){return localStorage.getItem(t)}function addStyles(t){var e=document.createElement("style");e.type="text/css",e.innerHTML=[".leftPop{width:330px;position: fixed;font-size: 12px;","box-shadow: 0 4px 8px 0 rgba(0,0,0,0.10);padding:16px 40px 16px 16px;z-index: 100;","}",".leftPop .leftPop-close{position: absolute;right: 20px;"+t,"cursor: pointer;","}"].join(""),document.getElementsByTagName("head")[0].appendChild(e)}function leftPopRendering(t){var e=$(".leftPop");if(e.length>0)return e.stop(!0,!1).animate(t.animate,t.animateTime),!1;var o='<svg t="1536830466687" class="icon leftPop-close" viewBox="0 0 1024 1024" version="1.1" ><title>不再显示</title><path d="M512 438.378667L806.506667 143.893333a52.032 52.032 0 1 1 73.6 73.621334L585.621333 512l294.485334 294.485333a52.074667 52.074667 0 0 1-73.6 73.642667L512 585.621333 217.514667 880.128a52.053333 52.053333 0 1 1-73.621334-73.642667L438.378667 512 143.893333 217.514667a52.053333 52.053333 0 1 1 73.621334-73.621334L512 438.378667z" fill="" p-id="15859"></path></svg>';e=$('<div class="leftPop">'+o+"</div>"),addStyles(t.closeColor),e.append(t.template).css(t.style),e.appendTo($("body")).delay(2e3).animate(t.animate,t.animateTime),BOXDOM=e,$(".leftPop-close").on("click",function(){e.stop(!0,!1).animate(t.closeAnimate,t.animateTime),setStorage("leftPop",0)})}function LeftPopShow(t,e,o){var i=getStorage("leftPop");t&&null==i?e(o):BOXDOM.stop(!0,!1).animate(o.closeAnimate,o.animateTime)}var zoomData={zoom:round2(detectZoom(),2),system:system()},BOXDOM=$("leftPop");CLOSEANI={right:"-100%"};var events={win:{even:"keyup",fun:keyUpEvent},mac:{even:"keydown",fun:keydownEvent}};$(window).on(events[system()].even,events[system()].fun);var RenderData={template:"<span>你的浏览器目前处于缩放状态,页面可能会出现错位现象,建议100%大小显示。</span>",style:{right:"-100%","background-color":"#EBF5FD",top:"100px","border-left":"4px solid #70B8F0"},closeColor:"fill:#70B8F0;",animate:{right:0},closeAnimate:CLOSEANI,animateTime:2e3};LeftPopShow(iszoom(zoomData),leftPopRendering,RenderData)});
|