Don't do anything if there's no #toc

This commit is contained in:
Philipp Oppermann
2016-07-28 19:49:59 +02:00
parent 226c0ccdfc
commit 46bb485621

View File

@@ -1,6 +1,7 @@
window.onload = function() {
var container = document.querySelector('#toc');
if (container != null) {
var toc = initTOC({
selector: 'h2, h3',
scope: '.post',
@@ -15,3 +16,4 @@ window.onload = function() {
container.appendChild(heading);
container.appendChild(toc);
}
}