FAR Web Help – Open Nav Link

FAR HTML can be used to create web help. Many of you use “FAR Uncompressed Help” to generate navigation for your web and Intranets sites. FAR Uncompressed Help adds a JavaScript based navigation, generated from your CHM .HHC and .HHK files, which will work on the web and in any modern browser.

The FAR navigation is done using Frames and looks something like this…

But if you closed the navigation pane, or go directly to a page using say Google, there was no way to easily open the navigation frame. Until now.

I’ve added some script to each page (easily done with FAR Find and Replaces) that displays a link “< Table Of Contents” at the top of each page (but only shows when navigation is closed).

Go to this page now and try clicking the link (top of page) to open the navigation frame:


You are welcome to use the code.  Here’s what you need to do:

1. Add the file NavScript.js to the root folder where “hh_goto.htm” lives.
(hh_goto.htm is a file generated by FAR 4.3 Uncompressed Help)
You can get JS file from the Helpware site:
http://helpware.net/FAR/help/NavScript.js

2. Add the following script immediately after your <body> tag.

<body>
<script src=”NavScript.js” language=”JavaScript1.2″ type=”text/javascript”></script> <script language=”JavaScript1.2″ type=”text/javascript”>WriteNavLink(0);</script>

Files one level down from the root folder would look like this…

<body>
<script src=”../NavScript.js” language=”JavaScript1.2″ type=”text/javascript”></script> <script language=”JavaScript1.2″ type=”text/javascript”>WriteNavLink(1);</script>

Files two levels down from the root folder would look like this…

<body>
<script src=”../../NavScript.js” language=”JavaScript1.2″ type=”text/javascript”></script> <script language=”JavaScript1.2″ type=”text/javascript”>WriteNavLink(2);</script>

… and so on.

3. Tweak the script to suite your own situation.

Note that I had to tweak the <H1> CSS style to “margin-top:0 px;” to make the link sit nice and close to the H1 header. Ping me if you need a hand.

29-Sept-2008 – Adv Find and Replace

I’ve added a new command to the FAR 5 Find and Replace  dialog so you can insert the above script in a single pass.

Open the Adv Find and Replace dialog and click the [v] insert menu button. Select “$R$[..] — Insert NavScript.js web help script”.

19-Apr-2010 – Adding to files using FAR batch mode

You can also automate the inserting of the script using FAR batch mode.
  1. First make sure you add “NavScript.js” to the root of your help web.
  2. Now add a text file to the root with a .FarRun ext
    – eg. “NavScript_BatchJob.FarRun”
The .FarRun file is associated with FAR.exe and can be run in the same way you run a batch file.
Here’s what needs to go into that .FarRun file
[default]
LoadHtmlFiles
AddNavScript
[LoadHtmlFiles]
FileScan=.\*.htm*
[AddNavScript]
FindStart=<body>
Replace=<body>
\ <!– ==============(Start:NavScript)================= –>
\ <script src=”$R$[str:..\]NavScript.js” language=”JavaScript1.2″ type=”text/javascript”></script>
\ <script language=”JavaScript1.2″ type=”text/javascript”>WriteNavLink($R$[int:0]);</script>
\ <!– ==============(End:NavScript)================= -

[default] LoadHtmlFiles AddNavScript [LoadHtmlFiles] FileScan=.\*.htm* [AddNavScript] FindStart=<body> Replace=<body> \ <!-- ==============(Start:NavScript)================= --> \ <script src="$R$[str:..\]NavScript.js" language="JavaScript1.2" type="text/javascript"></script> \ <script language="JavaScript1.2" type="text/javascript">WriteNavLink($R$[int:0]);</script> \ <!-- ==============(End:NavScript)================= -->

Tags: , , , , , , ,

4 Responses to “FAR Web Help – Open Nav Link”

  1. David says:

    I like the look of Far’s webhelp and the open toc is a nice addition. Two questions about Far’s web help generally:

    1. Is it internationalized? In particular, will the search work with Asian languages?

    2. Can it be generated using Far from the command line? (e.g. by a build system without human intervention.

    Thanks,
    David

  2. Rob says:

    Hi Dave
    1. Yes we have companies producing Japanese Uncompressed Help. Search works fine in Japanese.
    2. Yes there are 2 batch commands MakeUncompHelp= and JSSearch= — so can all be done in unattended mode.
    http://helpware.net/FAR/help/farbatch.htm#Overview

  3. David says:

    On that page is the example “FAR.EXE /B:BatchJob.ini,defaultFTP_Upload_List” correct? My guess is that it should be “FAR.EXE /B:BatchJob.ini,FTP_Upload_List” (i.e. remove ‘default’ after the comma).

  4. Rob says:

    Thanks David. Corrected typo.

Leave a Reply