Add js file to default file in HTML 5 output

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets
Post Reply
pouliotmax
Sr. Propeller Head
Posts: 123
Joined: Wed Mar 07, 2007 9:16 am
Location: Quebec City

Add js file to default file in HTML 5 output

Post by pouliotmax »

Hi,
i need to add a js function in the default file that is located here :
C:\Program Files\MadCap Software\MadCap Flare V10\Flare.app\Resources\WebHelp2\Desktop

I can do this manually but would prefer to use some functions in Flare (i have to do this on many computers, each time a new Flare version comes out)

Anyway to do this in Flare?

Thx!
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Add js file to default file in HTML 5 output

Post by NorthEast »

I'm assuming you want the script is to run with the Default.htm file (skin), rather than a topic.

You can include custom javascript to the output help file (Default.htm) via the skin editor. Open the skin Toolbar tab, and enter the script it in the custom javascript section (on the right).

When you build the output, the script is run when you open Default.htm; it will include a link in the head section to a file Toolbar.js, which will contain the script that you have entered in the skin.

By doing it this way, it means the script is included in the project itself, and you don't have to manually hack files in the Program files folder.

I think the toolbar script was intended to be used so that you can include functions for your own custom toolbar buttons, but it allows you to run any script in the main skin output file Default.htm - I use it to customise the skin: http://forums.madcapsoftware.com/viewto ... 12&t=19584
pouliotmax
Sr. Propeller Head
Posts: 123
Joined: Wed Mar 07, 2007 9:16 am
Location: Quebec City

Re: Add js file to default file in HTML 5 output

Post by pouliotmax »

I think this will work!

I'm gonna try it tomorrow!

Thx
pouliotmax
Sr. Propeller Head
Posts: 123
Joined: Wed Mar 07, 2007 9:16 am
Location: Quebec City

Re: Add js file to default file in HTML 5 output

Post by pouliotmax »

Hey,
i tried adding this :

Code: Select all

<script type="text/javascript" src="http://saaprod/soutien_tache/CommunOutils/scripts/flare.js">
        </script>
on the right in the toolbar tab (custom javascript). I then build my target and if i go in the source code of the default.htm file of my HTML output, i dont' see flare.js file

What am i doing wrong?
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Add js file to default file in HTML 5 output

Post by NorthEast »

You can't add HTML, you enter the actual javascript code.

When you click Edit, either (a) select Load file and select your flare.js file, or (b) just copy/paste the script code into the box.
pouliotmax
Sr. Propeller Head
Posts: 123
Joined: Wed Mar 07, 2007 9:16 am
Location: Quebec City

Re: Add js file to default file in HTML 5 output

Post by pouliotmax »

Ok, added this in the edit window :

Code: Select all

window.onload = function()
{
	obtenirTOC222();
}
	
function obtenirTOC222()
{
	$.ajax({
		type: "post",
		url: "http://saaprod/soutien_tache/outils/preferencesAO/tocCheck.asp",	
		success: function(str)
		{
			if (str=="Oui")
 				{
				//alert(str);
				$("#show-hide-navigation").click(); 
 				}				
				
			} 	
		});
}
Still not showing in the default.htm file!

Thx for the help!
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Add js file to default file in HTML 5 output

Post by NorthEast »

Just try something simple to confirm it works; e.g.:

Code: Select all

alert('hello!');
Post Reply