1// Simplify the sidebar TOC on the releases page 2window.addEventListener('DOMContentLoaded', function () { 3 if (window.location.pathname.endsWith("releases.html")) { 4 [].forEach.call(document.querySelectorAll('.toc-h3'), function (el) { 5 el.parentElement.remove() 6 }); 7 } 8}) 9 10// Route anchors from the former module-sized model reference pages to the 11// corresponding one-class-per-page reference. URL fragments are not sent to 12// the server, so this compatibility behavior has to run in the browser. 13window.addEventListener('DOMContentLoaded', function () { 14 const marker = "/docs/reference/models/" 15 const markerIndex = window.location.pathname.indexOf(marker) 16 17 if (markerIndex == -1) { 18 return 19 } 20 21 const hash = window.location.hash 22 const match = hash.match(/^#bokeh\.models(?:\.[a-z_][a-z0-9_]*)*\.([A-Z][A-Za-z0-9_]*)(\..*)?$/) 23 const redirect = document.querySelector("[data-bokeh-model-redirect]") 24 const modelsRoot = window.location.pathname.slice(0, markerIndex + marker.length) 25 const relativePath = window.location.pathname.slice(modelsRoot.length) 26 const classPage = relativePath.match(/^(?:[a-z_][a-z0-9_]*\/)+[A-Z][A-Za-z0-9_]*\/(?:index\.html)?$/) 27 28 if (classPage == null && (redirect != null || match != null)) { 29 const className = redirect?.dataset.bokehModelRedirect ?? match[1] 30 const documentPath = relativePath.replace(/\.html$/, "") 31 const categoryPath = redirect == null ? documentPath : documentPath.replace(/\/[^/]+$/, "") 32 window.location.replace(modelsRoot + categoryPath + "/" + className + "/" + window.location.search + hash) 33 return 34 } 35 36 // Older links sometimes used the implementation module in the object ID. 37 // Model pages use the stable top-level bokeh.models namespace instead. 38 if (match != null && document.getElementById(hash.slice(1)) == null) { 39 const normalizedHash = "#bokeh.models." + match[1] + (match[2] ?? "") 40 const target = document.getElementById(normalizedHash.slice(1)) 41 if (target != null) { 42 window.history.replaceState(null, "", normalizedHash) 43 target.scrollIntoView() 44 } 45 } 46})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.