Reverb - Open child page on folder click
Description
In a Reverb, when clicking an 'empty' TOC entry is there a way to show the first-available content in the iframe? Consider this hierarchy:
Group + Book +-+ Chapter 1 +--+ Heading 1
If you click on Group or Book, the iframe content does not change. Only when you click on Chapter 1 does the content update.
I would like to see the content go to the Chapter 1 content when I click on Group or Book.
Basically, I want the same behavior as WebWorks Help.
Possible solution (2013-02-08)
Changes for ePublisher 2012.4.
Add new function Connect.NavigationInvokeFirstChildLink() as below in connect.js.
Connect.NavigationInvokeFirstChildLink = function (param_entry_div) { var sibling_ul, first_li, first_div, first_a; // Trigger a click the first valid child link // sibling_ul = Browser.NextSiblingElementWithTagName(param_entry_div, 'ul'); if (sibling_ul !== null) { first_li = Browser.FirstChildElementWithTagName(sibling_ul, 'li'); if (first_li !== null) { first_div = Browser.FirstChildElementWithTagName(first_li, 'div'); if (first_div !== null) { if (Browser.ContainsClass(first_div.className, 'ww_skin_toc_folder')) { Connect.TOCFolder_Open(first_div); first_a = Browser.FirstChildElementWithTagName(first_div, 'a'); if (first_a !== null) { if (first_a.href !== '') { // Invoke standard link handler // first_a.onclick({}); } else { Connect.NavigationInvokeFirstChildLink(first_div); } } } } } } }
Patch existing function Connect.NavigationLink() as below in connect.js.
Connect.NavigationLink = function (param_event) { 'use strict'; var event, parent_div, result; // Access event // event = param_event || window.event; // Cancel event bubbling // event.cancelBubble = true; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; } // Expand if closed folder // parent_div = Browser.FindParentWithTagName(this, 'div'); if ((parent_div !== null) && (Browser.ContainsClass(parent_div.className, 'ww_skin_toc_folder'))) { // Need to find a link with an href? // if (this.href === '') { // Folder currently closed? // var sibling_ul; sibling_ul = Browser.NextSiblingElementWithTagName(parent_div, 'ul'); if (sibling_ul !== null) { if (Browser.ContainsClass(sibling_ul.className, 'ww_skin_toc_container_closed')) { // Trigger a click the first valid child link // Connect_Window.setTimeout(function () { Connect.NavigationInvokeFirstChildLink(parent_div); } ); } } } Connect.TOCFolder_Open(parent_div); } // Process event // result = Connect.HandleInterceptLink(this); if (result === false) { // Hide panel // if ((Connect.layout_wide) && (Connect.Panel.display_as_sidebar)) { // Keep the panel active! // Connect.toc_cleanup_folders = false; } } return result; };