Eileen, Rick, Peter, et. al.:
Hey, howzit goin?
Some time back, I created several scripts to filter and
modify search results. Here is one to hide specific files, created
in '06. I know it works for the previous version of Webhelp, but I
haven't looked to see if the lastest version of the function
displayTopics() has changed...
Basically, you'll alter a script found in whfhost.js that
displays the Search pane, so the displayTopics() function skips
files with a special prefix.
You'll: 1) add the prefix to the files to hide, and 2) add
the bit-o-script to the whfhost.js file:
1) add the text 'popup_' to the front of the filename of each
file you wish to hide. Or, use your own term to denote hidden files
(like "hidden_").
2) In the generated WebHelp folder, open whfhost.js to the
function displayTopics(); Replace the part of that function found
in whfhost.js that looks like the first snip, and replace it with
the second, prettier script.
Note: There are two almost identical lines in the replacement
script, one version for testing on your workstation, the second to
actually use when posting on the server. Move the comment slashes
from the second to the first version before you post it online.
var Search_xstart = Search_URL.lastIndexOf("\\") + 1 // TEST
LOCALLY - start of filename -
// var Search_xstart = Search_URL.lastIndexOf("/") + 1 // USE
WHEN ONLINE - start of filename -
Replace:
============[ SNIP : ORIGINAL SCRIPT
]===========================
function displayTopics()
{
var sHTML="";
var sLine="";
for(var i=0;i<gaTI.length;i++){
sLine+="<dt><nobr><a href='"+gaTI
.sTopicURL+"'>"+_textToHtml(gaTI.sTopicTitle)+"</a></nobr></dt>";
if(i>>4<<4==i)
{
sHTML+=sLine;
sLine="";
}
}
============[ END SNIP
]========================================
with this:
============[ SNIP: REPLACEMENT SCRIPT
]========================
function displayTopics()
{
var Search_noShow = "popup_"; // 6 chars
var sHTML="";
var sLine="";
for(var i=0;i<gaTI.length;i++){
var Search_URL = gaTI
.sTopicURL // search result is already escaped
var Search_xstart = Search_URL.lastIndexOf("\\") + 1 // TEST
LOCALLY - start of filename -
// var Search_xstart = Search_URL.lastIndexOf("/") + 1 //
USE WHEN ONLINE - start of filename -
var Search_xend = Search_URL.length // end of filename
var Search_tName =
Search_URL.substring(Search_xstart,Search_xend) // filename
var Search_tPath = Search_URL.substring(0,Search_xstart) //
path, might need it later
var Search_tNamePrefix =
Search_URL.substring(Search_xstart,Search_xstart+6) // 6-char
prefix
if (Search_noShow == Search_tNamePrefix)
{
}
else {
sLine+="<dt><nobr><a
href='"+gaTI.sTopicURL+"'>"+_textToHtml(gaTI
.sTopicTitle)+"</a></nobr></dt>";
if(i>>4<<4==i)
{
sHTML+=sLine;
sLine="";
}
}
}
===========[ END SNIP ]======================================