whthost.js

Whthost.js is the file that holds all the functions to create the table of contents.

The scripts form whthost.js are only used in whtdhtml.htm.

Variables

In the top of whthost.js are a lot of variables that control the way the table of contents responds. By modifying these variables, you control how the table of contents works.

Variable Usage
gsABgColor The colour used for highligthing the table of contents. This can be overwritten by the function setActiveBgColor.
gsBgColor The background colour of the table of contents. This can be overwritten by the function setBackgroundcolor.
gsBgImage The background image of the table of contents. This can be overwritten by the function setBackground.
gsIndent The indent of elements inside a book. This can be overwritten by the function setIndent.
gInSync Boolean that tells whether the table of contents is synchronized or not.
gsLoadingDivID The id used for the DIV that displays the loading message.
gsLoadingMsg The message that is shown while the table of contentsis loading.
gbLoadToc Setting this to true prevents the table of contents from loading. The sidebar will load though, you just have an empty table of contents.
gsMargin The margin of TOC items. This can be overwritten by the function setMargin.

Functions

This section lists several useful functions in whthost.js.

Function Variables Use
setActiveBgColor sBgColor1 Sets the highlight colour of the table of contents.
setBackground sBgImage2 Sets the background image of the table of contents.
setBackgroundcolor sBgColor3 Sets the background colour of the table of contents.
setIcon sType4, sURL5 Sets the icon for a table of contents item, such as a book.
setIndent sIndent6 Sets the indent of elements inside a book.
setMargin sMargin7 Sets the margin of TOC items.
syncInit   Synchronize the table of contents. By amending this function, you can stop the table of contents from scrolling horizontally. See: Stop TOC from scrolling horizontally
TocWriteClassStyle   Writes the css styles for the table of contents. Modify the styles in this function. To set the highlight for the table of contents, see: Highlighting the TOC
writeLoadingDiv   Returns the loading DIV. Contains inline styling you can modify in this function.

 

  • 1. The highlight colour of the table of contents.
  • 2. The background image for the table of contents.
  • 3. The background colour for the table of contents.
  • 4. The type of icon.
  • 5. The URL of the image.
  • 6. An indent, such as 10px.
  • 7. A margin, such as 10px.