+ -
当前位置:首页 → 问答吧 → 求助搜索代码

求助搜索代码

时间:2010-05-06

来源:互联网

var includeCaption=1;var zoomTime=5;var zoomSteps=15;var fade=1;var minBorder=90;var myWidth=0,myHeight=0,myScroll=0;myScrollWidth=0;myScrollHeight=0;var zoomOpen=false,preloadFrame=1,preloadActive=false,preloadTime=0,imgPreload=new Image();var zoomActive=new Array();var zoomTimer=new Array();var zoomOrigW=new Array();var zoomOrigH=new Array();var zoomOrigX=new Array();var zoomOrigY=new Array();var zoomID="ZoomBox";var theID="ZoomImage";var theCap="ZoomCaption";var theCapDiv="ZoomCapDiv";preloadActive=true;imgPreload=new Image();imgPreload.onload=function(){preloadActive=false};imgPreload.src=A}}function preloadAnimStart(){preloadTime=new Date();document.getElementById("ZoomSpin").style.left=(myWidth/2)+"px";document.getElementById("ZoomSpin").style.top=((myHeight/2)+myScroll)+"px";document.getElementById("ZoomSpin").style.visibility="visible";preloadFrame=1;document.getElementById("SpinImage").src=zoomImageURI+"zoom-spin-"+preloadFrame+".png";preloadAnimTimer=setInterval("preloadAnim()",100)}function preloadAnim(A){if(preloadActive!=false){document.getElementById("SpinImage").src=zoomImageURI+"zoom-spin-"+preloadFrame+".png";preloadFrame++;if(preloadFrame>12){preloadFrame=1}}else{document.getElementById("ZoomSpin").style.visibility="hidden";clearInterval(preloadAnimTimer);zoomIn(preloadFrom)}}function zoomClick(A){getSize();if(preloadActive==true){preloadFrom=A;preloadAnimStart()}else{zoomIn(A)}}function zoomIn(A){zoomimg.src=A.getAttribute("href");if(A.childNodes[0].width){startW=A.childNodes[0].width;startH=A.childNodes[0].height;startPos=findElementPos(A.childNodes[0])}else{startW=50;startH=12;startPos=findElementPos(A)}hostX=startPos[0];hostY=startPos[1];if(document.getElementById("scroller")){hostX=hostX-document.getElementById("scroller").scrollLeft}endW=imgPreload.width;endH=imgPreload.height;if(zoomActive[theID]!=true){document.getElementById("ShadowBox").style.visibility="hidden";document.getElementById("ZoomClose").style.visibility="hidden";if(includeCaption==1){zoomcap=document.getElementById(theCap);zoomcapd=document.getElementById(theCapDiv);if(A.getAttribute("title")&&includeCaption==1){zoomcapd.style.display="block";zoomcap.innerHTML=A.getAttribute("title")}else{zoomcapd.style.display="none"}}zoomOrigW[theID]=startW;zoomOrigH[theID]=startH;zoomOrigX[theID]=hostX;zoomOrigY[theID]=hostY;zoomimg.style.width=startW+"px";zoomimg.style.height=startH+"px";zoomdiv.style.left=hostX+"px";zoomdiv.style.top=hostY+"px";if(fade==1){setOpacity(0,zoomID)}zoomdiv.style.visibility="visible";sizeRatio=endW/endH;if(endW>myWidth-minBorder){endW=myWidth-minBorder;endH=endW/sizeRatio}if(endH>myHeight-minBorder){endH=myHeight-minBorder;endW=endH*sizeRatio}zoomChangeX=((myWidth/ 2) - (endW /2)-hostX);zoomChangeY=(((myHeight/ 2) - (endH /2)-hostY)+myScroll);zoomChangeW=(endW-startW);zoomChangeH=(endH-startH);zoomCurrent=0;if(fade==1){fadeCurrent=0;fadeAmount=(0-100)/zoomSteps}else{fadeAmount=0}zoomTimer[theID]=setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+startW+", "+zoomChangeW+", "+startH+", "+zoomChangeH+", "+hostX+", "+zoomChangeX+", "+hostY+", "+zoomChangeY+", "+zoomSteps+", "+fade+", "+fadeAmount+", 'zoomDoneIn(zoomID)')",zoomTime);zoomActive[theID]=true}}function zoomOut(){if(zoomActive[theID]!=true){document.getElementById("ShadowBox").style.visibility="hidden";document.getElementById("ZoomClose").style.visibility="hidden";startX=parseInt(zoomdiv.style.left);startY=parseInt(zoomdiv.style.top);startW=zoomimg.width;startH=zoomimg.height;zoomChangeX=zoomOrigX[theID]-startX;zoomChangeY=zoomOrigY[theID]-startY;zoomChangeW=zoomOrigW[theID]-startW;zoomChangeH=zoomOrigH[theID]-startH;zoomCurrent=0;if(fade==1){fadeCurrent=0;fadeAmount=(100-0)/zoomSteps}else{fadeAmount=0}zoomTimer[theID]=setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+startW+", "+zoomChangeW+", "+startH+", "+zoomChangeH+", "+startX+", "+zoomChangeX+", "+startY+", "+zoomChangeY+", "+zoomSteps+", "+fade+", "+fadeAmount+", 'zoomDone(zoomID, theID)')",zoomTime);zoomActive[theID]=true}}function zoomDoneIn(A,B){zoomOpen=true;setOpacity(0,"ShadowBox");setOpacity(0,"ZoomClose");A=document.getElementById(A);shadowdiv=document.getElementById("ShadowBox");shadowLeft=parseInt(A.style.left)-13;shadowTop=parseInt(A.style.top)-8;shadowWidth=A.offsetWidth+26;shadowHeight=A.offsetHeight+26;shadowdiv.style.width=shadowWidth+"px";shadowdiv.style.height=shadowHeight+"px";shadowdiv.style.left=shadowLeft+"px";shadowdiv.style.top=shadowTop+"px";document.getElementById("ShadowBox").style.visibility="visible";fadeElementSetup("ShadowBox",0,100,5);document.getElementById("ZoomClose").style.visibility="visible";fadeElementSetup("ZoomClose",0,100,5)}function zoomDone(A,B){zoomOpen=false;zoomOrigH[B]="";zoomOrigW[B]="";document.getElementById(A).style.visibility="hidden";zoomActive[B]==false}function zoomElement(zoomdiv,theID,zoomCurrent,zoomStartW,zoomChangeW,zoomStartH,zoomChangeH,zoomStartX,zoomChangeX,zoomStartY,zoomChangeY,zoomSteps,fade,fadeAmount,execWhenDone){if(zoomCurrent==(zoomSteps+1)){zoomActive[theID]=false;clearInterval(zoomTimer[theID]);if(execWhenDone!=""){eval(execWhenDone)}}else{if(fade!=0){if(fadeAmount<0){setOpacity(Math.abs(zoomCurrent*fadeAmount),zoomdiv)}else{setOpacity(100-(zoomCurrent*fadeAmount),zoomdiv)}}moveW=cubicInOut(zoomCurrent,zoomStartW,zoomChangeW,zoomSteps);moveH=cubicInOut(zoomCurrent,zoomStartH,zoomChangeH,zoomSteps);moveX=cubicInOut(zoomCurrent,zoomStartX,zoomChangeX,zoomSteps);moveY=cubicInOut(zoomCurrent,zoomStartY,zoomChangeY,zoomSteps);document.getElementById(zoomdiv).style.left=moveX+"px";document.getElementById(zoomdiv).style.top=moveY+"px";zoomimg.style.width=moveW+"px";zoomimg.style.height=moveH+"px";zoomCurrent++;clearInterval(zoomTimer[theID]);zoomTimer[theID]=setInterval("zoomElement('"+zoomdiv+"', '"+theID+"', "+zoomCurrent+", "+zoomStartW+", "+zoomChangeW+", "+zoomStartH+", "+zoomChangeH+", "+zoomStartX+", "+zoomChangeX+", "+zoomStartY+", "+zoomChangeY+", "+zoomSteps+", "+fade+", "+fadeAmount+", '"+execWhenDone+"')",zoomTime)}}function zoomMouseOver(){}function zoomMouseOut(){}function fadeOut(A){if(A.id){fadeElementSetup(A.id,100,0,10)}}function fadeIn(A){if(A.id){fadeElementSetup(A.id,0,100,10)}}var fadeActive=new Array();var fadeQueue=new Array();var fadeTimer=new Array();var fadeClose=new Array();function fadeElementSetup(C,E,B,A,D){if(fadeActive[C]==true){fadeQueue[C]=new Array(C,E,B,A)}else{fadeSteps=A;fadeCurrent=0;fadeAmount=(E-B)/fadeSteps;fadeTimer[C]=setInterval("fadeElement('"+C+"', '"+fadeCurrent+"', '"+fadeAmount+"', '"+fadeSteps+"')",15);fadeActive[C]=true;if(D==1){fadeClose[C]=true}else{fadeClose[C]=false}}}function fadeElement(B,D,A,C){if(D==C){clearInterval(fadeTimer[B]);fadeActive[B]=false;if(fadeClose[B]==true){document.getElementById(B).style.visibility="hidden"}if(fadeQueue[B]&&fadeQueue[B]!=false){fadeElementSetup(fadeQueue[B][0],fadeQueue[B][1],fadeQueue[B][2],fadeQueue[B][3]);fadeQueue[B]=false}}else{D++;if(A<0){setOpacity(Math.abs(D*A),B)}else{setOpacity(100-(D*A),B)}clearInterval(fadeTimer[B]);fadeTimer[B]=setInterval("fadeElement('"+B+"', '"+D+"', '"+A+"', '"+C+"')",15)}}function setOpacity(C,A){var B=document.getElementById(A).style;if(navigator.userAgent.indexOf("Firefox")!=-1){if(C==100){C=99.9999}}B.filter="alpha(opacity="+C+")";function scrollVertAnim(){if(scrollanim.time>scrollanim.duration){clearInterval(scrollanim.timer);scrollanim.timer=null}else{move=sineInOut(scrollanim.time,scrollanim.begin,scrollanim.change,scrollanim.duration);scrollanim.element.scrollTop=move;scrollanim.time++}}function scrollHorizAnim(){if(scrollanim.time>scrollanim.duration){clearInterval(scrollanim.timer);scrollanim.timer=null}else{move=sineInOut(scrollanim.time,scrollanim.begin,scrollanim.change,scrollanim.duration);scrollanim.element.scrollLeft=move;scrollanim.time++}}function showLargePopup(B){var A=document.getElementById("fullscreen");var C=document.getElementById("largepopup");document.getElementById("start-download").className="show";getSize();A.style.height=myScrollHeight+"px";A.style.display="block";C.style.left=((myWidth-C.offsetWidth)/2)+"px";C.style.top=(((myHeight-C.offsetHeight)/2)+myScroll)+"px";C.style.visibility="visible";refreshTimer=setTimeout("setLocation('"+B.getAttribute("href")+"')",1500)}function setLocation(A){window.location=A}function hideLargePopup(){var A=document.getElementById("fullscreen");var B=document.getElementById("largepopup");B.style.visibility="hidden";A.style.display="none"}var dpopTimer="";function showDownloadPopup(C){var A=document.getElementById("dpop");var B=document.getElementById("download");if(moveanim.timer!=null){clearInterval(moveanim.timer);moveanim.timer=null}position=findElementPos(B);A.style.top=(position[1]-(A.offsetHeight-40))+"px";A.style.left="5px";if(dpopTimer!=""){clearTimeout(dpopTimer);dpopTimer=""}else{setOpacity(0,"dpop");A.style.visibility="visible";moveStart(A,parseInt(A.style.left),parseInt(A.style.left),parseInt(A.style.top)+10,parseInt(A.style.top),15);fadeElementSetup("dpop",0,100,13)}}function hideDownloadPopup(){dpopTimer=setTimeout("actuallyHide()",500)}function actuallyHide(){var A=document.getElementById("dpop");if(dpopTimer!=""){dpopTimer="";moveStart(A,parseInt(A.style.left),parseInt(A.style.left),parseInt(A.style.top),parseInt(A.style.top)-10,15);fadeElementSetup("dpop",100,0,13,1)}}var moveanim={time:0,beginX:0,changeX:0,beginY:0,changeY:0,duration:0,element:null,timer:null};function moveStart(E,B,D,A,C,F){if(moveanim.timer!=null){clearInterval(moveanim.timer);moveanim.timer=null}moveanim.time=0;moveanim.beginX=B;moveanim.changeX=D-B;moveanim.beginY=A;moveanim.changeY=C-A;moveanim.duration=F;moveanim.element=E;moveanim.timer=setInterval("moveAnimDo();",15)}function moveAnimDo(){if(moveanim.time>moveanim.duration){clearInterval(moveanim.timer);moveanim.timer=null}else{moveX=cubicOut(moveanim.time,moveanim.beginX,moveanim.changeX,moveanim.duration);moveY=cubicOut(moveanim.time,moveanim.beginY,moveanim.changeY,moveanim.duration);moveanim.element.style.left=moveX+"px";moveanim.element.style.top=moveY+"px";moveanim.time++}}var $v=function(A){return $(A).value};var getXHP=function(){var A="";try{A=new ActiveXObject("MSXML2.XMLHttp.6.0")}catch(B){try{A=new ActiveXObject("MSXML2.XMLHttp.5.0")}catch(B){try{A=new ActiveXObject("MSXML2.XMLHttp.4.0")}catch(B){try{A=new ActiveXObject("MSXML2.XMLHttp")}catch(B){try{A=new ActiveXObject("Microsoft.XMLHTTP")}catch(B){A=new XMLHttpRequest()}}}}}return A};var saveHistorys=function(B){try{var A=getXHP();A.open("post","/cmd/saveKeys/?"+B+"&a="+Math.random(),true);A.send("")}catch(C){}};var $=function(A){return document.getElementById(A)};var $v=function(A){return $(A).value};var G={};G.SO={initData:{web:["web","网页",[["百度","http://www.baidu.com/s?tn=67ing_pg&wd={key}"],["谷歌","http://www.google.cn/search?hl=zh-CN&client=pub-5103622814761592&q={key}"],["搜搜","http://www.soso.com/q?pid=s.idx&w={key}"],["雅虎","http://one.cn.yahoo.com/s?p={key}"],["有道","http://www.youdao.com/search?q={key}"],["搜狗","http://www.sogou.com/web?query={key}&_ast=1234423248"],["迅雷","http://web.gougou.com/search?search={key}&restype=-1&id=89709&pattern=10000"],["中搜","http://p.zhongsou.com/p?w={key}&pt=1&k=&jc=&aid=&rt=o"]]],widget:["widget","软件",[["狗狗","http://soft.gougou.com/search?restype=2&search={key}&id=1260163802796&pattern=10300"],["天空","http://www.skycn.com/search.php?sf=search&ss_name={key}"],["华军","http://search.newhua.com/search.asp?Keyword={key}"],["多特","http://www.duote.com/search.php?searchType=&so={key}"],["霏凡","http://search.crsky.com/search.asp?action=s&sType=ResName&catalog=&keyword={key}"],["快车","http://search2.kuaiche.com/content/ssoft?mid=101&q={key}&r=1{encode}"],["电驴","http://www.verycd.com/search/folders/{key}"],["下载吧","http://search.xiazaiba.com/search.php?keyword={key}"]]],video:["video","视频",[["必搜索","http://www.busousuo.com/sp/dy.asp?word={key}"],["迅雷","http://movie.gougou.com/search?search={key}&id=1260177496687&pattern=10300"],["优酷","http://so.youku.com/search_video/q_{key}"],["土豆","http://so.tudou.com/isearch.do?kw={key}"],["QQLive","http://video.qq.com/v1/search82?w={key}{encode}"],["56","http://so.56.com/index?key={key}"],["六间房","http://6.cn/search.php?k={key}&t=v&ko=1{encode}"],["谷歌","http://video.google.cn/videosearch?hl=zh-CN&q={key}"],["百度","http://video.baidu.com/v?ct=301989888&rn=20&pn=0&db=0&s=7&word={key}"],["雅虎","http://video.youdao.com/search?q={key}"],["有道","http://video.youdao.com/search?q={key}"],["搜狗","http://v.sogou.com/v?query={key}"]]],mp3:["mp3","音乐",[["百度","http://mp3.baidu.com/m?tn=baidump3&ct=134217728&hl=zh-CN&ie=utf-8&ei=utf-8&lm=-1&word={key}"],["雅虎","http://one.cn.yahoo.com/s?p={key}&v=music"],["有道","http://mp3.youdao.com/search?q={key}{encode}"],["搜狗","http://mp3.sogou.com/music.so?&class=1&p=40010200&query={key}"],["迅雷","http://mp3.gougou.com/search?search={key}&id=1260177496687&pattern=10300"]]],pic:["pic","图片",[["谷歌","http://images.google.cn/images?hl=zh-CN&q={key}"],["百度","http://image.baidu.com/i?tn=baiduimage&ct=201326592&lm=-1&cl=2&word={key}&t=12"],["雅虎","http://one.cn.yahoo.com/s?p={key}&v=image"],["有道","http://image.youdao.com/search?q={key}"],["搜狗","http://pic.sogou.com/pics?query={key}"],["迅雷","http://pic.gougou.com/search?search={key}"]]],buy:["buy","购物",[["淘宝","http://z.alimama.com/tksEncrypt.php?q={key}&cat=0&pid=mm_14163878_0_0&unid=&commend=all&search_type=auction&user_action=initiative&f=D9_5_1&at_topsearch=1&sid=(42631166ee0b2631144b5afcc86c6ccc)&sort=&spercent=0"],["易趣","http://search.eachnet.com/Search?keyword={key}&category=0{encode}"],["卓越","http://www.amazon.cn/search/search.asp?source=158803880-23&searchWord={key}{encode}"],["当当网","http://union.dangdang.com/transfer/transfer.aspx?dd_catalog=&dd_key={key}&dd_button=??+?÷&backurl=http://search.dangdang.com/search.aspx?key={key}&catalog=&SearchFromTop=1&from=P-274023"],["东京商城","http://search.360buy.com/Search?keyword={key}"],["乐购","http://www.loogoo.com/pre_search.aspx?st=0&k={key}&ct=0&x=36&y=4"],["红孩子","http://www.redbaby.com.cn/Product/Product_Search.aspx?Site=01&ProductName={key}&BranchId=-1&OrderField=b.SaleNum&ordertype=1&seartype=1"],["有啊","http://youa.baidu.com/search/s?search_domain=1&keyword={key}&category=0"],["拍拍","http://search1.paipai.com/cgi-bin/comm_search1?KeyWord={key}&keywordtype=goods&sClassid="],["阿里巴巴","http://search.china.alibaba.com/search/offer_search.htm?keywords={key}&x=0&y=0"],["速递爱","http://www.sudii.com/search.html?keyword={key}&sortType=3{encode}"],["鲜花礼品","http://www.flowercn.com/search.asp?search_usage=&search_price=&search_keyword={key}&imageField3.x=0&imageField3.y=0"]]],book:["book","图书",[["博库书城","http://www.bookuu.com/search/book_search.jsp?category=gjz&keyword={key}"],["爱搜书","http://tel.isoshu.com/search/book/{key}/1-all-all-all"],["狗狗书籍","http://book.gougou.com/search?search={key}&restype=3&id=1"],["Scribd","http://www.scribd.com/search?cx=007890693382555206581%3A7fgc6et2hmk&cof=FORID%3A11&ie=UTF-8&c=&q={key}&sa=Search{encode}"],["豆丁","http://www.docin.com/app/searchnew/findproduct?keyword={key}{encode}"],["百度","http://www.baidu.com/baidu?q1={key}&ft=all"],["搜狗","http://www.sogou.com/web?query=filetype%3Aall+{key}&filetype=all"],["爱问","http://ishare.iask.sina.com.cn/search.php?key={key}&format="],["牛档","http://www.niudown.com/search.aspx?keyword={key}{encode}"],["谷歌","http://books.google.com/books?q={key}{encode}"],["起点","http://sosu.qidian.com/search.aspx?k={key}&t=zh"]]],map:["map","地图",[["我要地图","http://www.51ditu.com/maps?wd={key}"],["谷歌","http://ditu.google.cn/maps?hl=zh-CN&q={key}"],["百度","http://map.baidu.com/#word={key}&ct=10&bs=010"],["有道","http://ditu.youdao.com/search?q={key}"],["搜狗","http://map.sogou.com/index.html#lq={key}"]]],news:["news","资讯",[["谷歌","http://news.google.cn/news?hl=zh-CN&q={key}{encode}"],["百度","http://news.baidu.com/ns?cl=2&rn=20&tn=news&word={key}"],["雅虎","http://one.cn.yahoo.com/s?p={key}&v=news"],["有道","http://news.youdao.com/search?q={key}"],["搜狗","http://news.sogou.com/news?query={key}"]]],know:["know","知识",[["百度","http://zhidao.baidu.com/q?word={key}&ct=17&pn=0&tn=ikaslist&rn=10&lm=0&fr=search"],["雅虎","http://one.cn.yahoo.com/s?p={key}&pid=hp&v=ks"],["新浪","http://iask.sina.com.cn/search_engine/search_knowledge_engine.php?key={key}&classid=0&x=0&y=0&gjss=0"],["天涯","http://wenda.tianya.cn/wenda/search?q={key}{encode}"],['搜搜','http://wenwen.soso.com/z/SearchSolved.e?sp=S{key}&w={key}&search=%E6%90%9C%E7%B4%A2%E7%AD%94%E6%A1%88{encode}']]]},init:function(){var H=G.SO.initData;var D='<div style="width:100%;text-align:center;"></div><div id=frame><div id=scroller><div id=content>';var F="<div class=soWrap><ul id=toolbar>";for(var B in H){try{var E=H[B];F+="<li"+(B==0?" class=active":"")+" id="+E[0]+'-tab><a onfocus="blur();" onclick="ScrollSection(\''+E[0]+"-pane', 'scroller', '"+H.web[0]+'-pane\'); return false" href="javascript:void(0);">'+E[1]+"</a></li>";var A=E[2];if(!A){continue}D+="<div class=section id="+E[0]+'-pane><div class="hbi_cont hbi_search"><div class="searchBox"><ul class="searchEngine">';for(var C=0;C<A.length;C++){D+='<li><a id="'+E[0]+C+'"'+(C==0?' class="currentEngine"':"")+' href="javascript:void(0);" onfocus="blur();" onclick="G.SO.change(\''+E[0]+"',"+C+');return false;">'+A[C][0]+"</a></li>"}D+='</ul><input type="hidden" id="'+E[0]+'_hid" value="'+A[0][1]+'"/><div class="searchCont"><input id="'+E[0]+'_txt" type="text" text="请输入搜索关键字" class="text" onkeydown="if(event.keyCode == 13){this.nextSibling.onclick();}" onfocus="this.select();"/><img src="style/images/search_image.gif" onclick="G.SO.go(\''+E[0]+"');\"/></div></div></div></div>"}catch(I){alert(I)}}F+="</ul></div>";D+='</div></div></div>';$("soContent").innerHTML=F+D},ca:{web:0,know:0,pic:0,mp3:0,video:0,buy:0,book:0,map:0,news:0,widget:0},change:function(C,B){var A=G.SO.ca;$(C+"_txt").select();$(C+"_hid").value=G.SO.initData[C][2][B][1];$(C+""+A[C]).className="";G.SO.ca[C]=B;$(C+""+B).className="currentEngine";$(C+"_txt").focus()},go:function(B){var C=$v(B+"_txt");saveHistorys("keys="+encodeURI(C.replace("请输入搜索关键字","")));C=C=="请输入搜索关键字"?"":C;var A=$v(B+"_hid");if(/\{encode\}/.test(A)){A=A.replace(/\{encode\}/,"");C=encodeURI(C)}C=A.replace(/\{key\}/g,C);if(B=="widget"){C=C.replace(/\{r\}/,["A","B","C","D","E","F","G"][Math.floor(Math.random()*5)])}window.open(C)}};G.SO.init();setTimeout(function(){ScrollSection("web-pane","scroller","widget-pane")},100);
哪位高手能帮忙解释一下这段代码?

作者: bailiyan   发布时间: 2010-05-06