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="blog";t.linkUrl.indexOf("download.csdn.net")>-1?o="download":t.linkUrl.indexOf("edu.csdn.net")>-1&&(o="edu");var i=highlight.map(function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")});i="("+i.join("|")+")";var n=new RegExp(i,"gi"),a=/<[^>]*>/g,s=t["abstract"].replace(a,"").replace(n,"$1"),c=t.dispTime.replace(/^(\d*)-/,""),l=t.linkUrl,r=t.title.replace(a,"").replace(n,"$1"),d='"extra":"{\\"utm_medium\\":\\"distribute.'+baiduSearchChannel+".none-task-"+o+"-2~default~baidujs_"+baiduSearchType+"~default-"+e+baiduSearchIdentification+'\\"}",',m='
\t
\t\t
\t\t\t
'+c+'
";return m}function showDownRecommend(t){var e=highlight.map(function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")});e="("+e.join("|")+")";var o=new RegExp(e,"gi"),i=/<[^>]*>/g,n=t.linkUrl,a=t.title.replace(i,"").replace(o,"$1"),s='
相关资源:'+a+"
";$("#recommendDown").html(s)}function showResult(t,e){var o=[],i=recommendRegularDomainArr||["blog.csdn.net/.+/article/details/","download.csdn.net/download/","edu.csdn.net/course/detail/ "],n=new RegExp(i.join("|"));if(!t||t.length<=0)return!1;if(t&&t.length>0){for(var a=0;a?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、<\/em>"]/g,"").replace(/\s/g,"").toLowerCase();for(var a=0;a0)for(var a=0;a?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、<\/em>"]/g,"").replace(/\s/g,"").toLowerCase();2==l.split("article/details/").length&&(r="article/details/"+l.split("article/details/")[1]),$.inArray(l.toLowerCase(),getRecommendListUrl()[0])==-1&&$.inArray(r.toLowerCase(),getRecommendListUrl()[1])==-1&&a<10&&d!==articleTitleContent&&e!==t[a].linkUrl&&o.push(t[a])}var m=$(".insert-baidu-box").children().not("script").not("dl"),p="",u=0,h=0;(!baiduCount||baiduCount<=0)&&(baiduCount=2);for(var a=isBaiduPre?0:baiduCount;a-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+=''}else o+='';return o},hide:function(){this.div&&(this.div.style.left="-2000px")},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide(),this.div.innerHTML="";var t=document.getElementsByTagName("body")[0];try{t.removeChild(this.div)}catch(e){}this.domElement=null,this.div=null}},reposition:function(t){if(t&&(this.domElement=ZeroClipboard.$(t),this.domElement||this.hide()),this.domElement&&this.div){var e=ZeroClipboard.getDOMObjectPosition(this.domElement),o=this.div.style;o.left=""+e.left+"px",o.top=""+e.top+"px"}},setText:function(t){this.clipText=t,this.ready&&this.movie.setText(t)},addEventListener:function(t,e){t=t.toString().toLowerCase().replace(/^on/,""),this.handlers[t]||(this.handlers[t]=[]),this.handlers[t].push(e)},setHandCursor:function(t){this.handCursorEnabled=t,this.ready&&this.movie.setHandCursor(t)},setCSSEffects:function(t){this.cssEffects=!!t},receiveEvent:function(t,e){switch(t=t.toString().toLowerCase().replace(/^on/,"")){case"load":if(this.movie=document.getElementById(this.movieId),!this.movie){var o=this;return void setTimeout(function(){o.receiveEvent("load",null)},1)}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var o=this;return setTimeout(function(){o.receiveEvent("load",null)},100),void(this.ready=!0)}this.ready=!0,this.movie.setText(this.clipText),this.movie.setHandCursor(this.handCursorEnabled);break;case"mouseover":this.domElement&&this.cssEffects&&(this.domElement.addClass("hover"),this.recoverActive&&this.domElement.addClass("active"));break;case"mouseout":this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")&&(this.domElement.removeClass("active"),this.recoverActive=!0),this.domElement.removeClass("hover"));break;case"mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case"mouseup":this.domElement&&this.cssEffects&&(this.domElement.removeClass("active"),this.recoverActive=!1)}if(this.handlers[t])for(var i=0,n=this.handlers[t].length;i