mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Don't do anything if there's no #toc
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
var container = document.querySelector('#toc');
|
var container = document.querySelector('#toc');
|
||||||
|
|
||||||
|
if (container != null) {
|
||||||
var toc = initTOC({
|
var toc = initTOC({
|
||||||
selector: 'h2, h3',
|
selector: 'h2, h3',
|
||||||
scope: '.post',
|
scope: '.post',
|
||||||
@@ -14,4 +15,5 @@ window.onload = function() {
|
|||||||
|
|
||||||
container.appendChild(heading);
|
container.appendChild(heading);
|
||||||
container.appendChild(toc);
|
container.appendChild(toc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user