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 >
Wrap
Text File
|
2001-01-26
|
5KB
|
140 lines
//
// $Name: hbh_03 $
// $RCSfile: db_x.js,v $
// $Revision: 1.7 $
//
var timer;
var timer2;
function PreLocalSearch()
{
timer = setTimeout( "localSearch()", 10 );
}
function localSearch()
{
var index;
var searchTerm;
var matchStr;
var fileIndicesArr;
var dbSliceFile;
var firstLetterIndex;
var fileIndexExpr;
var indexPartsArr;
var leftPart, rightPart;
// Clear the timer
clearTimeout( timer );
// Get the passed-in index (corresponding to which search expression word we are now on)
//index = location.search.substr(1, location.search.length);
index = top.frames["Help_left"].glob_NdxCurrentWord++;
// Get the search word corresponding to this index.
searchTerm = top.frames["Help_left"].allSearchTerms[index];
// Trim it to the maximum length
searchTerm = searchTerm.substring(0,12);
// See if the (current) search term/word is found in this file's "words" array
if( words[searchTerm] ) {
// ^^^^^^^^^^^^^^^^^^^^^^^
// ^^^^^ MATCH FOUND ^^^^^
// ^^^^^^^^^^^^^^^^^^^^^^^
//................................................................
//.....Get the list of file indices associated with this word.....
//................................................................
matchStr = words[searchTerm];
//....................................................
//.....Split this list into separate file indices.....
//....................................................
fileIndicesArr = new Array();
fileIndicesArr = matchStr.split(",");
// each entry: n-m or n=m (n:file index & m:count) (- is non-title) (= is title)
//......................................................................
//.....Process each file index, bumping the 'indexHitsArr' as we go.....
//......................................................................
for( var ndx = 0; ndx < fileIndicesArr.length; ndx++ ) {
fileIndexExpr = fileIndicesArr[ndx];
if( fileIndexExpr.indexOf("-") != -1 ) {
// NON-TITLE HIT-------------------------------------------------
indexPartsArr = fileIndexExpr.split("-");
leftPart = parseInt(indexPartsArr[0]);
rightPart = parseInt(indexPartsArr[1]);
if( top.frames["Help_left"].rankHitsArr[leftPart] >= 0 ) {
top.frames["Help_left"].rankHitsArr[leftPart] += rightPart;
}
else {
top.frames["Help_left"].rankHitsArr[leftPart] -= rightPart;
}
}
else {
// TITLE HIT-----------------------------------------------------
indexPartsArr = fileIndexExpr.split("=");
leftPart = parseInt(indexPartsArr[0]);
rightPart = parseInt(indexPartsArr[1]);
if( top.frames["Help_left"].rankHitsArr[leftPart] >= 0 ) {
// Make negative & subtract count
top.frames["Help_left"].rankHitsArr[leftPart] =
0 - top.frames["Help_left"].rankHitsArr[leftPart] - rightPart;
}
else {
top.frames["Help_left"].rankHitsArr[leftPart] -= rightPart;
}
}
top.frames["Help_left"].indexHitsArr[leftPart]++;
}
//.....................................................................
//.....See if we are done processing all of the search words/terms.....
//.....................................................................
if( top.frames["Help_left"].glob_NdxCurrentWord >= top.frames["Help_left"].allSearchTerms.length ) {
// We are done.
PreCallShowResults();
return;
}
//........................................................................
//.....Prepare for and execute the processing of the next search word.....
//........................................................................
firstLetterIndex = top.frames["Help_left"].allSearchTerms[top.frames["Help_left"].glob_NdxCurrentWord].charCodeAt(0);
dbSliceFile = top.dbFilesArr[firstLetterIndex];
if( dbSliceFile.length > 0 ) {
// Our NEXT entered word starts with a letter that
// has a corresponding search db "slice"
//
// ***********************************
// Handle the next "DAISY CHAIN" step.
// ***********************************
top.frames["search_cache"].location = dbSliceFile;
}
else {
// Our first entered word starts with a letter
// not represented by any search db "slice"
top.frames["Help_left"].searchResults_FAIL();
}
}
else {
// ^^^^^^^^^^^^^^^^^^^^^^^^^^
// ^^^^^ NO MATCH FOUND ^^^^^
// ^^^^^^^^^^^^^^^^^^^^^^^^^^
top.frames["Help_left"].searchResults_FAIL();
}
}
function PreCallShowResults()
{
timer2 = setTimeout( "callShowResults()", 10 );
}
function callShowResults()
{
top.frames["Help_left"].assessFinalSearchResults();
clearTimeout( timer2 );
}