diff --git a/resources/main.js b/resources/main.js index 6ed26b5..679b59d 100644 --- a/resources/main.js +++ b/resources/main.js @@ -71,36 +71,61 @@ $(function() { } else { $('#toc').each(function() { var $toc = $(this); - var $title = $toc.find('#toctitle'); - var $links = $title.siblings('ul'); + var $title = $toc.find('.toctitle'); + var $links = $title.siblings('ul').find( 'a' ); - $('.page-header').prepend(''); + $.each( $links.find( '.tocnumber' ), function() { + var $el = $( this ); + var numDots = ( $el.text().match( /\./g ) || [] ).length; + var prefix = ''; + for ( var i = 0; i < numDots; i++ ) { + prefix += '  '; + } - $('.page-header #page-contents').find('.dropdown-menu').html( $links.html() ); + $el.prepend( prefix ); + } ); + + $links.addClass( 'dropdown-item' ); + + var toc_html = [ + '' + ]; + + $('.page-header').prepend( toc_html.join( ' ' ) ); + + $('.page-header #page-contents').find('.dropdown-menu').html( $links ); }); if( $('.page-header .nav').length === 0 ) { - $('.page-header').prepend(''); + $('.page-header').prepend(''); }//end if var $header = $('.page-header'); - var $hero = $('.hero-unit'); + var $hero = $('.jumbotron'); var $edit = $('.navbar .content-actions .edit'); if( $edit.length > 0 ) { + var $editListItem = $( '