1// Populate the sidebar 2// 3// This is a script, and not included directly in the page, to control the total size of the book. 4// The TOC contains an entry for each page, so if each page includes a copy of the TOC, 5// the total size of the page becomes O(n**2). 6class MDBookSidebarScrollbox extends HTMLElement { 7 constructor() { 8 super(); 9 } 10 connectedCallback() { 11 this.innerHTML = '<ol class="chapter"><li class="chapter-item expanded affix "><a href="index.html">Introduction</a></li><li class="chapter-item expanded "><a href="Setup.html"><strong aria-hidden="true">1.</strong> Installing sbt runner</a></li><li class="chapter-item expanded "><a href="sbt-by-example.html"><strong aria-hidden="true">2.</strong> sbt by example</a></li><li class="chapter-item expanded "><a href="guide/index.html"><strong aria-hidden="true">3.</strong> Getting Started</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="guide/why-sbt-exists.html"><strong aria-hidden="true">3.1.</strong> Why sbt exists</a></li><li class="chapter-item expanded "><a href="guide/sbt-new.html"><strong aria-hidden="true">3.2.</strong> Creating a new build</a></li><li class="chapter-item expanded "><a href="guide/sbt-components.html"><strong aria-hidden="true">3.3.</strong> sbt components</a></li><li class="chapter-item expanded "><a href="guide/basic-tasks.html"><strong aria-hidden="true">3.4.</strong> Basic tasks</a></li><li class="chapter-item expanded "><a href="guide/build-definition-basics.html"><strong aria-hidden="true">3.5.</strong> Build definition basics</a></li><li class="chapter-item expanded "><a href="guide/library-dependency-basics.html"><strong aria-hidden="true">3.6.</strong> Library dependency basics</a></li><li class="chapter-item expanded "><a href="guide/multi-project-basics.html"><strong aria-hidden="true">3.7.</strong> Multi project basics</a></li><li class="chapter-item expanded "><a href="guide/plugin-basics.html"><strong aria-hidden="true">3.8.</strong> Plugin basics</a></li><li class="chapter-item expanded "><a href="guide/build-layout.html"><strong aria-hidden="true">3.9.</strong> Build layout</a></li><li class="chapter-item expanded "><a href="guide/IDE.html"><strong aria-hidden="true">3.10.</strong> sbt with IDEs</a></li></ol></li><li class="chapter-item expanded "><a href="changes/index.html"><strong aria-hidden="true">4.</strong> Changes</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="changes/sbt-2.0-change-summary.html"><strong aria-hidden="true">4.1.</strong> sbt 2.0 changes</a></li><li class="chapter-item expanded "><a href="changes/migrating-from-sbt-1.x.html"><strong aria-hidden="true">4.2.</strong> Migrating from sbt 1.x</a></li></ol></li><li class="chapter-item expanded "><a href="concepts/index.html"><strong aria-hidden="true">5.</strong> Concepts</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="concepts/command-basics.html"><strong aria-hidden="true">5.1.</strong> Command basics</a></li><li class="chapter-item expanded "><a href="concepts/cross-building.html"><strong aria-hidden="true">5.2.</strong> Cross building</a></li><li class="chapter-item expanded "><a href="concepts/sbt-query.html"><strong aria-hidden="true">5.3.</strong> sbt query</a></li><li class="chapter-item expanded "><a href="concepts/caching.html"><strong aria-hidden="true">5.4.</strong> Caching</a></li></ol></li><li class="chapter-item expanded "><a href="reference/index.html"><strong aria-hidden="true">6.</strong> Reference</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="reference/sbt.html"><strong aria-hidden="true">6.1.</strong> sbt</a></li><li class="chapter-item expanded "><a href="reference/sbt-update.html"><strong aria-hidden="true">6.2.</strong> sbt update</a></li><li class="chapter-item expanded "><a href="reference/sbt-dependency-tree.html"><strong aria-hidden="true">6.3.</strong> sbt dependencyTree</a></li><li class="chapter-item expanded "><a href="reference/sbt-compile.html"><strong aria-hidden="true">6.4.</strong> sbt compile</a></li><li class="chapter-item expanded "><a href="reference/sbt-run.html"><strong aria-hidden="true">6.5.</strong> sbt run</a></li><li class="chapter-item expanded "><a href="reference/sbt-test.html"><strong aria-hidden="true">6.6.</strong> sbt test</a></li><li class="chapter-item expanded "><a href="reference/sbt-inspect.html"><strong aria-hidden="true">6.7.</strong> sbt inspect</a></li><li class="chapter-item expanded "><a href="reference/sbt-publish.html"><strong aria-hidden="true">6.8.</strong> sbt publish</a></li><li class="chapter-item expanded "><a href="reference/watch.html"><strong aria-hidden="true">6.9.</strong> Watch command</a></li><li class="chapter-item expanded "><a href="reference/task.html"><strong aria-hidden="true">6.10.</strong> Task</a></li><li class="chapter-item expanded "><a href="reference/cached-task.html"><strong aria-hidden="true">6.11.</strong> Cached task</a></li><li class="chapter-item expanded "><a href="reference/cross-building-setup.html"><strong aria-hidden="true">6.12.</strong> Cross building setup</a></li><li class="chapter-item expanded "><a href="reference/remote-cache-setup.html"><strong aria-hidden="true">6.13.</strong> Remote cache setup</a></li><li class="chapter-item expanded "><a href="reference/artifact.html"><strong aria-hidden="true">6.14.</strong> Artifact</a></li><li class="chapter-item expanded "><a href="reference/input-task.html"><strong aria-hidden="true">6.15.</strong> Input task</a></li><li class="chapter-item expanded "><a href="reference/tab-completion-parser.html"><strong aria-hidden="true">6.16.</strong> Tab-completion parser</a></li><li class="chapter-item expanded "><a href="reference/command.html"><strong aria-hidden="true">6.17.</strong> Command</a></li><li class="chapter-item expanded "><a href="reference/plugin.html"><strong aria-hidden="true">6.18.</strong> Plugin</a></li></ol></li><li class="chapter-item expanded "><a href="community-plugins.html"><strong aria-hidden="true">7.</strong> Community plugins</a></li><li class="chapter-item expanded "><a href="recipes/index.html"><strong aria-hidden="true">8.</strong> Recipes</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="recipes/hello-world.html"><strong aria-hidden="true">8.1.</strong> Write hello world</a></li><li class="chapter-item expanded "><a href="recipes/central.html"><strong aria-hidden="true">8.2.</strong> Publishing to the Central Repo</a></li><li class="chapter-item expanded "><a href="recipes/use-sbt-as-metals-build-server.html"><strong aria-hidden="true">8.3.</strong> Use sbt as Metals build server</a></li><li class="chapter-item expanded "><a href="recipes/import-to-intellij.html"><strong aria-hidden="true">8.4.</strong> Import to IntelliJ IDEA</a></li><li class="chapter-item expanded "><a href="recipes/github-actions-setup.html"><strong aria-hidden="true">8.5.</strong> GitHub Actions setup</a></li><li class="chapter-item expanded "><a href="recipes/source-dependency-plugin.html"><strong aria-hidden="true">8.6.</strong> Source dependency plugin</a></li><li class="chapter-item expanded "><a href="recipes/virtual-axis.html"><strong aria-hidden="true">8.7.</strong> Cross building on a virtual axis</a></li><li class="chapter-item expanded "><a href="recipes/console-interaction.html"><strong aria-hidden="true">8.8.</strong> Getting user inputs</a></li><li class="chapter-item expanded "><a href="recipes/performance-profiling.html"><strong aria-hidden="true">8.9.</strong> Performance profiling</a></li><li class="chapter-item expanded "><a href="recipes/plugin-isolation.html"><strong aria-hidden="true">
118.10.</strong> Isolate plugin classpath</a></li></ol></li><li class="chapter-item expanded "><a href="appendix/glossary.html"><strong aria-hidden="true">9.</strong> Appendix: Glossary</a></li><li class="chapter-item expanded "><a href="appendix/setup-notes.html"><strong aria-hidden="true">10.</strong> Appendix: Setup notes</a></li></ol>'; 12 // Set the current, active page, and reveal it if it's hidden 13 let current_page = document.location.href.toString().split("#")[0].split("?")[0]; 14 if (current_page.endsWith("/")) { 15 current_page += "index.html"; 16 } 17 var links = Array.prototype.slice.call(this.querySelectorAll("a")); 18 var l = links.length; 19 for (var i = 0; i < l; ++i) { 20 var link = links[i]; 21 var href = link.getAttribute("href"); 22 if (href && !href.startsWith("#") && !/^(?:[a-z+]+:)?\/\//.test(href)) { 23 link.href = path_to_root + href; 24 } 25 // The "index" page is supposed to alias the first chapter in the book. 26 if (link.href === current_page || (i === 0 && path_to_root === "" && current_page.endsWith("/index.html"))) { 27 link.classList.add("active"); 28 var parent = link.parentElement; 29 if (parent && parent.classList.contains("chapter-item")) { 30 parent.classList.add("expanded"); 31 } 32 while (parent) { 33 if (parent.tagName === "LI" && parent.previousElementSibling) { 34 if (parent.previousElementSibling.classList.contains("chapter-item")) { 35 parent.previousElementSibling.classList.add("expanded"); 36 } 37 } 38 parent = parent.parentElement; 39 } 40 } 41 } 42 // Track and set sidebar scroll position 43 this.addEventListener('click', function(e) { 44 if (e.target.tagName === 'A') { 45 sessionStorage.setItem('sidebar-scroll', this.scrollTop); 46 } 47 }, { passive: true }); 48 var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll'); 49 sessionStorage.removeItem('sidebar-scroll'); 50 if (sidebarScrollTop) { 51 // preserve sidebar scroll position when navigating via links within sidebar 52 this.scrollTop = sidebarScrollTop; 53 } else { 54 // scroll sidebar to current active section when navigating via "next/previous chapter" buttons 55 var activeSection = document.querySelector('#sidebar .active'); 56 if (activeSection) { 57 activeSection.scrollIntoView({ block: 'center' }); 58 } 59 } 60 // Toggle buttons 61 var sidebarAnchorToggles = document.querySelectorAll('#sidebar a.toggle'); 62 function toggleSection(ev) { 63 ev.currentTarget.parentElement.classList.toggle('expanded'); 64 } 65 Array.from(sidebarAnchorToggles).forEach(function (el) { 66 el.addEventListener('click', toggleSection); 67 }); 68 } 69} 70window.customElements.define("mdbook-sidebar-scrollbox", MDBookSidebarScrollbox);
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.