在CSDN博客里加入关联主题功能的JS代码公布

完整的代码如下,请到博客的配置里面,将代码加入并保存即可。

注意:只有访问过的文章,才会被加入搜索范围。

<mce:script type="text/javascript"><!-- function lzzKillErrors() { return false; } window.onerror = lzzKillErrors; var doitOKLZZ = false;; function GOOGLEResize(){ var lzzSubject = document.getElementById("Post.ascx_ViewPost_PreviousAndNextEntriesUp"); if(lzzSubject==null){ lzzSubject = document.getElementById("csdnblog_content"); } if(!doitOKLZZ) { if(lzzSubject!=null){ doitOKLZZ = true; lzzSubject.innerHTML = "<br/><br/><br/><br/><br/><br/><br>" + lzzSubject.innerHTML; } } var objLeftLZZ=250; var objTopLZZ =120; var objParentLZZ; if(lzzSubject!=null){ objLeftLZZ = lzzSubject.offsetLeft; objTopLZZ = lzzSubject.offsetTop; objParentLZZ = lzzSubject .offsetParent; while( objParentLZZ.tagName.toUpperCase() != "BODY" && objParentLZZ.tagName.toUpperCase() != "HTML" ) { objLeftLZZ += objParentLZZ.offsetLeft; objTopLZZ += objParentLZZ.offsetTop; objParentLZZ = objParentLZZ.offsetParent; } var gg728=document.getElementById("GOOGLE_TOP"); gg728.style.left = (objLeftLZZ+10)+"px"; gg728.style.top = (objTopLZZ-140)+"px"; gg728.style.display=""; } } var startWidth = document.getElementsByTagName("body")[0].offsetWidth; function checkFFresize() { var resizeWidth = document.getElementsByTagName("body")[0].offsetWidth; if (resizeWidth == startWidth) { } else { startWidth=document.getElementsByTagName("body")[0].offsetWidth; GOOGLEResize(); } setTimeout("checkFFresize();",2000); } if (document.all) { } else { setTimeout("checkFFresize();",1000); } // --></mce:script> <div id="GOOGLE_TOP" style="position:absolute; top:150px;left:250px;width:728;height:40;display:none;z-index:99999"> <mce:script type="text/javascript" src="http://www.java2000.net/csdnblogjs/csdnblog.jsp" mce_src="http://www.java2000.net/csdnblogjs/csdnblog.jsp"></mce:script> </div> <mce:script type="text/javascript"><!-- window.onresize=GOOGLEResize; var ua=navigator.userAgent.toLowerCase(); var isStrict=document.compatMode=="CSS1Compat", isOpera=ua.indexOf("opera")>-1, isSafari=(/webkit|khtml/).test(ua), isIE=ua.indexOf("msie")>-1, isIE7=ua.indexOf("msie 7")>-1, isGecko=!isSafari&&ua.indexOf("gecko")>-1, isBorderBox=isIE&&!isStrict, isWindows=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1), isMac=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1), isLinux=(ua.indexOf("linux")!=-1), isSecure=window.location.href.toLowerCase().indexOf("https")===0; if(isGecko || isOpera) { document.addEventListener("DOMContentLoaded", GOOGLEResize, false); }else if(isIE){ document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>"); var defer = document.getElementById("ie-deferred-loader"); defer.onreadystatechange = function(){ if(this.readyState == "complete"){ GOOGLEResize(); } }; }else if(Ext.isSafari){ docReadyProcId = setInterval(function(){ var rs = document.readyState; if(rs == "complete") { GOOGLEResize(); } }, 10); }else{ window.onload=GOOGLEResize; } // --></mce:script>

你可能感兴趣的:(在CSDN博客里加入关联主题功能的JS代码公布)