mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
23 lines
533 B
JavaScript
23 lines
533 B
JavaScript
window.onload = function() {
|
|
var container = document.querySelector('#toc');
|
|
|
|
var selector = "h2";
|
|
if (container.className.split(" ").indexOf("coarse") == -1) {
|
|
selector += ",h3";
|
|
}
|
|
|
|
var toc = initTOC({
|
|
selector: selector,
|
|
scope: '.post',
|
|
overwrite: false,
|
|
prefix: 'toc'
|
|
});
|
|
|
|
var heading = document.createElement("H2");
|
|
var heading_text = document.createTextNode("Table of Contents");
|
|
heading.appendChild(heading_text);
|
|
|
|
container.appendChild(heading);
|
|
container.appendChild(toc);
|
|
}
|