Auto-hiding/showing Browse Sequence navigation controls

This forum is for all Flare related Tips and Tricks.
Have a tip or trick you use while working in Flare? Share it here.
Post Reply
TheGreatAndPowerfulOz
Sr. Propeller Head
Posts: 130
Joined: Mon Apr 24, 2006 12:52 pm
Location: Glen Mills, PA

Auto-hiding/showing Browse Sequence navigation controls

Post by TheGreatAndPowerfulOz »

Hello, all.

I came up with a ("quick and dirty") way to auto-hide or show the navigation controls for Browse Sequences, depending on whether or not the user is viewing a topic which is part of a Browse Sequence.

Ideally, I think it would be great to have an "out of the box" way via an option on the WebHelp Toolbar tab of the project Skin (or possibly the Styles tab, where properties of toolbar items are set) which would allow us to specify showing/hiding of the controls based on some condition. In this case, of course, the condition would be whether or not the current topic belongs to a Browse Sequence. Sounds like an Enhancement Request in the making...

For now, let me tell you how I came to think about hiding/showing the navigation controls, and more importantly, how I accomplished it! :wink:

When setting up the WebHelp Toolbar for my project skin, I added the following toolbar buttons from left-to-right, as listed below:
  • PreviousTopic
    CurrentTopicIndex
    NexTopic
This permits my users to see that they're viewing "Page n of nn" whenever they've opened a topic which belongs to a Browse Sequence, and the ability to navigate to the previous or next topic through use of the "Previous Topic" and "Next Topic" buttons, respectively.

I also have the normal "Back" and "Forward" navigation buttons on the Toolbar, which rely on the browser's history to take the user back or forward through pages they've visited, whether or not they happen to belong to a Browse Sequence.

I noticed that the "Page n of nn" text (CurrentTopicIndex) disappears automatically when the user moves to a topic which is NOT part of a Browse Sequence. Nice! But, I also thought it would eliminate some confusion for the user if the "Previous Topic" and "Next Topic" buttons disappeared along with it. After all, when on a non-Browse Sequence topic, why would I want two sets of navigation buttons showing up on my Toolbar?

So, I did a little investigation and found that this behavior happens when the <span> element which holds the "Page n of nn" text in the output gets its "display" attribute set to "none" via a line of code in the "MadCapAll.js" file (source file located at "C:\Program Files\MadCap Software\MadCap Flare V<YourVersionHere>\Flare.app\Resources\WebHelp\Content\SkinSupport\").

I simply made the following change within the "MadCapAll.js" file to dictate that the <span> element's parent element (<td>) and its siblings (the <td> elements holding the "Previous Topic" and "Next Topic" buttons, respectively) also get their "display" attribute set to "none" when the current topic is not part of a Browse Sequence.

First, I commented-out the "span.style.display="none";" line and append what's shown below. This takes care of hiding all the <td> elements when a non-Browse Sequence topic is loaded:

Code: Select all

// span.style.display="none";
span.parentNode.style.display="none";
span.parentNode.nextSibling.style.display="none";
span.parentNode.previousSibling.style.display="none";
Next, I did some similar coding around the "span.style.display="";" line, a couple of lines down in the .js file. This removes the "none" value from the "display" attribute of each of the elements when a Browse Sequence topic is being viewed, so the controls show up again in the Toolbar:

Code: Select all

// span.style.display="";
span.parentNode.style.display="";
span.parentNode.nextSibling.style.display="";
span.parentNode.previousSibling.style.display="";
And that's it!

As I mentioned, this is pretty "brute force", but it gets the job done. I hope this can be of use to someone else out there! :D
Last edited by TheGreatAndPowerfulOz on Thu Mar 08, 2012 11:54 am, edited 1 time in total.
Austin Wright

Flare 2022 r3 (18.2.8431.26678) :: TopNav HTML5 / PDF output
Vrushali
Jr. Propeller Head
Posts: 1
Joined: Mon Feb 06, 2012 9:50 am

Re: Auto-hiding/showing Browse Sequence navigation controls

Post by Vrushali »

Hi Is there a way to do away with the 0 in "Page 0 of 5 " that appears in the Webhelp output for every book entry. I did prefer to have it Page 1 for book and subsequent numbers for the sub topics below them. Checked the MadCallAll.js file but do not understand which value needs to be reset.
Thanks,
Vrushali
TheGreatAndPowerfulOz
Sr. Propeller Head
Posts: 130
Joined: Mon Apr 24, 2006 12:52 pm
Location: Glen Mills, PA

Re: Auto-hiding/showing Browse Sequence navigation controls

Post by TheGreatAndPowerfulOz »

Vrushali,

I assume that you're seeing "Page 0 of n" when you've got a book in your Browse Sequence selected because you've linked book items to topics in your project. In other words, when the user selects a Browse Sequence book, a topic displays in the right pane of the WebHelp, right?

I've actually never seen that behavior, since I don't link my Browse Sequence books to project topics; I just use the books to organize my Browse Sequence topics. As such, I've not considered how to deal with that behavior in the custom code I wrote for the "MadCapAll.js" file. I'm not sure how difficult it would be to track it down and "tweak" accordingly.

Unfortunately, I haven't got a lot of time on my hands right now to investigate. I hope someone else might be able to help in the meantime! Apologies.
Austin Wright

Flare 2022 r3 (18.2.8431.26678) :: TopNav HTML5 / PDF output
TheGreatAndPowerfulOz
Sr. Propeller Head
Posts: 130
Joined: Mon Apr 24, 2006 12:52 pm
Location: Glen Mills, PA

Re: Auto-hiding/showing Browse Sequence navigation controls

Post by TheGreatAndPowerfulOz »

.
UPDATE for (at least) Flare v7:

With each new version of Flare that comes out, I compare the new "MadCapAll.js" file with the one from the previous version, to see if any custom code I've created may no longer be necessary.

I don't remember with which version of Flare it may have been, but it seems that the code discussed in this post is no longer necessary to cause the "Previous Topic" and "Next Topic" buttons to disappear when a topic is loaded that doesn't belong to a Browse Sequence. :D

I guess I forgot to keep track, and to update this post accordingly at the time that script change came around. Anyway, while updating my v8 "MadCapAll.js" file I noticed that I hadn't included the code discussed here in the v7 file. Nonetheless, my "Previous Topic" and "Next Topic" buttons appear/disappear as I would expect them to. Thanks, MadCap!

BTW (to Vrushali), I also spotted a "SetCurrentTopicIndexFormatString" function in the v7 and v8 files. I'm pretty sure that the setting of the index values is handled therein. If I have time at some future point, I may take a closer look and see if I can offer a solution for you. Meanwhile, maybe knowing where to look will give you a leg up. (Anyone) please post any solutions you find here.

Oz, out!
Austin Wright

Flare 2022 r3 (18.2.8431.26678) :: TopNav HTML5 / PDF output
suganthavardhini
Propeller Head
Posts: 12
Joined: Tue Jun 19, 2012 3:45 am

Re: Auto-hiding/showing Browse Sequence navigation controls

Post by suganthavardhini »

Hi

The navigation buttons which has to lead me to the Previous and Next topics are not working in my published output. Please let me know the procedure to make it work?

Thanks
Suganthi M
TheGreatAndPowerfulOz
Sr. Propeller Head
Posts: 130
Joined: Mon Apr 24, 2006 12:52 pm
Location: Glen Mills, PA

Re: Auto-hiding/showing Browse Sequence navigation controls

Post by TheGreatAndPowerfulOz »

suganthavardhini wrote:Hi

The navigation buttons which has to lead me to the Previous and Next topics are not working in my published output. Please let me know the procedure to make it work?

Thanks
Suganthi M
Suganthi,

First let me say that I've actually "moved on" from WebHelp-type output and am now deploying HTML5 output for my project. In that type of output, the code is quite different and the methods described in this thread are no longer applicable. As such, I'm not devoting much (any) time these days to the topic of Browse Sequence navigation hacking. :wink:

As to your question, do you mean that you can see the "Previous" and "Next" buttons when you view a topic that's part of a Browse Sequence, but they're just not functioning properly (i.e., when you click the buttons you don't go to the previous/next topic in the sequence)? If that's the case, I think you'll need to seek an answer from MadCap support (or at least someone else in the forums who's smarter than me!). I don't know much at all about the actual functioning of these buttons. :|

By the way, what version of Flare are you using, and what type of output are you generating (WebHelp, HTML5, etc.)? There's a big difference between the various types of output and, in some cases, the code behind any given piece of functionality from version to version.
Austin Wright

Flare 2022 r3 (18.2.8431.26678) :: TopNav HTML5 / PDF output
suganthavardhini
Propeller Head
Posts: 12
Joined: Tue Jun 19, 2012 3:45 am

Re: Auto-hiding/showing Browse Sequence navigation controls

Post by suganthavardhini »

Hi, Thanks for replying. I am using Flare 7 and the problem occurs both in Web help and HTML 5 output.

As you said, yes the problem is with the Previous, next buttons. They are actually static and doesn't work at all.

Also, when clients requests for a particular section in the user guide, I provide them the URL to that section. The link takes to the user guide with the left navigational section, 'Content window' collapsed. This leaves the user with no clue where he is. Initially I thought that's the behavior of the Software. But when I checked the Madcap Flare User Guide, it is working fine. The URL from flare user guide when used in a different browser window actually has the same topic highlighted in the left navigation window. This actually helps the user to know where he is.

Please help. Desperately looking for a solution.
You do not have the required permissions to view the files attached to this post.
Post Reply