Flare 9 HTML5 and TocPath in page links

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets
kate_ivolve
Jr. Propeller Head
Posts: 2
Joined: Tue Dec 04, 2018 4:47 pm

Re: Flare 9 HTML5 and TocPath in page links

Post by kate_ivolve »

bgilliland wrote:For Flare 2018 r2:

File located here:

Code: Select all

C:\Program Files\MadCap Software\MadCap Flare 14\Flare.app\Resources\WebHelp2\Desktop\Scripts\MadCapAll.js
Find this:

Code: Select all

if(MadCap.Utilities.HasRuntimeFileType("TriPane")){Q+=encodeURIComponent("?"+Y+"Path="+X)}else{var R=new MadCap.Utilities.Url(Q);if(S){Q=R.PlainPath+encodeURIComponent("?"+Y+"Path="+X)+R.Fragment}else{Q=R.PlainPath+"?"+(Y+"Path="+X)+R.Fragment}}
Change it to this:

Code: Select all

/*if(MadCap.Utilities.HasRuntimeFileType("TriPane")){Q+=encodeURIComponent("?"+Y+"Path="+X)}else{var R=new MadCap.Utilities.Url(Q);if(S){Q=R.PlainPath+encodeURIComponent("?"+Y+"Path="+X)+R.Fragment}else{Q=R.PlainPath+"?"+(Y+"Path="+X)+R.Fragment}}*/
Does this still work for you? I'm still getting the long URLs, eg:
https://ivolve.sharepoint.com/sites/Doc ... anner/Load Planner.aspx%3FTocPath%3DiVolve%2520Mine4D%2520Load%2520Planner%7C_____0
bgilliland
Propeller Head
Posts: 13
Joined: Fri Sep 11, 2015 12:44 pm

Re: Flare 9 HTML5 and TocPath in page links

Post by bgilliland »

Yes - still works. Just ran it last night and still works fine. Note that my last find/replace post was specifically for 2018 r2. Make sure you've found the right MadCapAll.js file.
kate_ivolve
Jr. Propeller Head
Posts: 2
Joined: Tue Dec 04, 2018 4:47 pm

Re: Flare 9 HTML5 and TocPath in page links

Post by kate_ivolve »

Any idea why this wouldn't work for me? Have double and triple checked the version, location, filename, and replacement text.
Fiona
Sr. Propeller Head
Posts: 117
Joined: Tue Jan 27, 2015 7:44 am
Location: U.K.

Re: Flare 9 HTML5 and TocPath in page links

Post by Fiona »

I've just tried this for the first time in Flare 2019 r2 (generaitng HTML5 Tripane) and commenting out the line in the MadCapAll.js file doesn't seem to be changing my URLs. I'm no coding expert (especially JS!)...can anyone let me know if it still works for them or if there's something else I need to do too? Any advice appreciated. Thanks. Fiona
GreenRoom
Jr. Propeller Head
Posts: 2
Joined: Mon Aug 14, 2017 4:53 am

Re: Flare 9 HTML5 and TocPath in page links

Post by GreenRoom »

wow, I didn't know this is such an old issue.. These ugly URLs really annoy me, and I've create a request to Flare support 2-3 years ago. They replied that this feature request has been added to the queue. It's a pity that the issue can't be fixed since 2013...
bgilliland
Propeller Head
Posts: 13
Joined: Fri Sep 11, 2015 12:44 pm

Re: Flare 9 HTML5 and TocPath in page links

Post by bgilliland »

Fiona (and the rest of us still struggling with this!)

I'm not yet on Flare 2019r2, but what I've done with previous upgrades is searched for a similar string in the code - it's been the same for a while now, but with different letter variables mixed in.

Assuming the correct MadCap.js file is still located here (most likely with some variation on version number):
C:\Program Files\MadCap Software\MadCap Flare 14\Flare.app\Resources\WebHelp2\Desktop\Scripts\MadCapAll.js
Notice the similarities between
Flare 2018
if(MadCap.Utilities.HasRuntimeFileType("TriPane")){M+=encodeURIComponent("?"+S+"Path="+X)}else{var N=new MadCap.Utilities.Url(M);if(O){M=N.PlainPath+encodeURIComponent("?"+S+"Path="+X)+N.Fragment}else{M=N.PlainPath+"?"+(S+"Path="+X)+N.Fragment}}
and Flare 2018 r2
if(MadCap.Utilities.HasRuntimeFileType("TriPane")){Q+=encodeURIComponent("?"+Y+"Path="+X)}else{var R=new MadCap.Utilities.Url(Q);if(S){Q=R.PlainPath+encodeURIComponent("?"+Y+"Path="+X)+R.Fragment}else{Q=R.PlainPath+"?"+(Y+"Path="+X)+R.Fragment}}
You could just search for the first segment up to the red letter, then see if the segment following the variable letter is the same, and so on and so forth. Once you've found the right line of code, just comment it out by
adding this before the first segment above:

Code: Select all

/*
and this after the last segment of code above:

Code: Select all

*/
I do not know how to JS my way out of a paper bag, but I'm good and searching, replacing, and testing. :lol:

Beth
Kathy_123
Propeller Head
Posts: 39
Joined: Thu Oct 04, 2012 9:40 am

Re: Flare 9 HTML5 and TocPath in page links

Post by Kathy_123 »

Wondering if anyone has tried it with 2019 r2.
Trying to get brave.
Kathy_123
Propeller Head
Posts: 39
Joined: Thu Oct 04, 2012 9:40 am

Re: Flare 9 HTML5 and TocPath in page links

Post by Kathy_123 »

Wondering if anyone has tried it with 2019 r2.
Trying to get brave.
Fiona
Sr. Propeller Head
Posts: 117
Joined: Tue Jan 27, 2015 7:44 am
Location: U.K.

Re: Flare 9 HTML5 and TocPath in page links

Post by Fiona »

Kathy_123 wrote:Wondering if anyone has tried it with 2019 r2.
Trying to get brave.
See my post from 25 October...I can't get it working in 2019r2 :-(
bgilliland
Propeller Head
Posts: 13
Joined: Fri Sep 11, 2015 12:44 pm

Re: Flare 9 HTML5 and TocPath in page links

Post by bgilliland »

I've only done this process through 2019 (not 2019 r2). Here is the replacement code for Flare 2019:

File located here:

Code: Select all

C:\Program Files\MadCap Software\MadCap Flare 15\Flare.app\Resources\WebHelp2\Desktop\Scripts\MadCapAll.js
Find this:

Code: Select all

if(MadCap.Utilities.HasRuntimeFileType("TriPane")){Q+=encodeURIComponent("?"+Y+"Path="+X)}else{var R=new MadCap.Utilities.Url(Q);if(S){Q=R.PlainPath+encodeURIComponent("?"+Y+"Path="+X)+R.Fragment}else{Q=R.PlainPath+"?"+(Y+"Path="+X)+R.Fragment}}
Change it to this:

Code: Select all

/*if(MadCap.Utilities.HasRuntimeFileType("TriPane")){Q+=encodeURIComponent("?"+Y+"Path="+X)}else{var R=new MadCap.Utilities.Url(Q);if(S){Q=R.PlainPath+encodeURIComponent("?"+Y+"Path="+X)+R.Fragment}else{Q=R.PlainPath+"?"+(Y+"Path="+X)+R.Fragment}}*/
And remember - the hack above is for HTML5 Tripane only. If you use Side Nav, Top Nav, or Skinless, there is an option in the interface to disable it (uncheck "Synchronize navigation elements with TOC entries").

If someone can post the same MadCapAll.js file for 2019 r2, I can take a look at it (no promises) - but I won't be able to test it.
tdewolf
Jr. Propeller Head
Posts: 4
Joined: Wed Feb 01, 2017 7:44 am

Re: Flare 9 HTML5 and TocPath in page links

Post by tdewolf »

in 2019R2 it's exactly the same as in 2018R2, same file line 57 position 18181 to 18426
tdewolf
Jr. Propeller Head
Posts: 4
Joined: Wed Feb 01, 2017 7:44 am

Re: Flare 9 HTML5 and TocPath in page links

Post by tdewolf »

In Flare 2020 it seems to be quite different as there's no MadCapAll.js anymore in that folder (Resources/WebHelp2/Desktop/Scripts).
But that folder now has a file MadCapHelpSystem.js.

I commented line 1148 to 1159 included and then my URLs of the HTML5 output is clean again.
Dafra08
Propeller Head
Posts: 45
Joined: Fri Aug 16, 2019 1:02 am

Re: Flare 9 HTML5 and TocPath in page links

Post by Dafra08 »

tdewolf wrote:In Flare 2020 it seems to be quite different as there's no MadCapAll.js anymore in that folder (Resources/WebHelp2/Desktop/Scripts).
But that folder now has a file MadCapHelpSystem.js.

I commented line 1148 to 1159 included and then my URLs of the HTML5 output is clean again.
Thanks for pointing me in the right direction. I had to comment out lines 1147-1160, otherwise it would not build.

Code: Select all

//        if (href != null && tocType && appendTocPath) {
//            var isEmbeddedTopic = window.name == "topic" && !MadCap.Utilities.HasRuntimeFileType("Default");
//            var tocPath = GetTocPath(entry, true);
//            if (MadCap.Utilities.HasRuntimeFileType("TriPane")) {
//                href += encodeURIComponent('?' + tocType + 'Path=' + tocPath);
//            } else {
//                var hrefUrl = new MadCap.Utilities.Url(href);
//                if (isEmbeddedTopic) {
//                    href = hrefUrl.PlainPath + encodeURIComponent('?' + tocType + 'Path=' + tocPath) + hrefUrl.Fragment;
//                } else {
//                    href = hrefUrl.PlainPath + '?' + (tocType + 'Path=' + tocPath) + hrefUrl.Fragment;
//                }
//            }
//        }
Dafra08
Propeller Head
Posts: 45
Joined: Fri Aug 16, 2019 1:02 am

Re: Flare 9 HTML5 and TocPath in page links

Post by Dafra08 »

In Flare 2021 r2 it's rows 1282-1295.
Dafra08
Propeller Head
Posts: 45
Joined: Fri Aug 16, 2019 1:02 am

Re: Flare 9 HTML5 and TocPath in page links

Post by Dafra08 »

In Flare 2022 it's rows 1298–1311.

MadCapHelpSystem.js (make a backup copy before editing)
C:\Program Files\MadCap Software\MadCap Flare 18\Flare.app\Resources\WebHelp2\Desktop\Scripts\
bgilliland
Propeller Head
Posts: 13
Joined: Fri Sep 11, 2015 12:44 pm

Re: Flare 9 HTML5 and TocPath in page links

Post by bgilliland »

It's 2023! Looking for a little insight as to how folks are managing this these days. We first employed this fix trying to resolve TWO issues:

1) The long URL TocPath (not ideal for support/customers)
2) Jumping around in the menu when a topic is used multiple times in a ToC (synchronizing navigation)

Originally we started with tri-pane HTML5 output. We are now using side nav HTML5 output for all our builds.

The second paragraph in the sync nav doc: For HTML5 Tripane output, navigation elements will always remain in sync with your TOC entries. However, for HTML5 Side Navigation, Top Navigation, and skinless outputs, you must enable a feature in your target to synchronize navigation elements with TOC entries.

Commenting out code definitely removes the long TocPath in the URL, but checking the sync nav elements checkbox does not actually help sync the navigation.

So is there anyone successfully using side nav (or top or skinless) with short urls AND the sync nav is working when you have a topic appear multiple times?
Post Reply