Commit 6d799c1d authored by Jonas's avatar Jonas

FS#135 - hide link in TOC

parent f6b895e3
......@@ -15,7 +15,7 @@ function togglewrap(checkbox, duration) {
} else if (this.value == 'not_'+value) {
jQuery(this).prop('checked',false);
}
} );
} );
} else {
jQuery('.wrap_'+value).hide(duration);
jQuery('.wrap_not_'+value).show(duration);
......@@ -25,10 +25,41 @@ function togglewrap(checkbox, duration) {
} else if (this.value == 'not_'+value) {
jQuery(this).prop('checked',true);
}
} );
} );
}
}
function togglewrapUpdateTOC(duration) {
var titleHidden = new Array();
jQuery('input.togglewrap').each(function() {
if ( (this.value.substr(0,4) == 'not_') && (!this.checked)) {
value = this.value.substr(4);
reverse = true;
} else {
value = this.value;
reverse = false;
}
$wrap = jQuery('.wrap_'+value);
$wrap_not = jQuery('.wrap_not_'+value);
if ((this.checked && !reverse) || (!this.checked && reverse) ) {
$wrap_not.find("h1, h2, h3, h4, h5, h6").each(function() { titleHidden.push(this.id); } );
} else {
$wrap.find("h1, h2, h3, h4, h5, h6").each(function() { titleHidden.push(this.id); } );
}
} );
jQuery("#dw__toc li a").each(function() {
$this = jQuery(this);
if (jQuery.inArray($this.attr('href').substr(1), titleHidden) != -1) {
$this.parent().parent().hide(duration);
} else {
$this.parent().parent().show(duration);
}
} );
}
jQuery(function() {
jQuery("input.togglewrap").each(function() { togglewrap (this, 0); } );
jQuery("input.togglewrap").change(function() { togglewrap (this, 400) });
togglewrapUpdateTOC(0);
jQuery("input.togglewrap").change(function() { togglewrap (this, 400); togglewrapUpdateTOC(400)});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment