addComment = { moveForm : function(commId, parentId, respondId, postId) { var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent'), post = t.I('comment_post_ID'); if ( ! comm || ! respond || ! cancel || ! parent ) return; t.respondId = respondId; postId = postId || false; if ( ! t.I('wp-temp-form-div') ) { div = document.createElement('div'); div.id = 'wp-temp-form-div'; div.style.display = 'none'; respond.parentNode.insertBefore(div, respond); } var nextSibling = comm.nextSibling while(nextSibling){ nextSibling = nextSibling.nextSibling } comm.insertBefore(respond, nextSibling); if ( post && postId ) post.value = postId; parent.value = parentId; cancel.style.display = ''; cancel.onclick = function() { var t = addComment, temp = t.I('wp-temp-form-div'), respond = t.I(t.respondId); if ( ! temp || ! respond ) return; t.I('comment_parent').value = '0'; temp.parentNode.insertBefore(respond, temp); temp.parentNode.removeChild(temp); this.style.display = 'none'; this.onclick = null; return false; } try { t.I('comment').focus(); } catch(e) {} return false; }, I : function(e) { return document.getElementById(e); } } function e(e){var hrefs=e.href.split("?");var href=hrefs[hrefs.length-1];e.href="http://redirect.alexa.com/redirect?"+href;} function $(t){return _.getElementById(t);} //初始化入口 function pageInit(){ if('isIE'==b){ IE(); }else if('isFF'==b){ FF(); } Nifty("div#menu","small top"); Nifty("#menu a","small transparent top"); //Nifty("div#search","top"); Nifty("div#Syn","tl bottom"); Nifty("div#PageRank","small bottom"); Nifty("div#refer_info","tl bottom"); Nifty("div#respond",""); //Nifty("div.commentText","small"); Nifty("li.comment","tl tr"); Nifty("div#content","bl"); Nifty("div#sidebarL,div#sidebarR,div#content","same-height none"); } //修复IE下的表现 function fixMenu(){ if( t = $("menu") ){ var tags=t.getElementsByTagName("a") for (var i=0;i0)tags[i].style.width=newWidth+'px'; } } } //兼容Firefox function FF(){ if(ver <= 2){ moveInterval/=3; moveRate1*=1.5 moveRate2*=2; } } //兼容IE function IE(){ fixMenu(); if(ver <= 6){ try { _.execCommand("BackgroundImageCache", false, true); } catch(e){}; } } /* Syn 动画的处理区块 */ function Syn_mouseover(){ Syn_mouseouted = false clearTimeout(zoomOut_inter) if(pageOnLoad){ Syn_zoomIn(); } } function Syn_mouseout(){ Syn_mouseouted = true if(tween_opened){ zoomOut_inter = setTimeout(Syn_zoomOut,800) } } function Syn_zoomIn(){ if(!tween_started && !tween_opened){ z=setInterval(Syn_zoomIn_tween,30); tween_started=true; } } function Syn_zoomOut(){ if(!tween_started && tween_opened){ z=setInterval(Syn_zoomOut_tween,30); tween_started=true; } } function Syn_zoomIn_tween(){ height+=Math.round((zoomInHeight-height)*.3); if(height>=zoomInHeight-1){ height=zoomInHeight; clearInterval(z); tween_started=false; tween_opened=true; var h = parseInt($('sidebarL').lastChild.style.height) if((h-zoomInHeight)>0){ $('sidebarL').lastChild.style.height = (h-zoomInHeight)+'px' zoomInFix = true } if(Syn_mouseouted){Syn_mouseout()} } feeds.style.height=height+'px' } function Syn_zoomOut_tween(){ height-=Math.round((height-zoomOutHeight)*.3); if(height-1<=zoomOutHeight){ height=zoomOutHeight; clearInterval(z); tween_started=false; tween_opened=false; var h = parseInt($('sidebarL').lastChild.style.height) if(zoomInFix)$('sidebarL').lastChild.style.height = (h+zoomInHeight)+'px' } feeds.style.height=height+'px' } /* 侧边栏的处理区块 */ function tweenSidebar(){ if(val=Math.round(end)){ sidebarEnd(); } }else if(val>end){ var distance= (val-end); var newPos= val-3000/distance*moveRate2; if(newPos'+taotaoTip+''; if(_.title.indexOf('-')>0 ) _.title = _.title.split('-')[0]+'- '+taotaoTip; }else{ $('taotao').innerHTML = '该号码没有滔滔数据。'; } } function creatTaoTao(){ var script = document.createElement('script'); script.type="text/javascript" ; script.charset="utf-8"; script.src = "http://www.taotao.com/cgi-bin/msgj?qq="+ uin +"&num=1&t=0&"+Math.random(); document.body.appendChild(script) } /* 标签云的处理区块 */ function get_tags(){ var categ=$('st-tag-cloud') var tagCloud=$('tag-cloud') if(categ && tagCloud){ tagCloud.innerHTML=categ.innerHTML; itemArray = tagCloud.getElementsByTagName("a"); itemCount = itemArray.length; //alert(itemArray[1]) get_tags_array() } } function get_tags_array(){ var itemIndex=0; while(itemIndex0){ var rnd=Math.floor(Math.random()*itemHashLength); var rndIndex=itemHash[rnd]; itemHash.splice(rnd,1); itemArray[rndIndex].style.visibility=tag_v; }else{ clearInterval(tag_inter); if(tag_v=='visible'){ if(typeof(onComplete) == 'function')onComplete(); Nifty("div#sidebarL,div#sidebarR,div#content","same-height none"); } break; } time++; } } /* QQ/MSN */ function msnMe(){ window.location="msnim:chat?contact="+Acount+"@"+Domain; } function qqMe(){ window.location="Tencent://Message/?uin="+uin; } //隐藏欢迎信息 function hide_refer_info(){ hide_target($('refer_info')) } function hide_target(target){ target.style.visibility='hidden' } /* 键盘处理 */ function ffdoc_keydown(e){ if(e.ctrlKey && e.keyCode == 13)keySubmit(); else if(e.altKey && e.keyCode == 83) keySubmit(); } function keydown(){ if(event.ctrlKey && window.event.keyCode == 13)keySubmit(); else if(event.altKey && window.event.keyCode == 83)keySubmit(); } /* 鼠标处理 */ function ffdoc_click(e){ if(e.button==0){ onclick(e.target) } } function doc_click (e){ e = event || e; e=e.srcElement ; onclick(e) } /* 滚动到评论框 */ function toComment(){ scrollToCommInter = setInterval(scrollToComm,15) } function scrollToComm(){ var doc = _.documentElement var bd if('isSF' == b) bd= _.body; else bd= doc; if(bd.scrollTop<(doc.scrollHeight-doc.clientHeight)){ var sv=5+Math.floor(bd.scrollTop*.5) if(sv>20)sp=20 bd.scrollTop+=sv; }else{ clearInterval(scrollToCommInter) } } //鼠标点击 function onclick(e){ if((e.href || e.type=='submit'|| e.type=='image') && !e.target ){ if(e.href && e.href.indexOf('/download/')>0)return; if(e.nodeName && e.nodeName =='IMG')return; if(e.id && e.id =='SubmitComment')return; if(e.href && e.href.indexOf('#respond')>0)return; if(e.href && e.href.indexOf('#comment')>0)return; if(hasHide == false)move_hide() } } //键盘快捷提交评论 function keySubmit(){ if(commentform){ if(commnet_onsubmit())commentform.submit(); } } //其他对象的事件绑定和处理 function page_onload(){ pageOnLoad=true; pageInit() feeds=$('feeds'); //订阅区块 if(t=$('Syn')){ t.onmouseover = Syn_mouseover; t.onmouseout = Syn_mouseout; } //搜索按钮 if(t=$('submitBtn')){ t.onmouseover = function (){this.style.backgroundPosition='-50px -650px';} t.onmouseout = function (){this.style.backgroundPosition='0px -650px';} } //搜索按钮 if(t=$('searchForm')){ s = t.s; var txt = '关键词搜索' t.onsubmit = function (){ //location.href='/search/' + encodeURIComponent(s.value).replace(/%20/g, '+'); location.href='/search/' + encodeURIComponent(this.s.value.replace(txt, '')).replace(/%20/g, '+'); return false; } function emptyStyle(){ s.style.cssText = 'color:#bebebe'; s.value = txt; } function inputStyle(){ s.style.cssText = 'color:#333333' s.value = '' } s.onfocus = function (){ if(s.value == txt)inputStyle(); } t.s.onblur = function (){ if(s.value == '')emptyStyle() } emptyStyle(); } //评论按钮 if(t=$('SubmitComment')){ t.onmouseout = function (){this.style.backgroundPosition='-180px -620px';} t.onmouseover = function (){this.style.backgroundPosition='-180px -646px';} } //表单 if(commentform = $('commentform'))commentform.onsubmit = commnet_onsubmit //QQ/MSN按钮 if(t=$('Qme')){ t.onmouseout = function (){this.style.backgroundPosition='0px -208px';} t.onmouseover = function (){this.style.backgroundPosition='0px -211px';} t.onclick = qqMe } if(t=$('Mme')){ t.onmouseout = function (){this.style.backgroundPosition='-50px -208px';} t.onmouseover = function (){this.style.backgroundPosition='-50px -211px';} t.onclick = msnMe } if(t=$('scrollto')){ t.onclick = function (){toComment();return false;} } //欢迎信息 if(t = $('refer_info')) t.onclick = hide_refer_info; if(typeof(onLoad) == 'function'){onLoad()} loadOthers(); showSidebar(); } //异步加载其他的图片和信息 function loadOthers(){ //Google PageRank if(t = $("PageRankImg")){ t.title = t.alt; t.src='http://www.pagerank.net/pagerank.gif'; } //最新滔滔 creatTaoTao(); setInterval(creatTaoTao,5*60000);//5分钟更新一次 } //提交表单预处理 function commnet_onsubmit(){ //alert(event.id) //return false; var formCheckResult = formCheck(); if(formCheckResult){ setInterval(submiting,300); t=$('SubmitComment'); t.disabled = true; t.style.cursor = 'default'; } return formCheckResult; } //提交中 function submiting(){ t=$('commentTip') if(t.innerHTML.length<20)t.innerHTML +='.' else t.innerHTML ='提交中.'; } //检查评论表单 function formCheck(){ var author = $('author'); var email = $('email'); var url = $('url'); var comment = $('comment'); var checkUrl = new RegExp("[a-zA-z]+://[^s]*"); var checkMail = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/ var borderColor = '#9dc0d0'; noError = true; if(comment.value.length==0){ formTip(comment,'在这里请填写您的评论。') }else if(comment.value.length<2){ formTip(comment,'您的评论貌似也太短了吧。') }else{ formTip(comment,'',borderColor); } if(url){ if(url.value.length> 0 && !checkUrl.test(url.value)){ formTip(url,'URL貌似有错误。') }else{ formTip(url,'',borderColor); } } if(email){ if(email.value.length==0){ formTip(email,'请填写联系邮件地址。') }else if(!checkMail.test(email.value)){ formTip(email,'邮件格式有误。') }else{ formTip(email,'',borderColor); } } if(author){ if(author.value.length==0){ formTip(author,'在这里请填写您的尊姓大名。') }else if(author.value.length<2){ formTip(author,'名称太短。') }else{ formTip(author,'',borderColor); } } return noError; } //表单状态设置 function formTip(element,title,borderColor){ var color = borderColor || '#FF0000'; element.style.borderColor = color; element.title = title; if(color == '#FF0000'){ noError = false; element.focus(); } } /** 全局变量声明 */ var _ = document; var sidebarR_start=-300; var sidebarR_end=-.9; var sidebarL_start=-200; var sidebarL_end=99.1; var moveInterval=15; var moveRate1=.2; var moveRate2=2; var height=0; var zoomInHeight=100; var zoomOutHeight=0; var noError = true; //表单错误 var hasHide=true; var pageOnLoad=false; var tween_started=false; var tween_opened=false; var end,val,zoomInFix,Syn_mouseouted; var sidebar_inter,tag_inter,zoomOut_inter,scrollToCommInter; var sidebarEnd,tag_v; var t,feeds,tweenDIV,commentform; var itemArray,itemCount,itemHash=[]; var b,ver,s; var ua = navigator.userAgent; var uin = 10000; //QQ号码,用于配置滔滔,和联系QQ var Acount = "yourname";//配置msn帐号 var Domain = "hotmail.com"; //判断浏览器类型和版本 if((i = ua.indexOf("Firefox")) >= 0){ b='isFF'; ver = parseFloat(ua.substr(i + 8)); }else if((i = ua.indexOf("MSIE")) >= 0){ b='isIE'; ver = parseFloat(ua.substr(i + 4)); }else if((i = ua.indexOf("Safari")) >= 0){ b='isSF'; ver = parseFloat(ua.substr(i + 4)); } //绑定页面加载完成事件调用函数 window.onload=page_onload; //监听鼠标键盘事件 if(_.addEventListener){ _.addEventListener("click",ffdoc_click,false); _.addEventListener("keydown",ffdoc_keydown,false); }else{ _.onclick = doc_click; _.onkeydown = keydown } //调试用函数 function watchObj(obj){ var s=''; for(var i in obj){ s+=i+'="'+obj[i]+'" '; } return s; } ////////nifty 圆角处理//////////// var niftyOk=(_.getElementById&&_.createElement&&Array.prototype.push);var niftyCss=false;String.prototype.find=function(A){return(this.indexOf(A)>=0?true:false)};var oldonload=window.onload;if(typeof (NiftyLoad)!="function"){NiftyLoad=function(){}}if(typeof (oldonload)=="function"){window.onload=function(){oldonload();AddCss();NiftyLoad()}}else{window.onload=function(){AddCss();NiftyLoad()}}function AddCss(){niftyCss=true;return ;var A=CreateEl("link");A.setAttribute("type","text/css");A.setAttribute("rel","stylesheet");A.setAttribute("href","/css/niftyCorners.css");A.setAttribute("media","screen");_.getElementsByTagName("head")[0].appendChild(A)}function Nifty(A,C){if(niftyOk==false){return }if(niftyCss==false){AddCss()}var D,B=A.split(","),E=0;if(C==null){C=""}if(C.find("fixed-height")){E=getElementsBySelector(B[0])[0].offsetHeight}for(D=0;D0;H--){I.appendChild(CreateStrip(H,J,F,G,B))}C.style.paddingBottom=0;C.appendChild(I)}function CreateStrip(D,E,B,C,F){var A=CreateEl("b");A.className=F+D;A.style.backgroundColor=B;A.style.borderColor=C;if(E=="left"){A.style.borderRightWidth="0";A.style.marginRight="0"}else{if(E=="right"){A.style.borderLeftWidth="0";A.style.marginLeft="0"}}return(A)}function CreateEl(A){return(_.createElement(A))}function FixIE(A){if(A.currentStyle!=null&&A.currentStyle.hasLayout!=null&&A.currentStyle.hasLayout==false){A.style.display="inline-block"}}function SameHeight(A,D){var G,B=A.split(","),F,C,E=[],H;for(G=0;GD){D=E[G].offsetHeight}E[G].style.height="auto"}for(G=0;G0){F=CreateEl("b");F.className="niftyfill";F.style.height=H+"px";nc=E[G].lastChild;if(nc.className=="niftycorners"){E[G].insertBefore(F,nc)}else{E[G].appendChild(F)}}}}function getElementsBySelector(B){var E,D,A="",H="",P=B,M="",L,C,G,K,O=[],J=[],I;if(B.find("#")){if(B.find(" ")){O=B.split(" ");var F=O[0].split("#");if(F.length==1){return(J)}G=$(F[1]);if(G){N=G.getElementsByTagName(O[1]);for(E=0;E