Last active
May 19, 2016 09:44
-
-
Save timaschew/5947188 to your computer and use it in GitHub Desktop.
expand children pages in pagetree for current page. Put this into the textarea of: Confluence Admin -> LOOK AND FEEL -> Custom HTML -> At end of the HEAD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Original snippet is from | |
http://www.communardo.de/home/techblog/2011/05/02/improve-the-confluence-pagetree-macro-functionality/ | |
--> | |
<script type="text/javascript" > | |
AJS.toInit(function ($) { | |
//first save the original pagetree function "origHideEmptyChildrenContainer" | |
var origHideEmptyChildrenContainer = AJS.pagetree.hideEmptyChildrenContainers; | |
//define our own one and overwrite the original pagetree function "hideEmptyChildrenContainers" | |
//this function is called by the pagetree after children loading | |
AJS.pagetree.hideEmptyChildrenContainers = function(pagetreeChildrenDiv) { | |
//search for the child element with the style attribute | |
pagetreeChildrenDiv.find('span.plugin_pagetree_children_span').each(function(index, item){ | |
//click on the plus icon to expand the children of the current page | |
// confluence 4.x | |
//jQuery(this).parent().parent().find('.plugin_pagetree_childtoggle_container a.icon-plus').trigger('click'); | |
// confluence 5.x | |
var elem = jQuery(item); | |
// do not toggle the parent of a childs, if child the current page | |
if (elem.parent().next().find('.plugin_pagetree_children_span.plugin_pagetree_current').length === 0) { | |
jQuery(this).parent().parent().find('.plugin_pagetree_childtoggle_container a.plugin_pagetree_childtoggle').trigger('click'); | |
} | |
}); | |
//call the saved original function... | |
origHideEmptyChildrenContainer(pagetreeChildrenDiv); | |
}; | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I created an updated version that works with Confluence 5.5.6.