]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/html/static/toc.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / html / static / toc.js
1 ;(function () {
2 var wrapper = document.getElementById("wrapper")
3 var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
4   .filter(function (el) {
5     return el.parentNode === wrapper
6         && el.tagName.match(/H[1-6]/)
7         && el.id
8   })
9 var l = 2
10   , toc = document.createElement("ul")
11 toc.innerHTML = els.map(function (el) {
12   var i = el.tagName.charAt(1)
13     , out = ""
14   while (i > l) {
15     out += "<ul>"
16     l ++
17   }
18   while (i < l) {
19     out += "</ul>"
20     l --
21   }
22   out += "<li><a href='#" + el.id + "'>" +
23     ( el.innerText || el.text || el.innerHTML)
24     + "</a>"
25   return out
26 }).join("\n")
27 toc.id = "toc"
28 document.body.appendChild(toc)
29 })();