Make sidebar toggle elements configurable

Current options are h1, h1 and h2, h1-h5, top-level list items

SPR-754
This commit is contained in:
Michael Große 2017-04-12 13:35:33 +02:00
commit cb7cc643bf
No known key found for this signature in database
GPG key ID: 7E31028FBFEACC79
7 changed files with 31 additions and 30 deletions

View file

@ -57,7 +57,7 @@ jQuery(function () {
var $main = $nav.find('nav.nav-main');
if (!$main.length) return;
var ELEMENT = 'h1,h2,h3,h4,h5'; // FIXME move to config
var ELEMENT = JSINFO.template.sprintdoc.sidebar_toggle_elements;
var $elements = $main.find(ELEMENT);
$elements.each(function () {
var $me = jQuery(this),
@ -98,6 +98,10 @@ jQuery(function () {
// replace element with toggler
$me.replaceWith($toggler);
if ($toggler.parent('li').length) {
$toggler.parent('li').addClass('toggler');
}
});
},