MORAD الكابتن المتألق
| موضوع: كود محرك بحث الخميس يناير 21, 2010 4:32 pm | |
| الكود : <****** </SPAN> language</SPAN> =</SPAN> "Java******"</SPAN> ><!-- </SPAN>// START HIDE </SPAN>var </SPAN> MAX_ENGINES </SPAN> = </SPAN> 35</SPAN> ; var </SPAN> tp</SPAN> =</SPAN> ''</SPAN> ; var </SPAN> tpp</SPAN> =</SPAN> ''</SPAN> ; var </SPAN> find </SPAN> = </SPAN> 'hunt'</SPAN> ; var </SPAN> hold</SPAN> =</SPAN> 0</SPAN> ; var </SPAN> hold2</SPAN> =</SPAN> 0</SPAN> ; var </SPAN> gog</SPAN> =</SPAN> 0</SPAN> ; var </SPAN> ap</SPAN> =</SPAN> ''</SPAN> ; function </SPAN> MakeArray</SPAN> (</SPAN> n</SPAN> ) { for (var </SPAN> i </SPAN> = </SPAN> 1</SPAN> ; </SPAN> i </SPAN> <= </SPAN> n</SPAN> ; </SPAN> i</SPAN> ++) { </SPAN>this</SPAN> [</SPAN> i</SPAN> ] = </SPAN> 0</SPAN> ; } </SPAN>this</SPAN> .</SPAN> maxlen </SPAN> = </SPAN> n</SPAN> ; </SPAN>this</SPAN> .</SPAN> len </SPAN> = </SPAN> 0</SPAN> ; return </SPAN> this</SPAN> ; } var </SPAN> engs </SPAN> = new </SPAN> MakeArray</SPAN> (</SPAN> MAX_ENGINES</SPAN> ); function </SPAN> find_substring</SPAN> (</SPAN> needle</SPAN> , </SPAN> haystack</SPAN> ) { var </SPAN> i</SPAN> , </SPAN> needlen </SPAN> = </SPAN> needle</SPAN> .</SPAN> length</SPAN> , </SPAN> haylen </SPAN> = </SPAN> haystack</SPAN> .</SPAN> length</SPAN> ; for (</SPAN> i</SPAN> =</SPAN> 0</SPAN> ; </SPAN> i</SPAN> <=</SPAN> haylen</SPAN> -</SPAN> needlen</SPAN> ; </SPAN> i</SPAN> ++) { if (</SPAN> needle </SPAN> == </SPAN> haystack</SPAN> .</SPAN> substring</SPAN> (</SPAN> i</SPAN> ,</SPAN> i</SPAN> +</SPAN> needlen</SPAN> )) return </SPAN> i</SPAN> ; } return </SPAN> false</SPAN> ; } function </SPAN> Engine</SPAN> (</SPAN> name</SPAN> , </SPAN> opts</SPAN> , </SPAN> home</SPAN> , </SPAN> search</SPAN> ) { var </SPAN> gotcha </SPAN> = </SPAN> find_substring</SPAN> (</SPAN> find</SPAN> , </SPAN> search</SPAN> ); </SPAN>this</SPAN> .</SPAN> name </SPAN> = </SPAN> name</SPAN> ; </SPAN>this</SPAN> .</SPAN> opts </SPAN> = </SPAN> opts</SPAN> ; </SPAN>this</SPAN> .</SPAN> home </SPAN> = </SPAN> home</SPAN> ; </SPAN>this</SPAN> .</SPAN> pre_gotcha </SPAN> = </SPAN> search</SPAN> .</SPAN> substring</SPAN> (</SPAN> 0</SPAN> ,</SPAN> gotcha</SPAN> ); </SPAN>this</SPAN> .</SPAN> post_gotcha</SPAN> = </SPAN> search</SPAN> .</SPAN> substring</SPAN> (</SPAN> gotcha</SPAN> +</SPAN> find</SPAN> .</SPAN> length</SPAN> , </SPAN> search</SPAN> .</SPAN> length</SPAN> ); } function </SPAN> Add</SPAN> (</SPAN> name</SPAN> , </SPAN> opts</SPAN> , </SPAN> home</SPAN> , </SPAN> search</SPAN> ) { </SPAN>engs</SPAN> .</SPAN> len</SPAN> ++; if (</SPAN> engs</SPAN> .</SPAN> len </SPAN> <= </SPAN> engs</SPAN> .</SPAN> maxlen</SPAN> ) { </SPAN>engs</SPAN> [</SPAN> engs</SPAN> .</SPAN> len</SPAN> ] = new </SPAN> Engine</SPAN> (</SPAN> name</SPAN> , </SPAN> opts</SPAN> , </SPAN> home</SPAN> , </SPAN> search</SPAN> ) } else { </SPAN>alert </SPAN> (</SPAN> 'Better increase MAX_ENGINES: ' </SPAN> + </SPAN> engs</SPAN> .</SPAN> Len </SPAN> + </SPAN> '>' </SPAN> + </SPAN> engs</SPAN> .</SPAN> maxlen</SPAN> ) } } function </SPAN> DisplayForm</SPAN> () { ********.</SPAN> writeln</SPAN> (</SPAN> '<FORM Name=Gotchaform NOOP="HandleForm(this); return false">'</SPAN> ); ********.</SPAN> writeln</SPAN> (</SPAN> '<strong></strong> <INPUT size=15 name="query">'</SPAN> ); ********.</SPAN> writeln</SPAN> (</SPAN> '<strong></strong> <SELECT name="service">'</SPAN> ); for (</SPAN> i</SPAN> =</SPAN> 1</SPAN> ; </SPAN> i </SPAN> <= </SPAN> engs</SPAN> .</SPAN> len</SPAN> ; </SPAN> i</SPAN> ++) { ********.</SPAN> writeln</SPAN> (</SPAN> "<OPTION " </SPAN> + </SPAN> engs</SPAN> [</SPAN> i</SPAN> ].</SPAN> opts </SPAN> + </SPAN> "> " </SPAN> + </SPAN> engs</SPAN> [</SPAN> i</SPAN> ].</SPAN> name</SPAN> ); } ********.</SPAN> writeln</SPAN> (</SPAN> '</SELECT> <input type=submit value="ابحث"><br>'</SPAN> ); ********.</SPAN> writeln</SPAN> (</SPAN> '</FORM>'</SPAN> ); ********.</SPAN> Gotchaform</SPAN> .</SPAN> query</SPAN> .</SPAN> focus</SPAN> () } function </SPAN> HandleForm</SPAN> (</SPAN> form</SPAN> ){ var </SPAN> i</SPAN> , </SPAN> newq</SPAN> =</SPAN> ""</SPAN> , </SPAN> oldq</SPAN> =</SPAN> form</SPAN> .</SPAN> query</SPAN> .</SPAN> value</SPAN> ; for (</SPAN> i</SPAN> =</SPAN> 0</SPAN> ; </SPAN> i</SPAN> <</SPAN> oldq</SPAN> .</SPAN> length</SPAN> ; </SPAN> i</SPAN> ++) { </SPAN> // compress [ ]+ into \+ </SPAN>var </SPAN> thischar </SPAN> = </SPAN> oldq</SPAN> .</SPAN> charAt</SPAN> (</SPAN> i</SPAN> ); if (</SPAN> thischar </SPAN> ==</SPAN> "+"</SPAN> )</SPAN> newq </SPAN> += </SPAN> "%2B"</SPAN> ; else if (</SPAN> thischar </SPAN> != </SPAN> ' '</SPAN> )
</SPAN>newq </SPAN> += </SPAN> thischar</SPAN> ; else if (</SPAN> lastchar </SPAN> != </SPAN> ' '</SPAN> ) </SPAN>newq </SPAN> += </SPAN> '+'</SPAN> ; </SPAN>lastchar </SPAN> = </SPAN> thischar</SPAN> ; } var </SPAN> eng </SPAN> = </SPAN> engs</SPAN> [</SPAN> 1</SPAN> +</SPAN> form</SPAN> .</SPAN> service</SPAN> .</SPAN> selectedIndex</SPAN> ]; </SPAN>// Window </SPAN>search</SPAN> =</SPAN> window</SPAN> .</SPAN> open</SPAN> (</SPAN> newq </SPAN> ? </SPAN> eng</SPAN> .</SPAN> pre_gotcha </SPAN> + </SPAN> newq </SPAN> + </SPAN> eng</SPAN> .</SPAN> post_gotcha </SPAN> : </SPAN> eng</SPAN> .</SPAN> home</SPAN> ,</SPAN> "SmartSearch"</SPAN> ,</SPAN> "scrollbars=yes,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,resizable=yes,width='100%',hight='100%'"</SPAN> ); } </SPAN>Add</SPAN> (</SPAN> "Alta Vista"</SPAN> ,</SPAN> "SELECTED"</SPAN> ,</SPAN> "http://altavista.digital.com/"</SPAN> ,</SPAN> "http://altavista.digital.com/cgi-bin/query?pg=q&what=web&fmt=d&q=hunt"</SPAN> ); </SPAN>Add</SPAN> (</SPAN> "Yahoo!"</SPAN> ,</SPAN> ""</SPAN> ,</SPAN> "http://www.yahoo.com/"</SPAN> ,</SPAN> "http://search.yahoo.com/bin/search?p=hunt" </SPAN> ); </SPAN>Add</SPAN> (</SPAN> "DejaNews"</SPAN> ,</SPAN> ""</SPAN> ,</SPAN> "http://www.dejanews.com/"</SPAN> ,</SPAN> "http://search.dejanews.com/nph-dnquery.xp?query=hunt&defaultOp=AND&svcclass=dncurrent&maxhits=25"</SPAN> ); </SPAN>Add</SPAN> (</SPAN> "HotBot"</SPAN> ,</SPAN> ""</SPAN> ,</SPAN> "http://www.search.hotbot.com"</SPAN> ,</SPAN> "http://www.search.hotbot.com/search.html?MT=hunt&DC=25"</SPAN> ); </SPAN>Add</SPAN> (</SPAN> "Infoseek"</SPAN> ,</SPAN> ""</SPAN> ,</SPAN> "http://www.infoseek.com/Home?pg=Home.html&sv=A2"</SPAN> ,</SPAN> "http://www.infoseek.com/Titles?qt=hunt&col=WW&sv=A2"</SPAN> ); </SPAN>Add</SPAN> (</SPAN> "Excite"</SPAN> ,</SPAN> ""</SPAN> ,</SPAN> "http://www.excite.com/"</SPAN> ,</SPAN> "http://www.excite.com/search.gw?searchType=Concept&search=hunt&category=default"</SPAN> ); </SPAN>Add</SPAN> (</SPAN> "Lycos"</SPAN> ,</SPAN> ""</SPAN> ,</SPAN> "http://www.lycos.com/"</SPAN> ,</SPAN> "http://www.lycos.com/cgi-bin/pursuit?query=hunt&backlink=639"</SPAN> ); </SPAN>Add</SPAN> (</SPAN> "Magellan"</SPAN> ,</SPAN> ""</SPAN> ,</SPAN> "http://www.mckinley.com/"</SPAN> ,</SPAN> "http://www.mckinley.com/extsearch.cgi?query=hunt"</SPAN> ); </SPAN>Add</SPAN> (</SPAN> "OpenText"</SPAN> ,</SPAN> ""</SPAN> ,</SPAN> "http://search.opentext.com"</SPAN> ,</SPAN> "http://search.opentext.com/omw/simplesearch?SearchFor=hunt&mode=and"</SPAN> ); </SPAN>Add</SPAN> (</SPAN> "WebCrawler"</SPAN> ,</SPAN> ""</SPAN> ,</SPAN> "http://webcrawler.com/"</SPAN> ,</SPAN> "http://webcrawler.com/cgi-bin/WebQuery?searchText=hunt&maxHits=25"</SPAN> ); </SPAN>// Software </SPAN>Add</SPAN> (</SPAN> "ZDNet Files"</SPAN> ,</SPAN> ""</SPAN> ,</SPAN> "http://www.zdnet.com/"</SPAN> ,</SPAN> "http://www6.zdnet.com/cgi-bin/texis/swlib/hotfiles/search.html?Usrt=rel&Usrchtype=simple&Utext=hunt"</SPAN> ); </SPAN>Add</SPAN> (</SPAN> "Filez"</SPAN> ,</SPAN> ""</SPAN> ,</SPAN> "http://www.filez.com/"</SPAN> ,</SPAN> "http://filez.com/cgi/filez.cgi?query=hunt&type=All+Files&hits=50&domain=World&doit=Search/"</SPAN> ); </SPAN>Add</SPAN> (</SPAN> "Shareware.com"</SPAN> ,</SPAN> ""</SPAN> ,</SPAN> "http://www.shareware.com/"</SPAN> ,</SPAN> "http://search.shareware.com/code/engine/Find?logop=and&cfrom=quick&orfile=True&hits=25&search=hunt&category=All-Categories"</SPAN> ); </SPAN>Add</SPAN> (</SPAN> "PC Gamer"</SPAN> ,</SPAN> ""</SPAN> ,</SPAN> "http://www.pcgame.com/"</SPAN> ,</SPAN> "http://www.pcgame.com/finder/search.cgi?key=hunt"</SPAN> ); </SPAN>// Denmark </SPAN>DisplayForm</SPAN> (); </SPAN>// STOP HIDE // --></******> | |
|
Waseem نائب المدير
| موضوع: رد: كود محرك بحث الثلاثاء يناير 26, 2010 3:01 am | |
| شـكــ وبارك الله فيك ـــراً لك | |
|