Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
727 B

  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. var toc = document.createElement('ul')
  11. toc.innerHTML = els.map(function (el) {
  12. var i = el.tagName.charAt(1)
  13. var 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. })()