github.com/gocrane/crane@v0.11.0/docs/assets/util.js (about)

     1  setTimeout(function () {
     2    const requestAnimationFrame = window.requestAnimationFrame;
     3    const requestIdleCallback = window.requestIdleCallback;
     4    requestIdleCallback(()=> {
     5      requestAnimationFrame(()=> {
     6        // Remove # when use markdown annotations
     7        const mdAnnotations = document.querySelectorAll(".md-annotation")
     8        for (let i = 0; i < mdAnnotations.length; i++) {
     9          let tmp = mdAnnotations[i]
    10          let parentChinldNodes = tmp.parentElement.childNodes
    11          if (parentChinldNodes[0].data === '#'){
    12            parentChinldNodes[0].remove()
    13          }
    14        }
    15  
    16        // Handle tab label click
    17        const labels = document.querySelectorAll("div.tabbed-labels > label")
    18        for (let i = 0; i < labels.length; i++) {
    19          let tmp = labels[i]
    20          tmp.onclick = () => {
    21            for (const label of labels) {
    22              if (label.textContent === tmp.textContent) {
    23                label.click()
    24              }
    25            }
    26          }
    27        }
    28      })
    29    })
    30  },1)