Toolbar scripts

Download file: 

The attached JavaScript file offers several toolbar scripts to use in custom buttons (in WebHelp). Supported functions are:

  • Bookmark topic (add to favorites).
  • Email link to topic.
  • Expand all dropdowns and expandspots.
  • Hide all dropdowns and expandspots.
  • Print topic (and expand dropdowns and expandspots).
  • Print topic (do not expand dropdowns and expandspots).

Note:

  • Many thanks to Adobe and Peter Grainge for creating the original print script and the topicPane method.
  • RoboHelp 8 and 9 are supported.(Other versions may work, but are not supported.)
  • Standard RoboHelp twisties are supported.
  • Only Firefox, Internet Explorer and Opera support setting bookmarks through JavaScript. Users with other browsers receive an alert with the URL of the current topic so they can set the bookmark manually.
  • The bookmark script will not work for local WebHelp.

 

Setting up the script

  1. Add the script file as a baggage file to your project.
  2. If you use any twisty method other than the standard RoboHelp twisties, you need to set the variable RHTwisty to false.
  3. Open your skin in the skin editor and add a new button.
  4. Go to the Action tab and choose JavaScript in the Action section.
  5. In the JavaScript section, select External JavaScript and choose the script file.
  6. In the OnClick field, add the JavaScript function you want to use. Choose one of the following1:
  • BookmarkTopic() → Bookmark the current topic.
  • Email() → Send an email with the link to the current topic.
  • Hide() → Hide dropdowns and expandspots.
  • PrintTopic() → Expand dropdowns and expandspots and print the topic.
  • PrintTopicNotExpand() → Print the topic.
  • Show() → Expand dropdowns and expandspots.
  1. Save your skin.
  2. In the SSL dialog, choose the buttons you want to include in your output.

You can change the default title and message of the email as follows:

  • For the message: Go to line 58 and add your message between the parenthesis.
  • For the title: Go to line 57 and add your custom title before, after or instead of the function GetTopicTitle(), example:
var title = 'My custom title '+GetTopicTitle();

Revision history

Version Note
20111005
  • Fixed bug that returned an incorrect URL for the bookmark function when the project was opened using a context sensitive URL.
  • Improved message for manual bookmark.
20110828 Added email function.
20110114 Initial version.

 

  • 1. Include the parenthesis.

Tags: