home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 September (Special) / Chip-Special_2002-09_Digitalni-Video.bin / software / premiere / ARCHIVE.Z / db_x.js < prev    next >
Text File  |  2001-01-26  |  5KB  |  140 lines

  1. //
  2. // $Name: hbh_03 $
  3. // $RCSfile: db_x.js,v $
  4. // $Revision: 1.7 $
  5. //
  6. var timer;
  7. var timer2;
  8.  
  9. function PreLocalSearch()
  10. {
  11.     timer = setTimeout( "localSearch()", 10 );
  12. }
  13.  
  14. function localSearch()
  15. {
  16.     var index;
  17.     var searchTerm;
  18.     var matchStr;
  19.     var fileIndicesArr;
  20.     var dbSliceFile;
  21.     var firstLetterIndex;
  22.     var fileIndexExpr;
  23.     var indexPartsArr;
  24.     var leftPart, rightPart;
  25.     
  26.     // Clear the timer
  27.         clearTimeout( timer );
  28.         
  29.     // Get the passed-in index (corresponding to which search expression word we are now on)
  30.         //index = location.search.substr(1, location.search.length);
  31.         index = top.frames["Help_left"].glob_NdxCurrentWord++;
  32.  
  33.     // Get the search word corresponding to this index.
  34.         searchTerm = top.frames["Help_left"].allSearchTerms[index];
  35.  
  36.     // Trim it to the maximum length
  37.         searchTerm = searchTerm.substring(0,12);
  38.  
  39.     // See if the (current) search term/word is found in this file's "words" array
  40.         if( words[searchTerm] ) {
  41.  
  42.             // ^^^^^^^^^^^^^^^^^^^^^^^
  43.             // ^^^^^ MATCH FOUND ^^^^^
  44.             // ^^^^^^^^^^^^^^^^^^^^^^^
  45.  
  46.                 //................................................................
  47.                 //.....Get the list of file indices associated with this word.....
  48.                 //................................................................
  49.                     matchStr = words[searchTerm];
  50.                     
  51.                 //....................................................
  52.                 //.....Split this list into separate file indices.....
  53.                 //....................................................
  54.                     fileIndicesArr = new Array();
  55.                     fileIndicesArr = matchStr.split(","); 
  56.                     // each entry: n-m or n=m (n:file index & m:count) (- is non-title) (= is title)
  57.                     
  58.                 //......................................................................
  59.                 //.....Process each file index, bumping the 'indexHitsArr' as we go.....
  60.                 //......................................................................
  61.                     for( var ndx = 0; ndx < fileIndicesArr.length; ndx++ ) {
  62.                         fileIndexExpr = fileIndicesArr[ndx];
  63.                         if( fileIndexExpr.indexOf("-") != -1 ) {
  64.                             // NON-TITLE HIT-------------------------------------------------
  65.                             indexPartsArr = fileIndexExpr.split("-");
  66.                             leftPart = parseInt(indexPartsArr[0]);
  67.                             rightPart = parseInt(indexPartsArr[1]);
  68.                             if( top.frames["Help_left"].rankHitsArr[leftPart] >= 0 ) {
  69.                                 top.frames["Help_left"].rankHitsArr[leftPart] += rightPart;
  70.                             }
  71.                             else {
  72.                                 top.frames["Help_left"].rankHitsArr[leftPart] -= rightPart;
  73.                             }
  74.                         }
  75.                         else {
  76.                             // TITLE HIT-----------------------------------------------------
  77.                             indexPartsArr = fileIndexExpr.split("=");
  78.                             leftPart = parseInt(indexPartsArr[0]);
  79.                             rightPart = parseInt(indexPartsArr[1]);
  80.                             if( top.frames["Help_left"].rankHitsArr[leftPart] >= 0 ) {
  81.                                 // Make negative & subtract count
  82.                                 top.frames["Help_left"].rankHitsArr[leftPart] = 
  83.                                     0 - top.frames["Help_left"].rankHitsArr[leftPart] - rightPart;
  84.                             }
  85.                             else {
  86.                                 top.frames["Help_left"].rankHitsArr[leftPart] -= rightPart;
  87.                             }
  88.                         }
  89.                         top.frames["Help_left"].indexHitsArr[leftPart]++;
  90.                     }
  91.             
  92.                 //.....................................................................
  93.                 //.....See if we are done processing all of the search words/terms.....
  94.                 //.....................................................................
  95.                     if( top.frames["Help_left"].glob_NdxCurrentWord >= top.frames["Help_left"].allSearchTerms.length ) {
  96.                         // We are done. 
  97.                         PreCallShowResults();
  98.                         return; 
  99.                     }
  100.                             
  101.                 //........................................................................
  102.                 //.....Prepare for and execute the processing of the next search word.....
  103.                 //........................................................................
  104.                     firstLetterIndex =     top.frames["Help_left"].allSearchTerms[top.frames["Help_left"].glob_NdxCurrentWord].charCodeAt(0);
  105.  
  106.                     dbSliceFile = top.dbFilesArr[firstLetterIndex];
  107.                     if( dbSliceFile.length > 0 ) {
  108.                         // Our NEXT entered word starts with a letter that 
  109.                         // has a corresponding search db "slice"
  110.                         // 
  111.                         // ***********************************
  112.                         // Handle the next "DAISY CHAIN" step.
  113.                         // ***********************************
  114.                         top.frames["search_cache"].location = dbSliceFile;
  115.                     }
  116.                     else {
  117.                         // Our first entered word starts with a letter 
  118.                         // not represented by any search db "slice"
  119.                         top.frames["Help_left"].searchResults_FAIL();
  120.                     }
  121.  
  122.         }
  123.         else {
  124.             // ^^^^^^^^^^^^^^^^^^^^^^^^^^
  125.             // ^^^^^ NO MATCH FOUND ^^^^^
  126.             // ^^^^^^^^^^^^^^^^^^^^^^^^^^
  127.                 top.frames["Help_left"].searchResults_FAIL();
  128.         }
  129. }
  130.  
  131. function PreCallShowResults()
  132. {
  133.     timer2 = setTimeout( "callShowResults()", 10 );
  134. }
  135. function callShowResults()
  136. {
  137.     top.frames["Help_left"].assessFinalSearchResults();
  138.     clearTimeout( timer2 );
  139. }
  140.