diff --git a/source/Ox.UI/js/Code/DocPage.js b/source/Ox.UI/js/Code/DocPage.js index 15f286eb..020f2689 100644 --- a/source/Ox.UI/js/Code/DocPage.js +++ b/source/Ox.UI/js/Code/DocPage.js @@ -2,13 +2,14 @@ /*@ Ox.DocPage DocPage - ([options[, self]]) -> DocPage object - example example options Options object item doc item replace <[[]]|[]> See Ox.SyntaxHighlighter stripComments If true, strip comments in source code self Shared private variable + ([options[, self]]) -> DocPage object + example Fires when an example was selected + id Id of the selected example @*/ Ox.DocPage = function(options, self) { @@ -119,7 +120,8 @@ Ox.DocPage = function(options, self) { } }); sections.forEach(function(section) { - var className = 'OxLine' + Ox.uid(); + var className = 'OxLine' + Ox.uid(), + isExpanded = !Ox.contains(section, 'inherited'); if (item[section]) { if (section == 'description') { $elements.push($('
') @@ -141,7 +143,11 @@ Ox.DocPage = function(options, self) { }) .append( $('') - .attr({src: Ox.UI.getImageURL('symbolDown')}) + .attr({ + src: isExpanded + ? Ox.UI.getImageURL('symbolDown') + : Ox.UI.getImageURL('symbolRight') + }) .css({ width: '12px', height: '12px', @@ -149,28 +155,25 @@ Ox.DocPage = function(options, self) { }) .click(function() { var $this = $(this), - isExpanded = $this.attr('src') == Ox.UI.getImageURL('symbolDown'); + isExpanded = $this.attr('src') == Ox.UI.getImageURL('symbolRight'); $this.attr({ - src: isExpanded ? - Ox.UI.getImageURL('symbolRight') : - Ox.UI.getImageURL('symbolDown') + src: isExpanded + ? Ox.UI.getImageURL('symbolDown') + : Ox.UI.getImageURL('symbolRight') }); $('.' + className).each(function() { - var $this = $(this); - $this[isExpanded ? 'addClass' : 'removeClass'](className + 'Hidden'); + var $this = $(this), isHidden = false; + $this[isExpanded ? 'removeClass' : 'addClass'](className + 'Hidden'); if (isExpanded) { - $this.hide(); - } else { - var hidden = false; Ox.forEach(this.className.split(' '), function(v) { if (/Hidden$/.test(v)) { - hidden = true; + isHidden = true; Ox.Break(); } }); - if (!hidden) { - $this.show() - } + !isHidden && $this.show(); + } else { + $this.hide(); } }); }) @@ -262,7 +265,11 @@ Ox.DocPage = function(options, self) { + (v.name || '') : null; $elements = $elements.concat( Ox.map(getItem(v, level + 1, name), function($element) { - return $element.addClass(className); + $element.addClass(className); + if (!isExpanded) { + $element.addClass(className + 'Hidden').hide(); + } + return $element; }) ); });