Webhelp classic auto open first result on right pane
Post here questions and problems related to editing and publishing DITA content.
Webhelp classic auto open first result on right pane
Hi, I have a requirement to output Webhelp that allows the opening of the first result in the right pane of Webhelp classic.
For instance, we have an application that will invoke Webhelp with the searchQuery parameter ie /webhelp/index.html?searchQuery=print. We want the first result found in the searchresults to be displayed in the right pane.
I thought I could use webhelp.head.script and supply some jquery to do this. However, the search results don't seem to be loaded until after my code has already run. That even if I use the jquery $( document ).ready function. I've also tried attaching my code to webhelp.body.script
My code is very simple. I get the link associated with the first result, and then use it to change the iframe (#frm) on the right.
I don't see any other hooks that I could use to do this? Any suggestions?
For instance, we have an application that will invoke Webhelp with the searchQuery parameter ie /webhelp/index.html?searchQuery=print. We want the first result found in the searchresults to be displayed in the right pane.
I thought I could use webhelp.head.script and supply some jquery to do this. However, the search results don't seem to be loaded until after my code has already run. That even if I use the jquery $( document ).ready function. I've also tried attaching my code to webhelp.body.script
My code is very simple. I get the link associated with the first result, and then use it to change the iframe (#frm) on the right.
Code: Select all
$( document ).ready(function() {
s = $('#foundLink0');
href = $(s).attr('href')
var $iframe = $('#frm');
$iframe.attr('src', href );
})
-
- Posts: 222
- Joined: Tue Jul 01, 2014 11:48 am
Re: Webhelp classic auto open first result on right pane
Post by bogdan_cercelaru »
Hello,
Instead of getting the @href value of the first link and then use it to change the iframe on the right, you could try to get the first link and then trigger a click event as it would be clicked by the user. I've tested using the webhelp.body.script parameter and the following code and it works:
Regards,
Bogdan
Instead of getting the @href value of the first link and then use it to change the iframe on the right, you could try to get the first link and then trigger a click event as it would be clicked by the user. I've tested using the webhelp.body.script parameter and the following code and it works:
Code: Select all
$(document).ready(function () {
$("#searchResults").on("DOMSubtreeModified", function () {
try {
var s = $('#foundLink0');
s.click();
} catch (e) {
}
})
})
Bogdan
Bogdan Cercelaru
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service