Adding my JavaScript to all Flare topics in WebHelp output

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets
Post Reply
GJT
Jr. Propeller Head
Posts: 6
Joined: Thu Nov 13, 2008 2:46 pm

Adding my JavaScript to all Flare topics in WebHelp output

Post by GJT »

I have a JavaScript file--let's say foo.js--that I want inserted in all WebHelp HTML files output like so:

Code: Select all

<head><title>Foo Class</title>
        <link href="help.css" rel="stylesheet" />
        <script src="SkinSupport/MadCapUtilities.js">
        </script>
        <script src="SkinSupport/MadCapBody.js">
        </script>
        <script src="SkinSupport/MadCapHighlighter.js">
        </script>

<script src="foo.js">
        </script>
</head>
However, I cannot seem to figure out how this bit of code is generated, particularly the MadCap*.js files. The only reference to these files is in MadCap's own resource directory.

How can I modify the output generation / skin to insert my code? Copying the file to the Recource/WebHelp/Content directory is not really an option, as multiple users have Flare installed, and this script should be available for all their output generation as well.
GregStenhouse
Sr. Propeller Head
Posts: 330
Joined: Tue May 13, 2008 3:27 pm
Location: Christchurch, New Zealand

Re: Adding my JavaScript to all Flare topics in WebHelp output

Post by GregStenhouse »

Copy the javascript file to your content directory, then reference the script by editing your master-page. If you want the script referenced in the <head> section you'll need to open the master page in a text editor and manually code it. Otherwise you can use the Flare UI to reference scripts (Insert>Script, Script Link) This will put the script in the <body> wherever your cursor was

Note that this will only be for your project only. To give everyone access, they'll need to manually copy the js file and master page over, or use global project linking

Cheers
Greg
GJT
Jr. Propeller Head
Posts: 6
Joined: Thu Nov 13, 2008 2:46 pm

Re: Adding my JavaScript to all Flare topics in WebHelp output

Post by GJT »

Thank you very much for the suggestion. I am definitely closer than when I was before.

However, I've noticed that when I add a "src" attribute to the script tag in the master page, the tag does not display. The JavaScript file does exist in the content directory.

Am I missing something else? I can get as far as <script type="text/javascript"></script>

in each file. I would prefer not to paste the code, and encompass it in a file.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Adding my JavaScript to all Flare topics in WebHelp output

Post by LTinker68 »

GJT wrote:However, I've noticed that when I add a "src" attribute to the script tag in the master page, the tag does not display.
Doesn't display where? It won't appear in the normal view of the XML Editor because the script isn't running, and there are no icons in Flare to display JavaScript markers like Dreamweaver and similar programs have. If you mean you won't see the output of the JavaScript code, then again, you won't see it in the XML Editor because it's not actually processing (running) the script. It might work in the Preview window; if not then you'll have to build the output to test it (delete the output folder before building so that it doesn't load the masterpage that's in the cache).

Also, if you're not including the JavaScript in the masterpage but are instead referencing it, then you wouldn't use the script tag that you wrote. I think that's the one you use if you're going to include the JS code directly in the topic. Instead, you'd need to add a reference to the JavaScript file, similar to the way stylesheet files are referenced in a topic.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
GJT
Jr. Propeller Head
Posts: 6
Joined: Thu Nov 13, 2008 2:46 pm

Re: Adding my JavaScript to all Flare topics in WebHelp output

Post by GJT »

Thanks everyone for your help. I got the issue sorted out.

Long story short, we're using MadCap in conjunction with ant. I wasn't copying the file over correctly in build.xml . Instead, I was getting blank references to Resources/MasterPages/foo.js
Post Reply