"use strict";function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0?"UA-127895514-6":"UA-127895514-1":""}var n="6bcd52f51e9b3dce32bec4a3997715ac",o=function(){var e="6bcd52f51e9b3dce32bec4a3997715ac",t=$('meta[name="toolbar"]');if(t.length){var n=t.attr("content")||{};n=JSON.parse(n),e=n.hmId||e}return e}();if(function(e){for(var t=document.cookie.split("; "),o=0;o-1){var i=function(){dataLayer.push(arguments)},s=document.createElement("script");s.src="https://www.googletagmanager.com/gtag/js?id="+t(),a.parentNode.insertBefore(s,a),window.dataLayer=window.dataLayer||[];var c=e("UserName")||"";i("js",new Date),i("config",t()),c&&i("set",{user_id:c})}}(),function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://g.csdnimg.cn/??asdf/1.1.3/trackad.js,iconfont/nav/iconfont-1.0.1.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}(),function(){function e(e){if(!e.includes("?"))return e;var n=e.split("?"),o=_slicedToArray(n,2),r=o[0],a=o[1],i=a.split("&").filter(function(e){return-1===e.indexOf(t)});return i.length?r+"?"+i.join("&"):r}var t="c_ab_test=1";if(("www.csdn.net"===location.hostname||"blog.csdn.net"===location.hostname)&&"/"===location.pathname){var n=location.href.indexOf(t)>-1;$.ajax({url:"https://blog.csdn.net/phoenix/web/get-www-ab-test"+(n?"?cAbTest=1":""),type:"get",xhrFields:{withCredentials:!0},success:function(){if(n){var o=e(location.href);o.indexOf(t)>-1&&(o=o.replace(t,"")),location.href=o}},complete:function(){}})}}(),window._hmt=window._hmt||[],function(e,t){function n(e){var t=document.createElement("style");t.innerText="#csdn-toolbar .toolbar-inside{display: none;}",document.getElementsByTagName("head")[0].appendChild(t);var n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,n.addEventListener("load",function(){t.remove()}),document.getElementsByTagName("head")[0].appendChild(n)}function o(e){for(var t=document.cookie.split("; "),n=0;n0?(n&&(clearTimeout(n),n=null),e.apply(r,arguments),o=a):n||(n=setTimeout(function(){e.apply(r,arguments)},t))}}function s(e,t){var n;return function(){var o=this,r=arguments;n&&clearTimeout(n),n=setTimeout(function(){e.apply(o,r)},t)}}function c(t){e.csdn&&e.csdn.loginBox&&e.csdn.loginBox.show?e.csdn.loginBox.show(t):e.location.href="https://passport.csdn.net/account/login"+(t?"?spm="+t.spm:"")}function l(e){e=e.replace("https://","");var t=e.split("/")[0];return~location.host.indexOf(t)}function d(){return location.origin+location.pathname==="https://www.csdn.net/c/"}function p(e){return"string"==typeof e||e instanceof String}function u(){var e=navigator.userAgent;return e.indexOf("Opera")>-1||e.indexOf("OPR/")>-1?"Opera":e.indexOf("Edg")>-1?"Edge":e.indexOf("Chrome")>-1?"Chrome":e.indexOf("Safari")>-1?"Safari":e.indexOf("Firefox")>-1?"Firefox":e.indexOf("Trident")>-1?"IE":"Unknown"}function h(t){var n="/"===e.location.pathname?"":e.location.pathname,o=e.location.origin+n;return t.indexOf(o)>-1}function m(e){return 0==e.length?"":e.replace(/&/g,"&").replace(//g,">").replace(/\'/g,"'").replace(/\"/g,""")}function g(n){if("[object Object]"==Object.prototype.toString.call(n)){var o=t("#csdn-toolbar"),r=n.need_first_suspend||!1,a=n.need_little_suspend||!1,s=n.little_tool_id||"",c=n.little_need_insert_type||"",l=n.need_change_function||"",d="",p="";if(1!=r||1!=a){if(a&&""!=s&&(o=t(s)),a&&s&&""!=c&&(d="."+c,p=t(d)),0===o.length)return void D.push(g.bind(this,n));var u=i(function(){if((document.documentElement.scrollTop||document.body.scrollTop)>=50)o.css({position:"fixed",top:"0",left:"0","z-index":"1993","min-width":"100%",width:"max-content"}),a&&t(".secodn_level_csdn_logo").length&&t(".secodn_level_csdn_logo").css({display:"block"}),a&&""!=c&&(t("body").addClass("toolbar-second-drop"),"onlySearch"==c?t("#csdn_tool_otherPlace").append(p):"onlyUser"==c?t("#csdn_tool_otherPlace").append(p):"searchUser"==c&&(t("#csdn_tool_otherPlace").append(t(".onlySearch")),t("#csdn_tool_otherPlace").append(t(".onlyUser")))),"function"==typeof l&&l("fixed");else{if(o.css({position:"relative","z-index":"","min-width":"100%",width:"max-content"}),a&&t(".secodn_level_csdn_logo").length&&t(".secodn_level_csdn_logo").css({display:"none"}),a&&""!=c){t("body").removeClass("toolbar-second-drop");var e=t("#csdn-toolbar .toolbar-container");"onlySearch"==c?e.find(".toolbar-menus").after(p):"onlyUser"==c?e.find(".toolbar-container-right").append(p):"searchUser"==c&&(e.find(".toolbar-container-middle").append(t(".onlySearch")),e.find(".toolbar-container-right").append(t(".onlyUser")))}"function"==typeof l&&l("noFixed")}},80);"so"!==C?((document.documentElement.scrollTop||document.body.scrollTop)>50&&u(),t(e).on("scroll",u)):void 0}}}function f(){var t=e.location.host,n=t.split(".")[0],o="";switch(n){case"www":case"blog":case"bbs":o="";break;case"download":o="doc";break;case"ask":o="ask";break;case"gitchat":case"geek":o="";break;case"edu":o="course";break;default:o=""}return t.indexOf(".blog.csdn.net")>-1&&(o="blog"),o}function b(e){var t={};return location.href.replace(/([^*#&=?]+)=([^*#&=?]+)/g,function(){for(var e=arguments.length,n=Array(e),o=0;o1e4&&(e=parseFloat((e/1e4).toFixed(1))+"w")}catch(e){}return e}function k(t){try{return e.csdn.report.getFullSpm(t)}catch(e){return t}}function _(){this.currentUser={userName:"",userNick:'设置昵称',desc:'编辑自我介绍,让更多人了解你',avatar:""},this.hasLogin=!1,this.$container="",this.announcement=0,this.logoData={title:"CSDN首页",url:{default:"https://csdnimg.cn/cdn/content-toolbar/csdn-logo.png?v=20200416.1",dark:"https://g.csdnimg.cn/common/csdn-toolbar/images/csdn-logo.png",home:"https://g.csdnimg.cn/common/csdn-toolbar/images/csdn-logo.png"}},this.navData=[],this.personMenuData=[],this.advertData={date:{start:"2022/07/03 08:50:00",end:"2022/07/04 17:30:00"},background:{large:"https://csdnimg.cn/public/publick_img/ad_20200703_toolbar325.jpg",default:"https://csdnimg.cn/public/publick_img/ad_20200703_toolbar80_2.jpg"},color:"#027ef2",url:"https://aiprocon.csdn.net/p/live?utm_source=live_703"},this.mpMenuData={isShow:!1},this.searchLoginAb=null,this.searchLoginAbSpm=null,this.demoSpm="",this.absegment=-1,this.cknowData=null,this.searchToolbarData=null,this.init()}e.csdn=e.csdn||{},e.csdn.configuration_tool_parameterv=g;var S=["csdn-toolbar-default","csdn-toolbar-dark","csdn-toolbar-home"],D=[],T=0,C="normal",$=0,I="https://so.csdn.net/so/search";_.prototype={constructor:_,init:function(){var e=this;e.checkLogin(function(t){t.userName&&(e.hasLogin=!0,_hmt.push(["_setUserTag","5744",t.userName])),e.setPersonMenuData()}),e.getToolbarData(e.render)},render:function(t){var n=this;if(n.isMiniRenderSearch=!1,"sidebar-www"!==C){this.abWithWhiteHostSearchToolbar()&&(C="so")}"mini"===C?(n.renderMiniToolbar(),n.renderLogo(),n.renderMiniMenu(),n.renderBtnsJudgement(),n.chain(),e.csdn&&e.csdn.toolbarFinishCallback&&e.csdn.toolbarFinishCallback()):"sidebar"===C||"sidebar-www"===C?(n.renderMiniToolbar(),n.renderLogo(),n.renderMiniMenuSidebar(),n.renderSearch("#csdn-toolbar .toolbar-container .toolbar-container-mini-middle"),n.renderBtnsJudgement(),n.chain(),e.csdn&&e.csdn.toolbarFinishCallback&&e.csdn.toolbarFinishCallback()):"so"===C?(n.renderSoToolbar(),n.renderLogo(),n.abTestFn(),n.renderNav(),this.renderSearch("#csdn-toolbar .toolbar-so .toolbar-so-search-container"),n.soToolbarOnScroll(),n.renderBtnsJudgement(),n.getHotSearchWordData(),n.chain()):(n.renderToolbar(),n.renderLogo(),n.abTestFn(),n.renderNav(),n.renderSearch(),n.renderBtnsJudgement(),n.getHotSearchWordData(),n.chain()),e.csdn&&e.csdn.report&&e.csdn.report.viewCheck&&e.csdn.report.viewCheck()},setPersonMenuData:function(){this.personMenuData=[{name:"我的关注",url:"https://i.csdn.net/#/uc/follow-list",report:{mod:"popu_789",dest:"https://i.csdn.net/#/uc/follow-list",spm:"3001.5109"},icon:"toolbar-icon-follow",class:""},{name:"我的收藏",url:"https://i.csdn.net/#/uc/collection-list?type=1",report:{mod:"popu_789",dest:"https://i.csdn.net/#/uc/collection-list?type=1",spm:"3001.5110"},icon:"toolbar-icon-collect",class:""},{name:"个人中心",url:"https://i.csdn.net/#/uc/profile",report:{mod:"popu_789",dest:"https://i.csdn.net/#/uc/profile",spm:"3001.5111"},icon:"toolbar-icon-profile",class:""},{name:"帐号设置",url:"https://i.csdn.net/#/account/index",report:{mod:"popu_789",dest:"https://i.csdn.net/#/account/index",spm:"3001.5112"},icon:"toolbar-icon-account",class:"toolbar-subMenu-border"},{name:"我的博客",url:"https://blog.csdn.net/"+this.currentUser.userName,report:{mod:"popu_789",dest:"https://blog.csdn.net/",spm:"3001.5113"},icon:"toolbar-icon-blog",class:""},{name:"管理博客",url:"https://mp.csdn.net/console/article",report:{mod:"popu_789",dest:"https://mp.csdn.net/console/article",spm:"3001.5114"},icon:"toolbar-icon-mp",class:""},{name:"我的学院",url:"https://edu.csdn.net/",report:{mod:"popu_789",dest:"https://edu.csdn.net/",spm:"3001.5115"},icon:"toolbar-icon-edu",class:""},{name:"我的下载",url:"https://mp.csdn.net/console/upDetailed",report:{mod:"popu_789",dest:"https://mp.csdn.net/console/upDetailed",spm:"3001.5116"},icon:"toolbar-icon-download",class:""},{name:"我的书架",url:"https://book.csdn.net/bookshelf",report:{mod:"popu_789",dest:"https://book.csdn.net/bookshelf",spm:"3001.5117"},icon:"toolbar-icon-book",class:"toolbar-subMenu-border"},{name:"我的钱包",url:"https://i.csdn.net/#/wallet/index",report:{mod:"popu_789",dest:"https://i.csdn.net/#/wallet/index",spm:"3001.5136"},icon:"toolbar-icon-wallet",class:""},{name:"我的订单",url:"https://mall.csdn.net/myorder",report:{mod:"popu_789",dest:"https://mall.csdn.net/myorder",spm:"3001.5137"},icon:"toolbar-icon-order",class:"toolbar-subMenu-border"},{name:"帮助",url:"https://blog.csdn.net/blogdevteam/article/details/103478461",report:{mod:"popu_789",dest:"https://blog.csdn.net/blogdevteam/article/details/103478461",spm:"3001.5138"},icon:"toolbar-icon-help",class:""},{name:"退出",url:"javascript:;",report:{spm:"3001.5139"},icon:"toolbar-icon-logout",class:"toolbar-btn-logout"}]},getAvatarByAu:function(e){return"https://profile-avatar.csdnimg.cn/default.jpg!3"},checkLogin:function(e){var t=o("UserNick"),n=o("UserName");this.currentUser.userNick=t,this.currentUser.userName=n,this.currentUser.avatar=this.getAvatarByAu(),e&&e(this.currentUser)},renderToolbar:function(){var e=this,n=e.getToolbarStyle(),o=t('
\n
\n
\n
\n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    ');return 1==$?t("#toolbarBox").prepend(o):t("body").prepend(o),e.$container=o.find(".toolbar-container"),e.$logoBox=o.find(".toolbar-logo"),e.$NavBox=o.find(".toolbar-menus"),e.$btnsBox=o.find(".toolbar-btns"),t(document).on("click",function(n){0!==t(n.target).closest(".toolbar-search").length||e.searchInputFocus||(e.clearSeachDropMenu(),e.toggleSearchBarInput())}),this},renderSoToolbar:function(){var e=["default","dark","home"],n=e[T],o=this.searchToolbarData||{},r=o.logo&&o.logo.url?o.logo.url[n]:"",a=o.sideLogo&&o.sideLogo.url?o.sideLogo.url[n]:"",i="dark"===n?"dark":"light",s=o.background&&o.background[i]?o.background[i]:{},c=s.fold&&s.normal,l=this,d=l.getToolbarStyle(),p=t('
    \n
    \n
    \n
    \n
    \n \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n '+(r?'':"")+'\n
      \n \n
      \n
      \n
      \n
      ");return 1==$?t("#toolbarBox").prepend(p):t("body").prepend(p),l.$container=p.find(".toolbar-container"),l.$logoBox=p.find(".toolbar-logo"),l.$NavBox=p.find(".toolbar-menus"),l.$btnsBox=p.find(".toolbar-btns"),l.$toolbarSo=p.find(".toolbar-so"),l.$toolbarInside=p.find(".toolbar-inside"),l.$fakeHeight=p.find(".toolbar-so-height"),t(document).on("click",function(e){0!==t(e.target).closest(".toolbar-search").length||l.searchInputFocus||(l.clearSeachDropMenu(),l.toggleSearchBarInput())}),this},soToolbarOnScroll:function(){var n=this,r=n.$toolbarSo.find(".toolbar-so-container > img"),a=!!o("is_advert"),s=["default","dark","home"],c=s[T],l=this.searchToolbarData||{},d="dark"===c?"dark":"light",p=l.background&&l.background[d]?l.background[d]:{},u=p.fold&&p.normal,h=function(e){var o=document.documentElement.scrollTop||document.body.scrollTop,i=t("#csdn-toolbar .toolbar-advert"),s=i.length?i.height():0;if(!(o>t("#csdn-toolbar").height())||e){var c=n.$toolbarInside.height(),l=0;if(r.length){var d=getComputedStyle(r[0]);l=r.height()+Number(d.marginBottom.replace("px",""))+Number(d.marginTop.replace("px",""))+10}var h=s,m=0;if(o>0||a){n.$toolbarInside.css("top",h+"px"),i.addClass("fixed"),n.$toolbarInside.addClass("fixed"),m=c+h;var g=n.$toolbarSo.hasClass("fold");if(o>=0){var f=!!(o>=l+0);m=f?68+c+l:48,m+=h,n.$fakeHeight.css("height",m+"px");var b={top:f?h+c+"px":0};u&&(b.background=f?p.fold:p.normal),f?n.$toolbarSo.addClass("fold").css(b):g&&n.$toolbarSo.css(b).removeClass("fold")}else g&&n.$toolbarSo.css("top",0).removeClass("fold");if(r.length&&o0&&o50&&h(!0),t(document).on("toolbarHeightChange",function(){h(!0)});var m=i(h,20);t(e).on("scroll",m)},renderMiniToolbar:function(){var e=this,n=e.getToolbarStyle(),o=t('
      \n
      \n
      \n
      \n \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      ');return t("body").prepend(o),e.$miniMenu=o.find(".toolbar-container-left"),e.$logoBox=o.find(".toolbar-logo"),e.$btnsBox=o.find(".toolbar-btns"),this},abWithWhiteHostSearchToolbar:function(){try{var e=this.searchToolbarData||{};if(!e.whiteList||!e.whiteList.length)return!1;if(e.whiteList.some(function(e){return"string"==typeof e?"*"===e||!!~location.href.indexOf(e):!("object"!==(void 0===e?"undefined":_typeof(e))||!e.host)&&(e.path=e.path||["*"],!!~location.href.indexOf(e.host)&&e.path.some(function(e){return"*"===e||location.pathname===e}))})){var t=o("c_segment")?parseInt(o("c_segment")):-1;return!(!e.abTest||!e.abTest.exp1)&&e.abTest.exp1.indexOf(t)>-1}return!1}catch(e){return!1}},abTestFn:function(){function e(e){for(var t=document.cookie.split("; "),n=0;n0&&!h(t.whiteUrl))return"";if(t.hasOwnProperty("browser")){var n=t.browser,o=u();if(o=o.toLowerCase(),Array.isArray(n)?n=n.map(function(e){return e.toLowerCase()}):p(n)&&(n=n.toLowerCase()),-1===n.indexOf(o))return""}if(t.active=l(t.url),"index"===t.id&&d()?t.active=!1:"community"!==t.id||d()||(t.active=!1),e.absegment>-1&&"plugin"==t.id)return"";if(e.absegment<=-1&&"cknow"===t.id)return"";e.absegment>t.abtest&&(t.iconTitle=null);var r=((new Date).getTime(),e.isEffectiveTime(t.icon));return'
    • \n \n "+(t.iconTitle?"':"")+t.name+"\n "+(r?"':"")+"\n "+(t.children.length?'':"")+"\n \n "+(t.children.length?'
      \n '+t.children.map(function(e){return'"+e.name+""}).join("")+"\n
      ":"")+"\n "+(t.slider&&t.slider.list&&t.slider.list.length?'
      \n
      \n "+t.slider.list.map(function(e){return(e.name&&e.name.length<=2||e.imgUrl)&&'\n '+(this.logoData.qrcode?'
      \n \n
      ':"");return void 0,this.$logoBox.append(n),this},toggleClearIcon:function(n){var o=t("#csdn-toolbar .toolbar-search-container");if(o){var r=o.find(".clear-icon"),a=o.find("#toolbar-search-input"),i=o.find("#toolbar-search-button");n?r&&r.length||!a.val()||(e.csdn&&e.csdn.report&&e.csdn.report.reportView&&e.csdn.report.reportView({spm:"3001.10183"}),i.before('')):r.remove()}},renderSearch:function(n){var r=this,a="",i="",l=0,d=!1,p=0;if(!this.hasLogin&&this.searchLoginAb){var u=Object.keys(this.searchLoginAb);l=parseInt(e.localStorage.getItem("searchShowLoginCount")),l=isNaN(l)?0:l;var h=l>0?parseInt(e.localStorage.getItem("searchShowLoginShowTime")):0;h=isNaN(h)?0:h;if((new Date).getTime()-h>=864e5&&(l=0,e.localStorage.setItem("searchShowLoginCount",0),e.localStorage.setItem("searchShowLoginShowTime",0)),u.length>0){var m=parseInt(o("c_segment"));a=u.find(function(e){return r.searchLoginAb[e].indexOf(m)>-1}),a=a||"",i=a?this.searchLoginAbSpm[a]:""}}var g=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!n||"exp2"===a){l=parseInt(e.localStorage.getItem("searchShowLoginCount")),l=isNaN(l)?0:l;var o=l>0?parseInt(e.localStorage.getItem("searchShowLoginShowTime")):0;o=isNaN(o)?0:o;var r=(new Date).getTime()-o;void 0,r>=864e5&&(l=0,o=0),l<2&&(0===o||r>6e4)?(d=!1,l+=1,e.localStorage.setItem("searchShowLoginCount",l),e.localStorage.setItem("searchShowLoginShowTime",(new Date).getTime()),c({spm:i,guideText:"请登录后,再进行搜索哦~",cb:function(){e.csdn.loginBox.close(),n?e.location.reload():(setTimeout(function(){e.location.reload()},500),d=!0,t("#toolbar-search-button").trigger("click")),e.csdn&&e.csdn.report&&e.csdn.report.reportClick&&e.csdn.report.reportClick({spm:i,extra:{searchShowLoginCount:l,hasLoggedIn:1,is_loginbox:0}})}})):(d=!0,n||t("#toolbar-search-button").trigger("click"))}},f=this,b=t(''),v=!1,w=s(this.getSearchAssociateWord,300).bind(this);b.on("focus","#toolbar-search-input",function(e){a&&"control"!==a&&g(!0);var o=t(this),r=o.val().trim();""===r?f.getSearchHistoryArray(f.renderSearchHistoryDropMenu):w(r,f.renderAssociateWordDropMenu.bind(f)),n||f.toggleSearchBarInput("focus"),f.searchInputFocus=!0,v=!0,f.refreshPlaceholder(),f.buriedPoint({spm:"3001.8516"}),b.find(".toolbar-search-container").addClass("is-focus"),p=document.documentElement.scrollTop||document.body.scrollTop}).on("blur","#toolbar-search-input",function(e){f.searchInputFocus=!1,setTimeout(function(){f.refreshPlaceholder()},500),b.find(".toolbar-search-container").removeClass("is-focus")}).on("input","#toolbar-search-input",function(e){var n=t(this),o=n.val().trim();f.searchInputValue=o,void 0,""===o&&v?f.getSearchHistoryArray(f.renderSearchHistoryDropMenu):w(o,f.renderAssociateWordDropMenu.bind(f))}).on("click","button",function(e){if(a&&"control"!==a&&!d)return void g();d=!1;var o=t("#toolbar-search-input").val(),r=f.placeholder&&f.placeholder.productId||f.placeholderRight&&f.placeholderRight.productId,i=o?"3001.4498":"3001.7499",s=o||r,c=f.clickSearchBtnHandler.call(f,o,i);return f.buriedPoint({spm:i,dest:c,extend1:o?"pc_search_uc_word":"pc_search_default_word",extra:JSON.stringify({utm_medium:f.utm_medium,searchword:s})}),f.clearSeachDropMenu(),b.find("#toolbar-search-input").blur(),n||f.toggleSearchBarInput(),!1}).on("keydown","#toolbar-search-input",function(e){229!==e.keyCode&&13===e.keyCode&&t("#toolbar-search-button").trigger("click")}),b.on("input","#toolbar-search-input",function(e){f.toggleClearIcon(!!t(this).val())}).on("click",".clear-icon",function(e){f.toggleClearIcon(!1),b.find("#toolbar-search-input").val("").focus(),f.getSearchHistoryArray(f.renderSearchHistoryDropMenu),f.buriedPoint({spm:"3001.10183"})}).on("mouseenter",function(){b.find("#toolbar-search-input").val()&&e.csdn&&e.csdn.report&&e.csdn.report.reportView&&e.csdn.report.reportView({spm:"3001.10183"})});var x=!1;return b.on("compositionstart","#toolbar-search-input",function(e){x=!0}).on("compositionupdate","#toolbar-search-input",function(e){x=!0}).on("compositionend","#toolbar-search-input",function(e){x=!1}),n?(t(n).append(b),f.isMiniRenderSearch=!0,t(document).on("click",function(e){0!==t(e.target).closest(".toolbar-search").length||f.searchInputFocus||f.clearSeachDropMenu()})):t(".toolbar-container-middle").append(b),setTimeout(function(){f.reportViewCheck()}),f.$searchBox=t(".toolbar-search"),t(e).on("keydown",function(e){if(!x){var n=t(".associate-word-drop-menu");if(n.length&&v){var o=n.find(".toolbar-search-item"),r=n.find(".toolbar-search-item.active"),a=r.length?r.index():-1;"ArrowUp"===e.key?(a--,a<0&&(a=o.length-1),o.eq(a).addClass("active").siblings().removeClass("active"),b.find("#toolbar-search-input").val(o.eq(a).find(".search-key-data").text()),e.preventDefault()):"ArrowDown"===e.key&&(a++,a>o.length-1&&(a=0),o.eq(a).addClass("active").siblings().removeClass("active"),void 0,b.find("#toolbar-search-input").val(o.eq(a).find(".search-key-data").text()))}}}),t(e).on("resize",function(){y()||v&&(f.clearSeachDropMenu(),b.find("#toolbar-search-input").blur(),n||f.toggleSearchBarInput())}),t(e).on("scroll",function(){if(f.searchInputFocus){var e=document.documentElement.scrollTop||document.body.scrollTop;if(!(Math.abs(e-p)>30))return;f.clearSeachDropMenu(),b.find("#toolbar-search-input").blur(),n||f.toggleSearchBarInput()}}),this},outPutSearchMethod:function(e){this.renderSearch(e),this.getHotSearchWordData()},renderBtnsJudgement:function(){this.renderBtnsExp3()},renderBtnsExp3:function(){ var e=this,n=w(),a=n&&this.hasLogin?this.vipData.iconVip:this.vipData.iconNormal,i=a.showIcon?"inline-block":"none",s="sidebar-www"===C,l=t('\n \n "+(this.hasLogin?'
      \n
      \n 消息\n
      \n
      \n
      ':'
      \n
      \n 消息\n
      \n
      ')+"\n "+(s?"":'
      \n 历史\n
      ')+"\n "+(s?"":'")+'\n
      \n
      ');this.$btnsBox.append(l),this.renderNewBtnWrite(),t("#toolbar-remind").on("click",function(){var e=o("toolbar_remind_num");e?e<3&&(e=parseInt(e)+1,r("toolbar_remind_num",e,864e5)):(e=1,r("toolbar_remind_num",e,864e5))}),l.on("click",".toolbar-btn-loginfun",function(){var e=t(this).data("report-click");e?c(e):c()}),l.on("click",".toolbar-btn-logout",function(){e.clickLogoutBtnHandler()})},renderBtnWrite:function(){var n=this.hasShowMpMenu()?"https://mp.csdn.net/edit":"https://mp.csdn.net",o=''+(this.hasShowMpMenu()?"发布":"创作")+"";if(e.csdn.toolbarData&&e.csdn.toolbarData.writeBtnData&&e.csdn.toolbarData.writeBtnData.btnShow)if(!this.hasLogin&&e.csdn.toolbarData.writeBtnData&&e.csdn.toolbarData.writeBtnData.btnBgUnLoginOld)o='\n \n ',t(".toolbar-btn-write").append(o),e.csdn&&e.csdn.report&&e.csdn.report.reportView&&e.csdn.report.reportView({spm:"3001.7765"});else{t.ajax({url:"https://blog.csdn.net/phoenix/web/v1/is-zero-article-user",type:"get",xhrFields:{withCredentials:!0},success:function(t){200===t.code&&(t.data?e.csdn.toolbarData.writeBtnData.btnBgNewWriterOld&&(o='\n \n '):e.csdn.toolbarData.writeBtnData.btnBgWriterOld&&(o='\n \n '))},complete:function(){t(".toolbar-btn-write").append(o),e.csdn&&e.csdn.report&&e.csdn.report.reportView&&e.csdn.report.reportView({spm:"3001.7765"})}})}else t(".toolbar-btn-write").append(o),e.csdn&&e.csdn.report&&e.csdn.report.reportView&&e.csdn.report.reportView({spm:"3001.7765"})},renderNewBtnWrite:function(){var n="https://mp.csdn.net/edit",o='创作';if(e.csdn.toolbarData&&e.csdn.toolbarData.writeBtnData&&e.csdn.toolbarData.writeBtnData.btnShow)if(!this.hasLogin&&e.csdn.toolbarData.writeBtnData&&e.csdn.toolbarData.writeBtnData.btnBgUnLogin)o='\n \n ',t(".toolbar-btn-write").append(o),e.csdn&&e.csdn.report&&e.csdn.report.reportView&&e.csdn.report.reportView({spm:"3001.7765"});else{t.ajax({url:"https://blog.csdn.net/phoenix/web/v1/is-zero-article-user",type:"get",xhrFields:{withCredentials:!0},success:function(t){200===t.code&&(t.data?e.csdn.toolbarData.writeBtnData.btnBgNewWriter&&(o='\n \n '):e.csdn.toolbarData.writeBtnData.btnBgWriter&&(o='\n \n '))},complete:function(){t(".toolbar-btn-write").append(o),e.csdn&&e.csdn.report&&e.csdn.report.reportView&&e.csdn.report.reportView({spm:"3001.7765"})}})}else t(".toolbar-btn-write").append(o),e.csdn&&e.csdn.report&&e.csdn.report.reportView&&e.csdn.report.reportView({spm:"3001.7765"})},renderMiniMenu:function(){var e=t('
      \n \n
      ');return this.$miniMenu.prepend(e),this},renderMiniMenuSidebar:function(){var e=t('
      \n
      \n
      \n
      \n
      ');return this.$miniMenu.prepend(e),this},renderMsgMenu:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.hasLogin){var t='';this.$btnsBox.find(".toolbar-btn-msg .toolbar-subMenu-box").append(t)}else this.setRemind("https://passport.csdn.net/account/login",0);D.length&&D.forEach(function(e){return e()})},renderMsgMenuNewVersion:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t="",n=!0,o=!1,r=void 0;try{for(var a,i=e[Symbol.iterator]();!(n=(a=i.next()).done);n=!0)!function(){var e=a.value,n={0:"评论通知",1:"用户关注",2:"互动通知",5:m(e.targetNickname||"")},o=n[e.previewType]||m(e.targetNickname||""),r="";try{if(["0","1","2"].includes(e.previewType))r=e.content.tt.replace(/{%\w+%}/g,function(t){return"{%url%}"===t?" ":"{%nickname%}"!==t||e.content.nickname?e.content[t.slice(2,-2)]:e.content.username||"csdn用户"});else{r=e.content.messageBody||"";var i=/\[face\]([^\]]+):([^\]]+)\[\/face\]/gi;i.test(r)&&(r=r.replace(i,'表情包'))}}catch(e){r="新消息"}var s="https://i.csdn.net/#/msg/chat/"+(5==e.previewType?e.targetUsername:"notice/"+e.previewType),c='\n \n
      \n \n
      \n
      \n
      \n
      \n '+o+'\n
      \n
      \n
      \n
      '+r+"
      \n
      \n
      \n
      \n ";t+=c}()}catch(e){o=!0,r=e}finally{try{!n&&i.return&&i.return()}finally{if(o)throw r}}if(this.hasLogin){var s='
      \n
      \n
      我的私信
      \n 查看全部\n
      \n
      \n '+t+"\n
      \n ";this.$btnsBox.find(".toolbar-btn-msg .toolbar-subMenu-box").append(s)}else this.setRemind("https://passport.csdn.net/account/login",0);D.length&&D.forEach(function(e){return e()})},getSessionList:function(){return new Promise(function(e,n){t.ajax({url:"https://msg.csdn.net/v1/im/preview",type:"get",data:{},xhrFields:{withCredentials:!0},success:function(t){if(!0===t.status){var n=t.data||[];e(n)}},error:function(t){e([])}})})},getAbTestData:function(){return new Promise(function(e,n){t.ajax({url:"https://msg.csdn.net/v1/im/abTest/isNewVersion",type:"get",xhrFields:{withCredentials:!0},success:function(t){!0===t.isNewVersion?e(!0):n()},error:function(){n()}})})},renderCoupon:function(n){var o=t('你有一张VIP限时优惠券哦');n&&n>0&&-1===e.location.href.indexOf("assign_skin_id")&&(this.$msgBox.append(o),setTimeout(function(){o.remove()},5e3))},renderGuide:function(e){var n=this,a=o("c-toolbar-loginguide"),i=t('登录查看未读消息');!a&&e&&(i.find("i").click(function(e){r("c-toolbar-loginguide",1,864e5),i.remove()}),!n.hasLogin&&e>0&&this.$msgBox.append(i))},renderLiveMsg:function(e){var n=this;if(e&&1===e.status){var o=t('
      \n '+e.title+'\n

      '+e.count+'人在看

      \n
      \n \n
      ');o.on("click",".toolbar-msg-live-close",function(e){o.remove()}),o.on("click",".toolbar-msg-live-title",function(t){n.reportLiveId(+e.messageId)}),n.$msgBox.append(o),setTimeout(function(){o.remove()},15e3)}},reportLiveId:function(e){if(e===e){var n={messageId:e};n=JSON.stringify?JSON.stringify(n):'{"messageId":'+e+"}",t.ajax({url:"https://msg.csdn.net/v1/web/message/view/live",type:"post",data:n,contentType:"application/json",xhrFields:{withCredentials:!0},dataType:"json",success:function(e){}})}},renderSearchHistoryDropMenu:function(){var e=this,n=this.getSearchHistoryData(),o=JSON.stringify({spm:"3001.7957"}),r=function(t,n){var o=k("3001.4501");return JSON.stringify({spm:o,index:""+n,dest:I+"?spm="+o+"&q="+encodeURIComponent(t),extra:{searchword:t,isDoublePlaceholder:e.isDoublePlaceholder?1:0}})},a=t('
      \n "+(n.length?'
      \n

      搜索历史清空

      \n
        \n '+n.map(function(e,t){return'
      • "+e+'
      • '}).join("")+"\n
      \n
      ":"")+"\n
      ");a.on("click",".toolbar-search-clear",function(t){e.clearSearchHistory(),a.find(".toolbar-search-history").remove(),a.removeClass("toolbar-search-half")}).on("click",".del",function(n){var o=t(this).parent().text();e.clearSingleSearchHistory(o),t(this).parent().remove(),n.stopPropagation()}).on("click","li",function(n){e.clickSearchItemHandler.call(e,t(this)),e.isMiniRenderSearch||e.setAnimate(e.$NavBox,{width:"auto"})}).on("mouseover","li.toolbar-search-item",function(e){t(this).addClass("active").siblings().removeClass("active"),t(this).find(".del").show()}).on("mouseleave","li.toolbar-search-item",function(){t(this).removeClass("active"),t(this).find(".del").hide()}),e.clearSeachDropMenu(),e.$searchHotAndHistoryDropMenu=a,setTimeout(function(){e.reportViewCheck()}),n.length?(e.$searchBox.append(a),e.getHotSearchData(function(){a.addClass("toolbar-search-half")},n)):e.getHotSearchData(function(){e.$searchBox.append(a)},n)},renderSearchHotDropMenu:function(e,n){var o=this,r=Array.isArray(e)?e.slice():[];if(this.isDoublePlaceholder&&this.placeholderRight&&this.placeholderRight.productId){r=r.filter(function(e){return e.productId!==o.placeholderRight.productId});var a=Object.assign({},this.placeholderRight,{productId:m(this.placeholderRight.productId)});r.unshift(a)}if(r.length){"function"==typeof n&&n();var i=function(e,t){var n=e.productId||e.word,r=k("3001.4502"),a=Object.assign({},e.reportData.data,{spm:r,index:""+t,dest:I+"?spm="+r+"&q="+encodeURIComponent(n),extra:{searchword:n,isDoublePlaceholder:o.isDoublePlaceholder?1:0}});try{var i=JSON.parse(e.reportData.data.extra);a.extra=Object.assign({},i,a.extra)}catch(e){}return JSON.stringify(a)},s=t('
      \n

      搜索发现

      \n
        \n '+r.map(function(e,t){return'
      • "+(e.productId||e.word)+"
      • "}).join("")+"\n
      \n
      ");s.on("mouseover",".toolbar-search-item",function(e){t(this).addClass("active").siblings().removeClass("active")}).on("mouseleave",".toolbar-search-item",function(){t(this).removeClass("active")}),this.$searchHotAndHistoryDropMenu.find(".toolbar-search-hot").remove(),this.$searchHotAndHistoryDropMenu&&this.$searchHotAndHistoryDropMenu.append(s),setTimeout(function(){o.reportViewCheck()})}},renderAssociateWordDropMenu:function(e){var n=t("#toolbar-search-input").val();if(this.searchInputFocus&&""!==n){var o=this,r=t(t.parseHTML('\n \n "));r.on("click","li",function(e){o.clickSearchItemHandler.call(o,t(this).find(".search-key-data")),o.isMiniRenderSearch||o.setAnimate(o.$NavBox,{width:"auto"})}),r.on("mouseover","li.toolbar-search-item",function(e){t(this).addClass("active").siblings().removeClass("active")}),this.$searchBox.append(r),this.reportViewCheck()}},clickSearchBtnHandler:function(n,o){var r=this.placeholder&&this.placeholder.productId||this.placeholderRight&&this.placeholderRight.productId,a=n||r;if(!n&&this.placeholder&&"csdn_ad"===this.placeholder.recommendType&&this.placeholder.ext&&this.placeholder.ext.url)return void e.open(this.placeholder.ext.url);if(void 0===a||null===a)return t("#toolbar-search-input").focus(),!1;var i=encodeURIComponent(a),s=!n&&r,c="",l=I+"?spm="+k(o)+"&q="+i+"&t="+f()+"&u=",d=s?this.urlParamsPlaceholder:this.urlParams;if(d){for(var p in d)if(d.hasOwnProperty(p)){var u=d[p];c+="&"+p+"="+u}l+=c}return this.urlParams="",e.location.href.indexOf("so.csdn.net")>-1?e.csdn&&e.csdn.toolbarSearchUrl?e.location.href=e.csdn.toolbarSearchUrl+i+c:e.location.href=l:e.open(l),l},clickSearchItemHandler:function(n){var o=this,r=[n.text(),n.data("type"),n.data("index")],a=r[0],i=r[1],s=r[2],c={},l="";if("hot"===i){var d=o.hotSearchData[s],p=d&&d.reportData;c=p?o.getHotSearchPointData(p,a):Object.assign({},c,{spm:"3001.4502"}),d&&"csdn_ad"===d.recommendType&&d.ext&&d.ext.url&&(l=d.ext.url)}else if("history"===i)c={spm:"3001.4501"};else{var u=this.searchAssociateWord[s],h=u&&u.reportData&&u.reportData.data;this.urlParams=u&&u.reportData&&u.reportData.urlParams,c=Object.assign({},h,{spm:"3001.7498"})}l?e.open(l):(t("#toolbar-search-input").val(a).blur(),l=o.clickSearchBtnHandler.call(o,a,c.spm));try{"string"==typeof c.extra&&(c.extra=JSON.parse(c.extra))}catch(e){}c.extra=Object.assign({},c.extra,{searchword:a,isDoublePlaceholder:this.isDoublePlaceholder?1:0}),Object.assign(c,{dest:l,index:""+s}),o.buriedPoint(c),o.clearSeachDropMenu(),o.isMiniRenderSearch||o.toggleSearchBarInput(),a&&o.toggleClearIcon(!0)},clickAnnouncementHandler:function(){this.hasLogin&&(t("#toolbar-announcement").find(">i").remove(),this.announcement&&(this.announcement.announcementCount=0),r("announcement-new",JSON.stringify(this.announcement),this.announcement.announcementExpire||3e5),this.clearReadAnnouncement())},clickLogoutBtnHandler:function(){var t={mod:"popu_789"},n="https://passport.csdn.net/account/logout?from="+encodeURIComponent(e.location.href);t.dest=n,t.extend1="退出",e.location.href=n,csdn&&csdn.report&&csdn.report.reportClick(t)},clearSeachDropMenu:function(){t(".toolbar-search-drop-menu").remove()},clearReadAnnouncement:function(){t.ajax({url:"https://msg.csdn.net/v1/web/message/read_announcement",type:"post",contentType:"application/json",xhrFields:{withCredentials:!0},dataType:"json",success:function(e){},error:function(e){void 0}})},setUserAvatar:function(e){var n=e.avatarUrl;e.totalCount;n&&(this.currentUser.avatar=n,t(".toolbar-btn-login").find(".hasAvatar img").attr("src",n),t("#csdn-toolbar-profile").find(".csdn-profile-avatar > img").attr("src",n))},getHotSearchPointData:function(e,t){this.urlParams=e.urlParams;var n=Object.assign({},e.data,{spm:"3001.4502",extra:{searchword:t,isDoublePlaceholder:this.isDoublePlaceholder?1:0}});try{Object.assign(n.extra,JSON.parse(e.data.extra))}catch(e){}return n},getReadAnnouncement:function(){var e=this;t.ajax({url:"https://msg.csdn.net/v1/web/message/view/announcement",type:"post",contentType:"application/json",xhrFields:{withCredentials:!0},dataType:"json",success:function(t){if(t.status){var n=t.data;e.announcement=n,r("announcement-new",JSON.stringify(n),n.announcementExpire||3e5),e.hasLogin?e.getUnreadMsg():e.renderMsgMenu({announcement:n})}},error:function(e){void 0}})},getUnreadMsg:function(){if(this.hasLogin||o("UN")){var e=this,n=JSON.stringify?JSON.stringify({coupon:!0}):'{"coupon":true}';t.ajax({url:"https://msg.csdn.net/v1/web/message/view/unread",type:"post",data:n,contentType:"application/json",xhrFields:{withCredentials:!0},dataType:"json",success:function(t){if(t.status){var n=t.data;e.setRemind("",n.totalCount),e.renderCoupon(n.coupon_order),e.renderGuide(n.totalCount),e.renderLiveMsg(n.live_info),e.setUserAvatar(n),e.getAbTestData().then(function(t){return e.getSessionList()},function(t){return e.renderMsgMenu(n),Promise.reject()}).then(function(t){e.renderMsgMenuNewVersion(t)}).catch(function(){})}}})}},getSearchHistoryData:function(){var e=this.searchHistoryArray.splice(0,10);return this.isDoublePlaceholder&&this.placeholder&&this.placeholder.productId&&(e.unshift(m(this.placeholder.productId)),e=Array.from(new Set(e))),e},getSearchHistoryArray:function(e){var n=this;t.ajax({url:"https://so.csdn.net/api/v1/get_search_his",type:"get",contentType:"application/json",dataType:"json",xhrFields:{withCredentials:!0},success:function(t){200==t.code&&(n.searchHistoryArray=t.data.map(function(e){return m(e)}),e&&e.call(n))},error:function(e){void 0}})},getHotSearchData:function(e,n){var r=this;if((new Date).valueOf()-r.copyHotSearchDataTime<=2e3&&r.hotSearchData)return void r.renderSearchHotDropMenu(r.hotSearchData,e);t.ajax({url:"https://silkroad.csdn.net/api/v2/assemble/list/channel/pc_hot_word",type:"get",data:{user_foormark:1,channel_name:"pc_hot_word",size:20,user_name:r.currentUser.userName,platform:"pc",imei:o("uuid_tt_dd")},xhrFields:{withCredentials:!0},contentType:"application/json",dataType:"json",success:function(t){if(200===t.code){var o=t.data&&t.data.items||[];Array.isArray(o)&&Array.isArray(n)&&(o=o.filter(function(e){return!n.includes(e.productId)})),o=o.slice(0,10),o.forEach(function(e){e.productId=m(e.productId)}),r.copyHotSearchData(o),r.renderSearchHotDropMenu(o,e)}},error:function(t){r.hotSearchData&&r.renderSearchHotDropMenu(r.hotSearchData,e)}})},getSearchAssociateWord:function(e,n){if(this.searchInputValue){if(e===this.historySearchInputValue)return this.clearSeachDropMenu(),void n(this.searchAssociateWord);var r=this;t.ajax({url:"https://silkroad.csdn.net/api/v2/rcmd/list/channel/pc_toolbar_associateword",type:"POST",data:JSON.stringify({channel:"pc_toolbar_associateword",ext:{isAcceptDownGrade:!0,summary:!0,query:e,pageSize:10,page:0,type:"suggest",deviceid:"-",platform:"pc",user_name:r.currentUser.userName,imei:o("uuid_tt_dd")},size:10}),contentType:"application/json",xhrFields:{withCredentials:!0},dataType:"json",success:function(t){if(200===t.code){if(r.clearSeachDropMenu(),!t.data.items.length)return;var o=t.data.items.map(function(e){return{productId:e.product_id,reportData:e.report_data,ext:e.ext}});r.searchAssociateType=t.data.ext.num_show,r.searchAssociateWord=o,r.historySearchInputValue=e,n&&n(o)}}})}},getHotSearchWordData:function(n){var r={new_hot_flag:1,channel_name:"pc_hot_word",size:20,user_name:this.currentUser.userName,platform:"pc",imei:o("uuid_tt_dd")};if(e.toolbarSearchExt)try{var a=_typeof(e.toolbarSearchExt);"object"===a?r.toolbarSearchExt=JSON.stringify(e.toolbarSearchExt):"string"===a&&(r.toolbarSearchExt=e.toolbarSearchExt)}catch(e){void 0}var i=this;t.ajax({url:"https://silkroad.csdn.net/api/v2/assemble/list/channel/search_hot_word",type:"get",data:r,contentType:"application/json",dataType:"json",xhrFields:{withCredentials:!0},success:function(e){if(200===e.code){var t=e.data&&e.data.items||[];r.toolbarSearchExt?this.isDoublePlaceholder=!1:i.isDoublePlaceholder=e.data&&e.data.ext&&e.data.ext.ab_test_ext&&"1"===e.data.ext.ab_test_ext.his_foot_flag,t.length&&(i.utm_medium=e.data.ext.utm_medium||"",i.isDoublePlaceholder?(i.placeholderList=t.filter(function(e){return!!e.productId&&"alirecmd"===e.strategyId}),i.placeholderListRight=t.filter(function(e){return!!e.productId&&"alirecmd"!==e.strategyId})):(i.placeholderList=t.filter(function(e){return!!e.productId}),i.placeholderListRight=null),i.setPlaceholderInterval(i.placeholderList,i.placeholderListRight)),n&&n()}},error:function(e){void 0}})},refreshPlaceholder:function(){this.setPlaceholderInterval(this.placeholderList,this.placeholderListRight,this.placeholderIndex)},setPlaceholderInterval:function(e){var n=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=e&&e.length?r%e.length:0,i=o&&o.length?r%o.length:0;this.placeholder=e&&e[a]||null,this.placeholderRight=this.isDoublePlaceholder&&o&&o[i]||null,setTimeout(function(){n.setSearchInputPlaceholder(n.placeholder,n.placeholderRight),!n.isDoublePlaceholder&&n.placeholder&&a<3||n.isDoublePlaceholder&&n.placeholderRight&&i<3?(t(".icon-fire").show(),t("#toolbar-search-input").css("textIndent","32px")):(t(".icon-fire").hide(),t("#toolbar-search-input").css("textIndent","12px"))},200),this.placeholderIndex=r,clearTimeout(this.placeholderTimeout),this.placeholderTimeout=setTimeout(function(){n.setPlaceholderInterval(e,o,r+1)},5e3)},copyHotSearchData:function(e){if(e){var t=this;t.hotSearchData=e,t.copyHotSearchDataTime=(new Date).getTime()}},clearSingleSearchHistory:function(e){t.ajax({url:"https://so.csdn.net/api/v1/del_one_search_his?del_query="+e,type:"get",contentType:"application/json",dataType:"json",xhrFields:{withCredentials:!0},error:function(e){void 0}})},clearSearchHistory:function(){this.isDoublePlaceholder&&(this.placeholderList=[]),t.ajax({url:"https://so.csdn.net/api/v1/del_search_his",type:"get",contentType:"application/json",dataType:"json",xhrFields:{withCredentials:!0},error:function(e){void 0}})},getSearchInputPlaceholder:function(){return this.placeholder?this.placeholder&&this.placeholder.productId:~location.host.indexOf("edu")?"搜学院课程":"搜CSDN"},setSearchInputPlaceholder:function(e,n){this.urlParamsPlaceholder=e&&e.reportData&&e.reportData.urlParams;var o=e&&e.productId||"",r=n&&n.productId||"",a="";this.searchInputFocus?a=o||r||"":o&&r?(o=o.slice(0,12),r=r.slice(0,12),a=o+" | "+r):a=o||r||"",this.reportPlaceholderView(e),this.reportPlaceholderView(n),a&&t("#toolbar-search-input").attr("placeholder",a)},reportPlaceholderView:function(n){try{if(!n||"csdn_ad"!==n.recommendType||n.isViewReported||t("#toolbar-search-input").val())return;var o=n.reportData.data;o.spm="3001.7499",e.csdn.report.reportView(o),n.isViewReported=!0}catch(e){}},isEffectiveTime:function(e){if(!e)return!1;if(e.always)return!0;var t=(new Date).valueOf(),n=new Date(e.start).valueOf();return t<=new Date(e.end).valueOf()&&t>=n},getCurrentLogoData:function(e){var t=this;return Array.isArray(e)?e.reduce(function(e,n){return e="default"!==n.type||e?e:n,e=t.isEffectiveTime(n.time)?n:e},void 0):"object"===(void 0===e?"undefined":_typeof(e))?e:t.logoData},getToolbarData:function(n){var o=this;t.ajax({url:"https://img-home.csdnimg.cn/data_json/toolbar/toolbar1105.json",type:"get",dataType:"JSON",contentType:"application/x-www-form-urlencoded; charset=utf-8",success:function(t){void 0,o.navData=t.menus.slice(0,t.menus.length-1),o.vipData=t.menus.pop(),void 0,void 0,o.logoData=o.getCurrentLogoData(t.logo),void 0,o.background=t.background,o.redpackData=t.redpackData,o.mpMenuData=t.mpMenuData?t.mpMenuData:o.mpMenuData,o.searchLoginAb=t.searchLoginAb?t.searchLoginAb:null,o.searchLoginAbSpm=t.searchLoginAbSpm?t.searchLoginAbSpm:null,o.cknowData=t.cknowAb?t.cknowAb:null,o.searchToolbarData=t.searchToolbar?t.searchToolbar:null,e.csdn.toolbarData=t,n&&n.call(o)},error:function(e){n&&n.call(o)}})},hasShowMpMenu:function(){return!("normal"!==C||!this.mpMenuData.isShow||void 0===this.mpMenuData.maxSegment)&&o("c_segment")<=parseInt(this.mpMenuData.maxSegment)},getMpMenuIcon:function(){if(!this.mpMenuData.isShow)return"";if(this.mpMenuData.icon&&this.mpMenuData.icon.length>0){return''}return""},buriedPoint:function(e){try{csdn&&csdn.report&&csdn.report.reportClick(e)}catch(e){void 0}},reportViewCheck:function(){try{csdn&&csdn.report&&csdn.report.viewCheck()}catch(e){void 0}},setDocumentTitle:function(e){var t=document.title;e>0&&(document.title="("+e+"条消息) "+t)},setRemind:function(e,n){var r=t("#toolbar-remind"),a=t(".toolbar-inside").hasClass("exp2");this.hasLogin;var i=o("toolbar_remind_num")?o("toolbar_remind_num"):0;r.html(''+(a?"":"消息")+(!this.hasLogin&&i<3||n>0?'':"")+"")},setAnimate:function(e,t,n){n&&e.animate(t,n)||e.css(t)},toggleNavItems:function(e,t){var n=this.$NavBox.find(">li").eq(e).nextAll();t&&n.show()||n.hide()},getNavItemsWidthByCount:function(e){var n=0;return this.$NavBox.find(">li").eq(e).prevAll().each(function(e,o){n+=t(this).width()}),n+=4},toggleSearchBarInput:function(e){var n=t(document).width();if(!(n>1440)){var o=5;1366=0)return"background: url("+r+") no-repeat center center;background-size: cover;";if(r.indexOf("#")>=0)return"background: "+r}},setToolbarMsgCountByType:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e&&this.hasLogin){var o=t(".toolbar-btn-msg").find('a[data-type="'+e+'"]');if(0!==o.length){o.find("i").remove(),o.html(''+o.text()+(n>0?"":"")+"");var r=t(".toolbar-btn-msg").find(".toolbar-subMenu a i").length;void 0,this.setRemind("",r)}}},chain:function(){var e=o("UserName");return v("toolbarReady"),e?this.getUnreadMsg():this.renderMsgMenu(),a("announcement"),a("announcement_new"),a("searchHistoryArray"),a("searchHistoryArray-new"),this}},function(){var e=t('meta[name="toolbar"]'),o="",r=0,a=0;if(e.length){var i=e.attr("content")||{};i=JSON.parse(i),r=i.type||r,C=i.model||C,a=i.fixModel||a}else r=b("toolbarSkinType")||r ;o="https://g.csdnimg.cn/common/csdn-toolbar/"+S[r]+".css",T=r,$=a,-1===location.host.indexOf("loc-toolbar")&&n(o)}();var B=new _;e.csdn.toolbar={setToolbarMsgCountByType:B.setToolbarMsgCountByType.bind(B),configuration_tool_parameterv:g,renderSeasrchBox:B.outPutSearchMethod.bind(B)}}(window,jQuery),function(){function e(e){return e.some(function(e){return"*"===e||!!~location.href.indexOf(e)})}function t(e){return e.some(function(e){return new RegExp("^http(s)?:\\/\\/("+e+")(\\/|\\/\\?)?(spm=\\S*)?$").test(location.href)})}var n=function(){function e(){_classCallCheck(this,e),this.active={},this.loginUrl="https://passport.csdn.net/account/login?from="+encodeURIComponent(window.location.href)}return _createClass(e,[{key:"init",value:function(){this.getActiveData()}},{key:"getActiveData",value:function(){var e=this,t=this;$.ajax({url:"https://mp-activity.csdn.net/activity/report",type:"post",contentType:"application/json; charset=utf-8",xhrFields:{withCredentials:!0},data:JSON.stringify({pageUrl:window.location.href,action:"pageView",platform:"pc"}),dataType:"json",success:function(n){void 0;var o=n.data;return t.active=o,!(!o.matched||"popWindow"!==o.operationCommand)&&(o.ext.report&&-1!==o.ext.report.indexOf("exposure")&&window.csdn&&window.csdn.report&&window.csdn.report.reportView({spm:e.active.ext.spm}),"center"===o.ext.position?(t.renderCenterDom(),t.renderCenterCss()):"right"===o.ext.position?(t.renderRightDom(),t.renderRightCss()):(t.renderCenterDom(),t.renderCenterCss()),!1)},error:function(e){void 0}})}},{key:"handleClose",value:function(){var e=$("#csdn-active-dialog .closeBtn"),t=$("#csdn-active-mask");void 0,e.click(function(){void 0,$("#csdn-active-mask").remove(),$("#csdn-active-dialog").remove()}),t.click(function(){void 0,$("#csdn-active-mask").remove(),$("#csdn-active-dialog").remove()})}},{key:"handleJump",value:function(){var e=$("#csdn-active-dialog .active_main");void 0,e.click(function(){void 0,$("#csdn-active-mask").remove(),$("#csdn-active-dialog").remove()})}},{key:"renderCenterDom",value:function(){void 0;var e='\n
      \n
      \n
      \n \n \n
      \n
      \n ';if($("body").append(e),this.handleClose(),this.handleJump(),-1!=this.active.ext.popUpDuration)var t=setTimeout(function(){$("#csdn-active-mask").remove(),$("#csdn-active-dialog").remove(),clearTimeout(t)},1e3*this.active.ext.popUpDuration)}},{key:"renderRightDom",value:function(){void 0;var e='\n
      \n
      \n
      \n \n \n
      \n
      \n ';if($("body").append(e),this.handleClose(),this.handleJump(),-1!=this.active.ext.popUpDuration)var t=setTimeout(function(){$("#csdn-active-mask").remove(),$("#csdn-active-dialog").remove(),clearTimeout(t)},1e3*this.active.ext.popUpDuration)}},{key:"renderCenterCss",value:function(){void 0;var e=$('');document.head.insertBefore($(e)[0],document.head.getElementsByTagName("title")[0])}},{key:"renderRightCss",value:function(){void 0;var e=$('');document.head.insertBefore($(e)[0],document.head.getElementsByTagName("title")[0])}}]),e}();$(document).on("toolbarReady",function(o){var r=window.csdn.toolbarData||{},a=r.activeData;void 0,a&&a.whiteList&&e(a.whiteList)&&(void 0,(new n).init()),a&&a.whiteRegexList&&t(a.whiteRegexList)&&(void 0,(new n).init())})}(),function(){!function(){function e(){_classCallCheck(this,e)}_createClass(e,[{key:"init",value:function(){"www.csdn.net"===window.location.host&&"/"===window.location.pathname&&this.renderStyle()}},{key:"renderStyle",value:function(){var e=document.createElement("style");e.innerHTML="\n html {\n -webkit-filter: grayscale(100%); /* webkit */\n -moz-filter: grayscale(100%); /*firefox*/\n -ms-filter: grayscale(100%); /*ie9*/\n -o-filter: grayscale(100%); /*opera*/\n filter: grayscale(100%);\n filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);\n }\n body{\n filter:gray; /*ie9- */\n background : none!important;\n }\n ",document.querySelector("head").appendChild(e)}}])}()}(),function(){function e(e){for(var t=document.cookie.split("; "),n=0;n0){var o=n.data[0];if(-1===[536,539,541].indexOf(o.adPositionId))return;switch(o.adType){case"baodeng":var d=n.data.reduce(function(e,t,n){return 0===n?e=Object.assign({},t,{children:[]}):e.children.push(t),e},{});void 0,a(d);break;case"code":i(o)}}}else csdn&&csdn.toolbarData&&csdn.toolbarData.advert&&csdn.toolbarData.advert.checkPlugin&&541!==t&&setTimeout(function(){!s()&&!c()||l()||r(e,541)},5e3)}})}function a(r){var a=!!e("is_advert");if(!r)return void n("is_advert");var i="width:100%; height:100%; background-image: url("+r.imgUrl+"); background-size: auto 80px;background-repeat: no-repeat; background-position: center center;",s="width:100%; height:100%; background-image: url("+r.bigImgUrl+"); background-size: auto 320px;background-repeat: no-repeat; background-position: center center;",c=$('');c.find(".toolbar-adver-btn").click(function(e){return c.remove(),o("toolbarHeightChange"),r.closeAdClickUrl&&$.ajax({url:r.closeAdClickUrl,type:"get",dataType:"JSON",contentType:"application/x-www-form-urlencoded; charset=utf-8",xhrFields:{withCredentials:!0},success:function(e){}}),!1}),c.on("click",".toolbar-advert-more-item",function(e){var t=$(this).data("adress")?$(this).data("adress"):"";return t&&window.open(t,"_blank"),e.stopPropagation(),!1}),$("#csdn-toolbar").prepend(c),o("toolbarHeightChange"),!a&&t("is_advert","1",864e5),c.on("transitionend",function(e){o("toolbarHeightChange")}),setTimeout(function(){!a&&$(".toolbar-advert-default").removeClass("toolbar-advert-lg").find("div").attr("style",i),o("toolbarHeightChange")},1e3*(r.showSeconds||5))}function i(e){var t=$('
      ');if(e.content&&t.append(e.content),e.exposureUrl){var n=$('');t.append(n)}o("toolbarHeightChange"),$("#csdn-toolbar").prepend(t),setTimeout(function(){o("toolbarHeightChange")},200)}function s(){var e=$('
      ');if($("#csdn-toolbar").append(e),e.is(":hidden"))return e.remove(),!0;e.remove()}function c(){return $("#greenerSettings").length}function l(){return $("#open_chromePlugin_tab").length}var d=!1;$(document).on("toolbarReady",function(e){void 0,void 0,void 0,(window.csdn.toolbarData.advert.blacklist||[]).indexOf(location.host)>=0||r()})}(),function(){function e(e){for(var t=document.cookie.split("; "),n=0;n10&&clearTimeout(this.timer)}},{key:"getBarrageList",value:function(){var e=this.allData.slice(0,3);return this.allData=this.allData.slice(3),e.map(function(e){return Object.assign({},e,{x:0,speed:2+Number(Math.random().toFixed(1)),stop:!1})})}},{key:"start",value:function(){for(var e=this,n=document.documentElement.clientWidth,o=0,r=0;r=-e.barrageBoxWidth&&!e.barrageList[r].stop)requestAnimationFrame(e.fnArr[r]);else if(n+e.barrageList[r].x<-e.barrageBoxWidth&&!e.barrageList[r].stop&&++o===e.barrageDomArr.length){if(e.fnArr=[],$("#barrageBox").remove(),!e.checkIsPassport()){var a=e.getTomorrowTimeRemaining();t("ad_last_time",Date.now(),a)}e.barrageList=e.getBarrageList(),e.barrageList.length?(e.renderBarrage(),e.start(),e.insertAdCookie()):e.setTimer()}})}(r);for(var a=0;a\n '+(this.barrageList[o].type?"":'')+'\n \n \n
      '+this.barrageList[o].nickname.slice(0,10)+":"+this.barrageList[o].content+'
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n '}$("#csdn-toolbar").append('
      '+n+"
      "),this.barrageDomArr=[].concat(_toConsumableArray(document.querySelectorAll("#barrageBox .barrage-item")));var i=$("#barrageBox");this.barrageBoxWidth=i.width()+26,i.css({right:-this.barrageBoxWidth+"px"});var s=this;i.on("mouseenter",".barrage-item",function(){s.barrageList[$(this).index()].stop=!0}),i.on("mouseleave",".barrage-item",function(){s.barrageList[$(this).index()].stop=!1,requestAnimationFrame(s.fnArr[$(this).index()])}),i.on("click",".barrage-close",function(){$("#barrageBox").remove(),clearTimeout(s.timer),t("hideBarrage","1",s.getTomorrowTimeRemaining())}),i.on("click",".barrage-follow",function(){$(this).hasClass("is-follow")||s.follow(s.barrageList[$(this).parent().index()].username)}),i.on("click",".barrage-link.barrage-link-redpack",function(){if(e("UserName")){if(!$(this).hasClass("already")){var t=$(this).parent().index();window.csdn.barrageRedpack&&window.csdn.barrageRedpack.open(s.barrageList[t].typeId),$(this).addClass("already").parent().addClass("barrage-link-hide")}}else window.location.href="https://passport.csdn.net/account/login?from="+encodeURIComponent(window.location.href)})}},{key:"insertAdCookie",value:function(){var n=e("ad_barrage_ids")||"",o=n?n.split(","):[];for(o=[].concat(_toConsumableArray(new Set(o.concat(this.barrageList.filter(function(e){return e.isAddCookie}).map(function(e){return e.barrageId})))));o.length>500;)o.shift();t("ad_barrage_ids",o.join(","),864e5)}},{key:"setTimer",value:function(){var e=this;clearTimeout(this.timer),this.timer=setTimeout(function(){e.queryBarrage()},1e3*this.pollDelay)}},{key:"resetErrorCount",value:function(){this.errorCount=0}},{key:"bindToolbarHeightChange",value:function(){var e=this;$(document).on("toolbarHeightChange",function(){e.getToolbarHeight();var t=$("#barrageBox");t.length&&t.css("top",e.toolbarHeight+32+"px")})}},{key:"getToolbarHeight",value:function(){var e=$("#csdn-toolbar");this.toolbarHeight=e.length?e.height():44}},{key:"handlePageVisibilityChange",value:function(){var e,t,n=this;void 0!==document.hidden?(e="hidden",t="visibilitychange"):void 0!==document.msHidden?(e="msHidden",t="msvisibilitychange"):void 0!==document.webkitHidden&&(e="webkitHidden",t="webkitvisibilitychange");var o=function(){document[e]?clearTimeout(n.timer):!$("#barrageBox").length&&n.setTimer()};document.addEventListener(t,o,!1)}},{key:"getTomorrowTimeRemaining",value:function(){var e=(new Date).getFullYear()+"/"+((new Date).getMonth()+1)+"/"+((new Date).getDate()+1);return new Date(e)-Date.now()}},{key:"follow",value:function(t){var n=this;e("UserName")?e("UserName")!==t&&$.ajax({url:"https://me.csdn.net/api/relation/create",type:"post",contentType:"application/x-www-form-urlencoded; charset=utf-8",xhrFields:{withCredentials:!0},data:JSON.stringify({username:t}),dataType:"json",success:function(e){n.changeFollowStatus(t)},error:function(e){n.changeFollowStatus(t)}}):window.location.href="https://passport.csdn.net/account/login?from="+encodeURIComponent(window.location.href)}},{key:"changeFollowStatus",value:function(e){$("#barrageBox").find(".barrage-item").each(function(){$(this).find(".barrage-follow").attr("data-username")===e&&$(this).find(".barrage-follow").addClass("is-follow").text("已关注")})}},{key:"checkIsPassport",value:function(){return!!~window.location.href.indexOf("passport.csdn.net")}}]),n}();$(document).on("toolbarReady",function(){var e=window.csdn.toolbarData.barrageData.whiteList;e.length&&n(e)&&(new o).init()})}(),function(){function e(){return n("UserName")}function t(e){window.csdn&&window.csdn.loginBox&&window.csdn.loginBox.show?window.csdn.loginBox.show(e):window.location.href="https://passport.csdn.net/account/login"+(e?"?spm="+e.spm:"")}function n(e){for(var t=document.cookie.split("; "),n=0;n\n
        '+this.renderLeft()+"
      \n
      ")+'\n \n
      \n '+this.renderRight()+'\n
      \n
      \n \n ';this.container.append(e),1==this.data.length&&$(".toolbar-collection-left").hide(),this.isHideOnce&&$("#csdn-toolbar-collection").hide(),this.bindToggleFolder(),this.bindToMore()}}},{key:"renderLeft",value:function(){for(var e="",t=0;t/g,">");e+="\n \n
      '+n+"
      \n "+(0==t?"":'
      '+this.data[t].num+"
      ")+"\n
    • \n "}return e}},{key:"renderRight",value:function(){if(this.data[this.currentIndex].contentList.length){for(var e="",t=0;t\n \n "+n.source+'\n '+n.title+"\n \n \n "}return'
        '+e+"
      "+(this.data[this.currentIndex].num>15?'查看更多':"")}return'\n
      \n
      空空如也
      \n
      \n '}},{key:"show",value:function(){clearTimeout(this.timer),this.timer=setTimeout(function(){o&&$("#csdn-toolbar-collection").stop().fadeIn(100)},150)}},{key:"hide",value:function(){this.isHideOnce=!0,clearTimeout(this.timer),o||$("#csdn-toolbar-collection").stop().fadeOut(100)}}]),e}(),a=function(){function e(){_classCallCheck(this,e),this.container=$(".toolbar-btn.toolbar-btn-collect"),this.init()}return _createClass(e,[{key:"init",value:function(){var e=$('
      \n
      \n
      登录即可查看浏览历史和收藏
      \n 立即登录\n
      ');this.container.append(e),e.find("a.csdn-toolbar-loginbtn").on("click",function(){var e=$(this).data("report-click");$("#csdn-toolbar-collection-nologin").hide(),e?t(e):t()})}},{key:"show",value:function(){clearTimeout(this.timer),this.timer=setTimeout(function(){o&&$("#csdn-toolbar-collection-nologin").stop().fadeIn(100)},150)}},{key:"hide",value:function(){this.isHideOnce=!0,clearTimeout(this.timer),o||$("#csdn-toolbar-collection-nologin").stop().fadeOut(100)}}]),e}();$(document).on("toolbarReady",function(){if(e()){var t=null,n=$(".toolbar-btn.toolbar-btn-collect");n.on("mouseenter",function(){o=!0,t?t.show():t=new r}),n.on("mouseleave",function(){o=!1,t.hide()})}else{void 0;var i=null,s=$(".toolbar-btn.toolbar-btn-collect");s.on("mouseenter",function(){o=!0,i?i.show():i=new a}),s.on("mouseleave",function(){o=!1,i.hide()})}})}(),function(){function e(e){for(var t=document.cookie.split("; "),n=0;n=0&&r.toolbarImg&&(o.olduser={def:r.toolbarImg,dark:r.toolbarImg,left:3===r.type?"-130":"-148"}),this.creativeSet(a,o,r)}else{var i=this;n?$.ajax({url:"https://blog.csdn.net/phoenix/web/v1/get-novice-period-info",type:"get",xhrFields:{withCredentials:!0},success:function(e){var r=0;if(200===e.code&&e.data){0===e.data.articleNum?e.data.toolbarImg?(r=0===e.data.type?3:2,o.newuser={def:e.data.toolbarImg,dark:e.data.toolbarImg,left:3===r?"-130":"-148"}):r=1:e.data.toolbarImg&&(o.olduser={def:e.data.toolbarImg,dark:e.data.toolbarImg,left:3===r?"-130":"-148"});var a=e.data;a.userName=n,t("creativeSetApiNew",JSON.stringify(a),3e5)}i.creativeSet(r,o,a)}}):this.creativeSet(0,o,null)}}},{key:"creativeSet",value:function(e,o,a){if(null!==a&&(a.useSeven||a.oldUser)&&$(".toolbar-btn.toolbar-btn-write").addClass("is-traffic"),this.container.append('\n \n '),window.csdn&&window.csdn.report&&window.csdn.report.reportView&&window.csdn.report.reportView({spm:"3001.9762",extra:{dataType:e}}),o){var i="",s="",c="olduser";e>0&&(c="newuser"),i=1==r?o[c].dark:o[c].def,s=o[c].left+"px",$(".csdn-toolbar-creative-mp-bg").attr("src",i),$(".csdn-toolbar-creative-mp").css("left",s);var l="old";e>0&&n<3?($(".csdn-toolbar-creative-mp").show(),l="new",setTimeout(function(){$(".csdn-toolbar-creative-mp").hide()},5e3),window.csdn&&window.csdn.report&&window.csdn.report.reportView&&window.csdn.report.reportView({spm:"3001.9743",extra:{dataType:"new"}})):n<3&&(n=parseInt(n)+1,t("creative_btn_mp",n,864e5),$(".csdn-toolbar-creative-mp").show(),setTimeout(function(){$(".csdn-toolbar-creative-mp").hide()},5e3),window.csdn&&window.csdn.report&&window.csdn.report.reportView&&window.csdn.report.reportView({spm:"3001.9743",extra:{dataType:"old"}})),$(".csdn-toolbar-creative-mp-close").on("click",function(){$(".csdn-toolbar-creative-mp").hide(),window.csdn&&window.csdn.report&&window.csdn.report.reportView&&window.csdn.report.reportClick({spm:"3001.9744",extra:{dataType:l}}),t("creative_btn_mp",3,864e5)})}}},{key:"hide",value:function(){$("#csdn-toolbar-write").stop().fadeOut(100)}}]),a}();$(document).on("toolbarReady",function(){var e=null;o=window.csdn.toolbarData.toolbarBtnMpAsk||"",e||(e=new c)})}(),function(){function e(e,t){var n=document.createElement("script");n.type="text/javascript",n.readyState?n.onreadystatechange=function(){"loaded"!=n.readyState&&"complete"!=n.readyState||(n.onreadystatechange=null,t&&t())}:n.onload=function(){t&&t()},n.src=e,document.getElementsByTagName("head")[0].appendChild(n)}!function(){var t=window.location.href;["https://download.csdn.net/*","https://wenku.csdn.net/*","https://mall.csdn.net/*","https://qualcomm.csdn.net/*","https://vip.csdn.net/*","https://editor.csdn.net/*","https://mp.csdn.net/mp_blog/creation/editor","https://www.csdn.net/vip"].some(function(e){return new RegExp("^"+e.replace(/\*/g,".*").replace(/\./g,"\\.")).test(t)})||e("https://g.csdnimg.cn/common/csdn-cert-new/csdn-cert-new.js",function(){})}()}(),function(){function e(){return window.csdn.toolbarData.menus.filter(function(e){return e.slider&&e.slider.list&&e.slider.list.length>0})}var t=function(){function e(t){_classCallCheck(this,e),this.sliderArray=t,this.init()}return _createClass(e,[{key:"init",value:function(){this.initSliderScroll()}},{key:"initSliderScroll",value:function(){var e=this;this.sliderArray.forEach(function(t){$(".toolbar-subSlider-"+t.id).children().length&&e.sliderScroll(".toolbar-subSlider-"+t.id,$(".toolbar-subSlider-"+t.id).children().length,t.slider.time||4)})}},{key:"sliderScroll",value:function(e,t,n){var o=0,r=$(e);setInterval(function(){o===t-1?(o+=1,r.append(r.children().first().clone()),r.css({"margin-top":-48*o+"px",transition:"all 0.8s"})):o>=t?(o=0,r.css({"margin-top":"0px",transition:"none"}),r.children("a").last().remove()):(o+=1,r.css({"margin-top":-48*o+"px",transition:"all 0.8s"}))},1e3*n),r.on("transitionend",function(){o>=t&&(o=0,r.css({"margin-top":"0px",transition:"none"}),r.children("a").last().remove())})}}]),e}();$(document).on("toolbarReady",function(){var n=e();n.length&&new t(n)})}(),function(){function e(e){for(var t=document.cookie.split("; "),n=0;n-1&&window.location.href.indexOf("/article/details")>-1,~location.href.indexOf("blog.csdn.net")&&!this.isBlogDetail||this.init()}var i=!1;a.prototype.init=function(){this.isHighSchoolIp()},a.prototype.render=function(){var e=this;this.$main=$('
      \n \n \n \n
      '),this.isLogin?this.hasCert||this.renderSelect():this.renderSelect(),this.$main.find(".csdn-highschool-close").on("click",function(){e.close(e.closeValue)}),$("body").append(this.$main),r({spm:this.reportUV})},a.prototype.renderSelect=function(){var e=this,t=$('
      \n

      认证学生身份,立享VIP折扣

      \n
      \n

      您是否为学生:

      \n
      \n \n \n
      \n
      \n
      确定
      \n
      ');t.find(".highschool-radio").on("click",function(t){e.$main.find(".csdn-highschool-countdown").remove(),$(".highschool-submit").removeClass("cannot-select"),clearInterval(e.countDown),e.countDown=""}).on("click","input",function(t){e.radioValue=t.target.value}),t.find(".highschool-submit").on("click",function(){e.radioValue&&("cert"===e.radioValue?(window.open(e.certUrl,"_blank"),o({spm:e.reportUV,extend1:"是"})):o({spm:e.reportUV,extend1:"否"}),e.close(e.closeValue))}),this.$main.append(t)},a.prototype.renderAccount=function(){var e=this,t=$('');t.find(".highschool-submit").on("click",function(){window.open(e.schoolCommunityUrl,"_blank"),e.close(e.closeValue)}),this.$main.append(t)},a.prototype.isHighSchoolIp=function(){var e=this;$.ajax({url:this.IPurl,type:"get",contentType:"application/json",xhrFields:{withCredentials:!0},dataType:"json",success:function(t){void 0,t&&(e.isLogin?e.getAccountInfo():(e.render(),e.count()))},error:function(e){void 0}})},a.prototype.getAccountInfo=function(){var e=this;$.ajax({url:"https://g-api.csdn.net/community/personal-api/v1/get-school-community",type:"get",contentType:"application/json",xhrFields:{withCredentials:!0},dataType:"json",success:function(t){void 0,200===t.code&&t.data&&t.data.studentCertification?(e.hasCert=!0,e.reportUV="3001.6434",e.schoolName=t.data.schoolName,e.schoolCommunityUrl=t.data.schoolCommunityUrl):(e.render(),e.count())},error:function(t){e.render(),e.count(),void 0}})},a.prototype.close=function(e){this.$main.remove(),clearInterval(this.countDown),this.countDown="",t("csdn_highschool_close",e||"close",864e5)},a.prototype.count=function(){var e=this,t=this.closeTime;this.countDown=setInterval(function(){0===t?e.close(e.closeValue):(e.$main.find(".csdn-highschool-countdown").html(t+"秒"),t--)},1e3)},$(document).on("toolbarReady",function(t){var o=window.csdn.toolbarData||{},r=o.highSchoolData;r&&r.whiteList&&n(r.whiteList)&&(!e("csdn_highschool_close")||e("UserName")&&"nologin_close"===e("csdn_highschool_close"))&&(window.csdn.highSchool=new a)})}(),function(){function e(e){for(var t=document.cookie.split("; "),n=0;n-1&&"/"!==document.location.pathname){window._hmt=window._hmt||[],window._hmt.push(["_setAccount","ec8a58cd84a81850bcbd95ef89524721"]),window._hmt.push(["_setPageviewProperty",{uid:e("UserName")||e("UN")||"",cid:e("uuid_tt_dd")||""}]);var n=document.createElement("script");n.src="https://hm.baidu.com/hm.js?ec8a58cd84a81850bcbd95ef89524721";var o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(n,o)}}}catch(e){}}(),function(){function e(e){for(var t=document.cookie.split("; "),n=0;n0&&void 0!==arguments[0]?arguments[0]:window;return e&&$(e).height()}function o(){return!!e("needShowLoginBoxAuto")}function r(){return e("UserName")}function a(){var e=!window.csdn||void 0===window.csdn.needShowLoginBoxAuto||!!window.csdn.needShowLoginBoxAuto;window.csdn&&window.csdn.loginBox&&e&&!o()&&!r()&&(setTimeout(function(){try{window.csdn.loginBox.show()}catch(e){void 0}},800),t("needShowLoginBoxAuto","1",60*c.hours*60*1e3))}function i(){$(window).on("scroll",function(e){var t=$(this).scrollTop(),o=n(document),r=n(window);void 0,t>=(o-r)*c.ratio&&a()})}function s(e){return e&&e.some(function(e){return"*"===e||!!~location.href.indexOf(e)})}var c={whiteList:["loc-toolbar.csdn.net"],blackList:[],ratio:.5,hours:6};try{window.csdn=window.csdn||{},csdn.loginBox=csdn.loginBox||{},csdn.loginBox.loginBoxParams={isClosedBtn:!0}}catch(e){void 0}$(document).on("toolbarReady",function(e){var t=window.csdn.toolbarData||{};if(c=Object.assign({},c,t.loginBoxData),void 0,c&&s(c.whiteList)&&!s(c.blackList)){var o=n(document),r=n(window);void 0,(o-r)*c.ratio<100?(void 0,a()):(void 0,i())}})}(),function(){function e(e){for(var t=document.cookie.split("; "),n=0;n0){var n=t.data[0];e(n)}}else;}})}function a(e){if(e&&e.file2){var o=$('
      \n \n \n
      \n \n

      '+e.nickName+'

      \n \n
      \n \n
      \n
        \n '+e.list.map(function(e){return'
      • '+e.name+"
      • "}).join("")+"\n
      \n
      \n
      ");return this.$box.append(t),this.$tpl=t,this.$box.on("mouseenter",function(t){void 0,e.isEenter=!0,e.isRender&&e.showProfile()||e.getData()}).on("mouseleave",function(t){void 0,e.isEenter=!1,e.hideProfile()}),this.$tpl.find(".csdn-profile-logout").on("click",function(e){$.ajax({type:"post",url:"https://passport.csdn.net/account/logout",data:JSON.stringify({}),crossDomain:!0,xhrFields:{withCredentials:!0},success:function(e){var t={mod:"popu_789"},n="https://passport.csdn.net/account/logout?from="+encodeURIComponent(window.location.href);t.dest=n,t.extend1="退出",csdn&&csdn.report&&csdn.report.reportClick(t),window.location.reload()},error:function(e){}})}),this},l.prototype.update=function(e){if(e){var t=e.fansCount,n=e.likeCount,o=e.favoritesCount,r=e.nickName,a=e.followCount;this.avatar=e.avatar,this.toggleVip(e),this.isRender=!0,$(".toolbar-btn-login").find(".hasAvatar img").attr("src",e.avatar),$(".csdn-profile-fansCount").text(t||"--"),$(".csdn-profile-likeCount").text(n||"--"),$(".csdn-profile-favoritesCount").text(o||"--"),$(".csdn-profile-nickName").text(r||"--"),$(".csdn-profile-followCount").text(a||"--")}},l.prototype.toggleVip=function(e){this.isVip=1===e.vip,this.isVip&&$(".csdn-profile-no-vip").addClass("csdn-profile-vip").removeClass("csdn-profile-no-vip").attr("href","https://www.csdn.net/vip")},l.prototype.showProfile=function(){var e=this;this.timer&&clearTimeout(this.timer),$("#csdn-toolbar-profile").find(".csdn-profile-avatar > img").attr("src")!==$(".toolbar-btn-login").find(".hasAvatar img").attr("src")&&$("#csdn-toolbar-profile").find(".csdn-profile-avatar > img").attr("src",$(".toolbar-btn-login").find(".hasAvatar img").attr("src")),this.timer=setTimeout(function(){e.isEenter&&($(".toolbar-btn-login").find(".hasAvatar img").attr("src",e.avatar),void 0,$(".csdn-toolbar-plugin").hide(),e.$box.addClass("toolbar-btn-login-action"),e.$tpl.stop().fadeIn(200),window.csdn&&window.csdn.report&&window.csdn.report.reportView({spm:"3001.10565"}))},150)},l.prototype.hideProfile=function(){if(this.timer&&clearTimeout(this.timer),!this.isEenter){void 0;this.$box.removeClass("toolbar-btn-login-action"),this.$tpl.stop().fadeOut(100)}},l.prototype.getData=function(){void 0;var e=this;if(!e.isRender){var t=window.csdn.toolbar.profileData;if(t)return e.update(t),void e.showProfile();$.ajax({url:"https://g-api.csdn.net/community/toolbar-api/v1/get-user-info",type:"get",dataType:"JSON",contentType:"application/x-www-form-urlencoded; charset=utf-8",xhrFields:{withCredentials:!0},success:function(t){200===t.code&&(e.update(t.data),window.csdn.toolbar.profileData=t.data),e.showProfile()},error:function(e){}})}},d.prototype.render=function(){var e=this;!this.init&&t(this.cookieKey,"1",this.cookieTime);var n=this,o=$('
      \n
      \n
      登录后您可以:
      \n
        \n '+n.list[n.type].map(function(e){return'
      • '+e.text+"
      • "}).join("")+'\n
      \n 立即登录\n
      ');if(this.$box.append(o),this.$tpl=o,this.$box.find("a.csdn-toolbar-loginbtn").on("click",function(){var e=$(this).data("report-click");$(".csdn-toolbar-plugin").hide(),e?a(e):a()}),window.location.href.indexOf("passport.csdn.net")>-1)this.$tpl.hide(),n.isRender=!0;else var r=setTimeout(function(){n.isRender=!0,$(".csdn-toolbar-plugin").hide(),e.$tpl.stop().fadeOut(200),clearTimeout(r)},3e3);this.$box.on("mouseenter",function(e){void 0,n.isEenter=!0,n.isRender&&n.showProfile(),n.isRender=!0}).on("mouseleave",function(e){void 0,n.isEenter=!1,n.hideProfile()}),$(document).on("scroll",function(e){void 0,n.isEenter=!1,n.isRender=!0,n.hideProfile()})},d.prototype.showProfile=function(){var e=this;this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){e.isEenter&&(void 0,$(".csdn-toolbar-plugin").hide(),e.$tpl.stop().fadeIn(200))},150)},d.prototype.hideProfile=function(){if(this.timer&&clearTimeout(this.timer),!this.isEenter){void 0;this.$tpl.stop().fadeOut(100)}},$(document).on("toolbarReady",function(e){void 0,setTimeout(function(){r()?new l:new d},200)})}(),function(){function e(e){for(var t=document.cookie.split("; "),n=0;n0&&void 0!==arguments[0]?arguments[0]:{};void 0;var t=this,n="csdn-redpack-sorry";e.prizeId&&"common-coupon"===e.name?n="csdn-redpack-common-coupon":e.prizeId&&"coupon"===e.name?n="csdn-redpack-coupon":!e.prizeId||"redPacket"!==e.name&&"randomRedPacket"!==e.name||(n="csdn-redpack-cash"),t.el=$('
      \n
      \n \n \n '+("csdn-redpack-sorry"!==n?""+e.money+"":"")+"\n "+("csdn-redpack-common-coupon"===n||"csdn-redpack-coupon"===n?""+e.money+"":"")+"\n
      \n
      "),t.el.find(".csdn-redpack-result-close").on("click",function(e){t.clear()}),t.el.find(".csdn-redpack-result-link").on("click",function(e){t.clear()}),$("body").append(t.el)},n.prototype.renderCss=function(){void 0 ;var e=$('');document.head.insertBefore($(e)[0],document.head.getElementsByTagName("title")[0])},n.prototype.clear=function(){return void 0,this.el=null,this.dev=!1,$(".csdn-redpack-barrage").remove(),this},n.prototype.test=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:243,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.dev=t,this.host="https://test-luckydraw.csdn.net/",this.open(e)},$(document).on("toolbarReady",function(e){var o=window.csdn.toolbarData||{},r=o.barrageRedpackData;void 0,r&&r.whiteList&&t(r.whiteList)&&(void 0,window.csdn.barrageRedpack=new n)})}(),function(){function e(e){var t="width:100%; height:100%; background-image: url("+e.imgUrl+"); background-size: auto 80px;background-repeat: no-repeat; background-position: center center;",n=$('
      \n
      \n \n "+(e.exposureUrl?'':"")+"\n
      ");n.find(".toolbar-redpack-adver-btn").click(function(e){n.remove()}),n.find(".toolbar-redpack-advert-default").click(function(t){e.clickCallback&&"function"==typeof e.clickCallback&&e.clickCallback()}),$("#csdn-toolbar").prepend(n)}function t(){$("body").find("#csdn-toolbar .toolbar-redpack-advert").remove()}var n={clickUrl:"javascript:void(0);",imgUrl:"https://g.csdnimg.cn/common/redpack/images/redpaceAdvert.png",backgroundColor:"#FFCEA6"};window.csdn=window.csdn||{},window.csdn.bannerAdvert={show:function(o){t(),e(Object.assign({},n,o))},close:function(){t()}}}(),function(){function e(e){var t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.href=e,document.getElementsByTagName("head")[0].appendChild(t)}function t(e,t){var n=document.createElement("script");n.type="text/javascript",n.readyState?n.onreadystatechange=function(){"loaded"!=n.readyState&&"complete"!=n.readyState||(n.onreadystatechange=null,t&&t())}:n.onload=function(){t&&t()},n.src=e,document.getElementsByTagName("head")[0].appendChild(n)}function n(){e("https://g.csdnimg.cn/common/redpack/redpack.css"),t("https://g.csdnimg.cn/common/redpack/redpack.js")}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return!!Array.isArray(e)&&e.some(function(e){return"*"===e||e&&location.href.includes(e)})}$(document).on("toolbarReady",function(e){var t=window.csdn.toolbarData||{},r=t.redpackData;void 0,r&&r.whiteList&&o(r.whiteList)&&(void 0,n())})}(),function(){function e(e){return new Promise(function(t){var n=document.createElement("script");n.src=e,(document.body||document.head).append(n),n.onload=n.onreadystatechange=t})}function t(){return r?Promise.resolve():new Promise(function(t){return a?void a.then(t):window.SidebarDrawer?void(r=!0):(a=e(o),void a.then(function(){i=new CsdnSidebarDrawer({zIndex:2100,defaultActive:"",lockScroll:!1,onMenuChange:function(e){window.csdn.toolbar&&window.csdn.toolbar.onSideMenuChange&&window.csdn.toolbar.onSideMenuChange(e)},beforeSelectMenu:function(e){if(window.csdn.toolbar&&window.csdn.toolbar.beforeSideMenuItemClick)return window.csdn.toolbar.beforeSideMenuItemClick(e)}}),r=!0,t()}))})}function n(){i?i.toggleVisable():t().then(function(){i.toggleVisable()})}var o="https://g.csdnimg.cn/lib/csdn-sidebar/drawer/1.0.0/drawer.js",r=!1,a=null,i=null,s=$('meta[name="toolbar"]'),c=void 0;if(s.length){var l=s.attr("content")||{};l=JSON.parse(l),c=l.model||c}"mini"!==c&&"sidebar"!==c||t(),$(document).on("toolbarReady",function(e){var t="";switch(c){case"mini":t=".toolbar-mini-meun-logo";break;case"sidebar":case"sidebar-www":t=".toolbar-mini-meuns"}t&&$("#csdn-toolbar .csdn-toolbar-mini "+t).click(function(e){if(window.csdn.report&&window.csdn.report.reportClick({spm:"3001.10427"}),window.csdn.toolbar&&window.csdn.toolbar.beforeMiniMenuClick){var t=window.csdn.toolbar.beforeMiniMenuClick();if("boolean"==typeof t&&!t)return}n()})})}(),function(){function e(e){var t={};return location.href.replace(/([^*#&=?]+)=([^*#&=?]+)/g,function(){for(var e=arguments.length,n=Array(e),o=0;o
      '+e.title+"
      "}).join("")):t.dark&&(l=t.dark.map(function(e){return'
      '+e.title+"
      "}).join(""));var d=window.csdn.toolbarData.vipBg||{darkBg:"https://img-home.csdnimg.cn/images/20210826055052.png",defaultBg:"https://img-home.csdnimg.cn/images/20210826055049.png"},p=1==a?d.darkBg:d.defaultBg,u="https://g.csdnimg.cn/common/csdn-toolbar/images",h=$('
      \n
      \n 会员特权\n
      \n
      \n
      '+l+'
      \n
      \n \n
      \n \n \n \n \n
      \n
      \n
      \n \n
      "),m=$('"),g=$(".toolbar-btn-vip").find(">a"),f=m;o(348).then(function(e){"exp"===e&&(f=h)}).catch(function(e){}).finally(function(){$(".toolbar-btn-vip").append(f),n.box=f,n.showVip()}),r&&(g.attr("href","https://www.csdn.net/vip"),g.attr("data-report-click",'{"spm": "3001.5399"}'),g.attr("data-report-query","spm=3001.5399")),n.isRender=!0},r.prototype.showVip=function(){var e=this;clearTimeout(e.timer),e.timer=setTimeout(function(){if(e.isEnter){e.box&&e.box.stop().fadeIn(100);var t=window.csdn.toolbar&&window.csdn.toolbar.profileData||{vip:0},n=1===t.vip?"3001.6441":"3001.6439";window.csdn&&window.csdn.report&&window.csdn.report.reportView&&window.csdn.report.reportView({spm:n})}},150)},r.prototype.hideVip=function(){var e=this;clearTimeout(e.timer),e.isEnter||e.box&&e.box.stop().fadeOut(100)},r.prototype.init=function(){var e=window.csdn.toolbar&&window.csdn.toolbar.profileData;if(e)this.renderVip(e);else{n()?this.getProfileData(this.renderVip):(this.renderVip(this,{vip:0}),window.csdn.toolbar.profileData={vip:0})}},r.prototype.bindEvent=function(){var e=this;$(".toolbar-btn-vip").on("mouseenter",function(t){e.isEnter=!0,e.isRender?e.showVip():e.init()}).on("mouseleave",function(t){e.isEnter=!1,e.hideVip()})},$(document).on("toolbarReady",function(e){void 0,setTimeout(function(){new r},200)})}(),function(){function e(e,t){var n=document.createElement("script");n.type="text/javascript",n.readyState?n.onreadystatechange=function(){"loaded"!=n.readyState&&"complete"!=n.readyState||(n.onreadystatechange=null,t&&t())}:n.onload=function(){t&&t()},n.src=e,document.getElementsByTagName("head")[0].appendChild(n)}function t(){e("https://g.csdnimg.cn/common/vip-buyside/vip-buyside.js")}function n(e){return e.some(function(e){return"*"===e||!!~location.href.indexOf(e)})}$(document).on("toolbarReady",function(e){var o=window.csdn.toolbarData||{},r=o.vipBuySideDate;void 0,r&&r.whiteList&&n(r.whiteList)&&(void 0,t())})}(),function(){function e(e){for(var t=document.cookie.split("; "),n=0;n进入创作者中心\n ')}},{key:"render",value:function(e){this.container.append('\n \n ')}},{key:"isEffectiveTime",value:function(e){if(!e)return!1;if(e.always)return!0;var t=(new Date).valueOf(),n=new Date(e.start).valueOf();return t<=new Date(e.end).valueOf()&&t>=n}},{key:"show",value:function(){clearTimeout(this.timer),clearTimeout(this.closeTimer),this.timer=setTimeout(function(){n&&(window.csdn&&window.csdn.report&&window.csdn.report.reportView({spm:"3001.4503",extra:{dataType:"",isPopover:"1"}}),$("#csdn-toolbar-write").stop().fadeIn(100),$(".toolbar-btn.toolbar-btn-write").addClass("toolbar-btn-write_is-focus"))},150)}},{key:"hide",value:function(){clearTimeout(this.timer),clearTimeout(this.closeTimer),this.closeTimer=setTimeout(function(){n||($("#csdn-toolbar-write").stop().fadeOut(100),$(".toolbar-btn.toolbar-btn-write").removeClass("toolbar-btn-write_is-focus"))},300)}}]),e}()),r=e("UserName")||"";$(document).on("toolbarReady",function(){var e=null,a=$(".toolbar-btn.toolbar-btn-write");a.on("mouseenter",function(){n=!0,$(".toolbar-btn-write-new-comment").length>0&&($(".toolbar-btn-write-new-comment").data("time")&&t(r+"comment_new",$(".toolbar-btn-write-new-comment").data("time"),2592e6),$(".toolbar-btn-write-new-comment").remove()),e?e.show():e=new o,window.csdn&&window.csdn.report&&window.csdn.report.viewCheck&&window.csdn.report.viewCheck()}),a.on("mouseleave",function(){n=!1,e.hide()})})}();