jQuery is not included in RoboHelp. You can include it manually by adding a reference to jQuery in the master page or on your topics. You will need to include the jQuery library as a baggage file to get it in the output.
Also, the rhvariable.fpj file is not available once you generate the output. So in the CHM this script will never work.
What are you trying to achieve with this script? There may be better solutions than doing this with jQuery,
Hi William, thank you for your response.
Yes, I understand jQuery isn't included in RH.
- I included the jQuery.js file as a baggage file in my project.
- I made the necessary <script> call to it in my .htt master page's header - I actually placed the call in the <?rh-region_start type="header" ?> section of the code so it looks like this:
<?rh-region_start type="header" ?>
<?rh-region_end type="header" ?>
- I've added the rhvariable.fpj (actually rhvariable.apj) as a baggage file and I verified it gets included in the chm compilation by decompiling the chm.
When clicked, an e-mail form from their default e-mail app is displayed:
The Subject line incorporates the two UDV's - UDV #1 is the product version, UDV #2 is the product name.
We got it to work somewhat by creating two <div> containers that encapsulate the two UDV's, applied an id (id="version" and id="product") to the div's. We then use jQuery to get the respective <div> text, then use jQuery to hide the <div> text so they don't appear in the topics...UGH! Once that's done, the feedback script appears to be working ... for our smaller Laser help project anyways, and only for html output (.chm). When we do Web output, only the initial "PC-DMIS " appears in the Subject line...ARGH!!! But the script is working with the RH previewer (Ctrl+W)...ERRR!!!
The e-mail form from the .chm feedback link displays properly as shown in the last image above.
The e-mail form from the Web version displays thusly:
To further complicate the issue, we have a large help system where we can't get the script to run at all. It's as if RH doesn't acknowledge that these updates were made to the .htt and doesn't apply the master sheet changes to the topics. If I open a topic up in RH and manually set the topic's Master Sheet property to None then back to our .htt Master sheet, it updates and the one topic does work when using RH's previewer or when the chm is generated. I'd have to do this to over 2000 topics and then there's having to push all these changes up to our source control server when all I wanted to do is update a single .htt file. I know I can do this in one swoop (actually two swoops - one swoop to set it to None, the second swoop to set it back to the .htt we're using) within the Topic List pod, but why do I have to go through all this just to get a simply jQuery script to work?
We are planning on upgrading to the latest version of RH at some point this year - not sure if that will help but we're counting on it.
By all means, if you have a better solution I would be very appreciative of your insight.
Hi Steve (Steve and I are on the same team),
Regarding the preview Ctrl + W in RH not working, the problem isn't with jQuery. I don't know if it's anything to do with RH at all. From what I can tell, RH supports jQuery just fine though I haven't looked into the issue you mentioned about the larger help project.
The problem with the variables not showing up in the preview screen has to do with the use of string encoding via the escape function in the document.write statement:
document.write('<a href="#">Back to Top</a> | <a href="mailto:email@example.com' + '?subject=' + escape(mailSubject) + '&body=' + escape(mailBody) + '">' + mailDisplay + '</a>');
The escape function is used with string encoding. It's a deprecated function. Newer code should use encodeURI to encode strings and decodeURI to decode strings.
If you remove the escape function from the mailSubject and mailBody variables (or decode the strings), it works as shown here.
So, one question is, do we need to encode these strings? Maybe that's something the forum can help answer. I don't really know enough about encoding to know. We aren't sending them over the Internet per se, we're just providing a clickable link (the href with mailto attribute) that opens up the email client. Our users choose to click the Send button in their their email client's send to send the feedback once they type their feedback.
Info on encoding from w3schools: HTML URL Encoding Reference
Steve, as to why you have to reapply the .htt for jQuery to work in Core, is because the call to the jQuery is in the header section of the .htt, but the existing Core topics do not use a header, so only new topics will pick up the reference.
Once you reapply the .htt it inserts the header into those topics.
That said, you can just apply the jQuery .js call in the footer of the .htt for all cases since all our help projects use the footer. I tested it and it works.