home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Seeker / nssearch.txt < prev    next >
Text File  |  2000-05-25  |  8KB  |  307 lines

  1. ******************************************************************************
  2. Please  remove this section from the actual page when 
  3. you actually  use this page.
  4.  
  5. Here are the thing you need to modify in the page
  6.  
  7. 1.title[0]=no_of_urls 
  8. ( this is for the total number of urls which will be searched )
  9.  
  10. 2. fill in the the details
  11.  
  12. title[1]="fill in the list of keywords here"
  13. desc[1]="fill in the description of the url here "
  14. links[1]="http://yoursite.com/yourpage.html"
  15.  
  16. (rememeber all of these should be encapsulated in the quotes)
  17. (all the keywords should be seperated by blanks and should be in lowercase)
  18.  
  19. 3. You can also change the heading of results
  20. Replace 'Search Results' by 'your_title'
  21.  
  22. Copyright for all the HTMLSearch code rests with with Satadip Dutta 
  23. *****************************************************************************
  24.  
  25. <html>
  26. <title>
  27. Search Engine
  28. </title>
  29. <head>
  30. <script>
  31.  
  32. <!-- Begin copyright - This must be retained and posted as is to use this script -->
  33.  
  34. <!--// This Script was created by Satadip Dutta. 
  35. // Email: sat_dutta@post1.com  / satadipd@inf.com 
  36. // URL:http://dutta.home.ml.org
  37. // Version 1.1-Netscp 
  38. // Please honor my hard work, if you use a variant of this in your page, 
  39. // then please email me :) and keep these comments in the Script.
  40. // This code is Copyright (c) 1997 Satadip Dutta
  41. // all rights reserved.
  42. // License is granted to user to reuse this code on their own Web site 
  43. // if, and only if, this entire copyright notice is included. The Web Site
  44. // containing this  script   must be a not-for-profit ( non-commercial ) web site. 
  45. // Exclusive written permission must be obtained before using  this version of the search engine
  46. //-->
  47. <!-- End copyright - This must be retained and posted as is to use this script -->
  48.  
  49. title = new Object();
  50. desc = new Object();
  51. links= new Object();
  52. matched= new Object();
  53. keywords= new Object();
  54. found= new Object();
  55. var temp=0;
  56. // actual location or the item to be searched // description of he location
  57. // actual link
  58. // percentage match found
  59. // keywords as parsed from the input 
  60. // # of titles present in the database 
  61. title[0]=10
  62. //no of keywords after parsing
  63. keywords[0]=0
  64. //no of  matches found.
  65. found[0]=0
  66.  
  67. <!-- Begin List of Searchable Items -->
  68.  
  69. <!--put the list of the links and descriptions here!!-->
  70.  
  71. title[1]="homepage dutta"
  72. desc[1]="Inch of Dutta's Life"
  73. links[1]="http://dutta.home.ml.org"
  74. matched[1]=0
  75.  
  76. title[2]="yahoo search engine"
  77. desc[2]=" the yahoo search engine "
  78. links[2]=" http://www.yahoo.com"
  79. matched[2]=0
  80.  
  81. title[3]=" lycos search engine"
  82. desc[3]="The lycos search engine  "
  83. links[3]=" http://www.lycos.com"
  84. matched[3]=0
  85.  
  86. title[4]=" infoseek search Engine"
  87. desc[4]="The Infoseek Search Engine  "
  88. links[4]=" http://www.infoseek.com"
  89. matched[4]=0
  90.  
  91.  
  92. title[5]="learn html "
  93. desc[5]="Htmlgoodies.com-learn your HTML here"
  94. links[5]="http://www.htmlgoodies.com"
  95. matched[5]=0
  96.  
  97. title[6]="java scripts submit html goodies color text scrolling text display javascript"
  98. desc[6]="Java Goodies - Striving to be the largest collection of Java Scripts on the World Wide Web"
  99. links[6]="http://www.htmlgoodies.com/javagoodies/"
  100. matched[6]=0
  101.  
  102.  
  103.  
  104. title[7]="free homepages"
  105. desc[7]="Geocities.com"
  106. links[7]="http://www.geocities.com"
  107. matched[7]=0
  108.  
  109.  
  110. title[8]="free homepages"
  111. desc[8]="Angelfire.com"
  112. links[8]="http://www.angelfire.com"
  113. matched[8]=0
  114.  
  115.  
  116. title[9]="free email"
  117. desc[9]="hotmail.com"
  118. links[9]="http://www.hotmail.com"
  119. matched[9]=0
  120.  
  121.  
  122. title[10]="free email"
  123. desc[10]="rocketmail.com"
  124. links[10]="http://www.rocketmail.com"
  125. matched[10]=0
  126.  
  127. <!-- End list of Searchable items -->
  128.  
  129. function search(){
  130. // get the input from the input by the user and strip it into keywords //
  131. var skeyword=document.searchengine.keywords.value.toLowerCase();
  132.  
  133.  var check=1;
  134. var pos=0;
  135. var i=0;
  136. var j=0;
  137. var  itemp=0;
  138. var config='';
  139.  
  140. while (true)
  141. {
  142. if (skeyword.indexOf("+") == -1 )
  143. {
  144. keywords[check]=skeyword;
  145.  
  146. break;
  147. }
  148. pos=skeyword.indexOf("+");
  149. if (skeyword !="+")     
  150. {
  151. keywords[check]=skeyword.substring(0,pos); check++;
  152. }
  153. else
  154. {
  155. check--;
  156. break;
  157. }
  158. skeyword=skeyword.substring(pos+1, skeyword.length);  
  159.   if (skeyword.length ==0)
  160. {
  161. check--;
  162. break;
  163. }
  164.  
  165. }
  166. // the keywords have been put in keywords object.
  167.  keywords[0]=check;
  168. //alert(check);
  169. // matching and storing the matches in matched 
  170. for ( i=1; i<=keywords[0];i++)
  171.  
  172. {
  173. for (j=1;j<=title[0];j++)
  174.  
  175. {
  176. if (title[j].toLowerCase().indexOf(keywords[i]) > -1 )
  177. {
  178. matched[j]++;
  179. }
  180. }       
  181. }
  182. // putting all the indexes of the matched records  in found
  183.  
  184. for (i=1;i<=title[0];i++)
  185.  
  186. {
  187. if (matched[i] > 0 )
  188. {
  189. found[0]++;
  190. // increment the found  
  191. found[found[0]]=i;
  192.  
  193. }       
  194. }
  195. //alert("found 0 " +  found[0]);
  196. // sort the list as per max percentage of matches
  197.  
  198.  
  199. for (i=1;i<=found[0]-1;i++)
  200.  
  201. {
  202. for(j=i+1;j<=found[0];j++)
  203.  
  204. {
  205. if ( matched[found[i]]< matched[found[j]] )
  206. {
  207. temp= found[j];
  208.  
  209. found[j]=found[i];
  210.  
  211. found[i]=temp;
  212.  
  213. }
  214. }
  215. }
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222. config='toolbar=no,location=no,directories=no,status=no,menubar=no,' 
  223. config += 'scrollbars=yes,resizable=yes' 
  224. output = window.open ("","outputwindow",config)
  225. output.document.write('<title> Daves Search Results </title>'); 
  226. output.document.write('<BODY bgcolor=#ffffff  text=#000000  link=#990099 vlink =#339966 >');
  227.  
  228. output.document.write('<center> <h1> Search Results </h1></center>');    
  229. output.document.write('<hr>');
  230. output.document.write(' The Keyword(s) you searched :: '.big() ); 
  231. for (i=1;  i<=keywords[0]; i++)
  232. {
  233. output.document.write( keywords[i].bold() +"   "); }
  234. output.document.write('<br>');
  235.  
  236. if (found[0]==0)
  237. {
  238.  
  239. output.document.write('<hr>');
  240. output.document.write("<b>No matches resulted in this search </b> <br>");
  241. output.document.write("You may close the results and reduce the length/number  of the keywords  <br>");
  242. }
  243. else
  244. {
  245.  
  246. output.document.write(" <hr> <b> The Results of the search are : </b>  ");
  247. output.document.write( found[0] +"  Entries found  ".italics()); 
  248. output.document.write("<table border=1 width=100%>");
  249. for (i=1; i<=found[0];i++)
  250.  
  251. {
  252. output.document.write("<tr><td valign=topbgcolor=#9999ff>");
  253. output.document.write("<h3>" +i +"</h3>"); output.document.write("<td valign=top>");
  254.  itemp=found[i];
  255. output.document.write(desc[itemp].bold() +"<br>" +links[itemp].link(links[itemp])+"<br>");
  256. temp= (matched[itemp]/keywords[0])*100 
  257. output.document.write("<i> Matched  with keywords  :: "+temp+" %  </i>" );
  258. matched[itemp]=0
  259. found[0]=0;
  260. output.document.write("</table>");
  261. }
  262. output.document.write ('This search was created by   © <a href="http:\\dutta.home.ml.org"> Satadip Dutta</a>    1997'); output.document.write ("<hr>");
  263. output.document.write ("<form><center>"); 
  264. output.document.write ("<input type='button' value='Start Another Search' onClick = 'self.close()'>") ;
  265. output.document.write ("</center></form>");
  266. output.document.close();
  267. }
  268. </script>
  269. <head>
  270. <body>
  271.  
  272. <center>
  273. <H1>Search Engine</H1>
  274. </center>
  275. <hr>
  276. This is a search engine implemented in Javascript. You will need a
  277. Java Script enabled browser to run this search.
  278. <hr>
  279. <P>
  280. </P>
  281.  
  282. <TABLE BORDER=0 CELLSPACING=5 CELLPADDING=5>
  283. <TR>
  284. <TD WIDTH="20%" ALIGN="left">
  285. This search is NOT case sensitive.
  286. </TD>
  287. <TD WIDTH="80%" ALIGN="left">
  288. Put "+" between keywords in a list if using more than one keywords.
  289. </TD>
  290. </TR>
  291. </TABLE>
  292. <form  name="searchengine">
  293.  
  294. <center>
  295. Keywords:
  296. <input type = text   name ="keywords" value=""  maxlength=40>
  297. <input type = button   name="go" Value="Go ahead and find" onClick="search()">
  298. <br>
  299. </center>
  300. </form>
  301. <hr>
  302. This search script was created by © <a href="http://dutta.home.ml.org">Satadip Dutta</a> 1997
  303. <!-- you can write more text/instructions out here. -->
  304. </body>
  305. <html>
  306.