feat: expand the current file in the navbar
parent
34185d4fef
commit
924be4c7d8
|
@ -42,6 +42,7 @@ def htmlOutputSetup (config : SiteBaseContext) : IO Unit := do
|
||||||
("declaration-data.js", declarationDataCenterJs),
|
("declaration-data.js", declarationDataCenterJs),
|
||||||
("color-scheme.js", colorSchemeJs),
|
("color-scheme.js", colorSchemeJs),
|
||||||
("nav.js", navJs),
|
("nav.js", navJs),
|
||||||
|
("expand-nav.js", expandNavJs),
|
||||||
("how-about.js", howAboutJs),
|
("how-about.js", howAboutJs),
|
||||||
("search.html", searchHtml),
|
("search.html", searchHtml),
|
||||||
("search.js", searchJs),
|
("search.js", searchJs),
|
||||||
|
|
|
@ -150,6 +150,7 @@ are used in documentation generation, notably JS and CSS ones.
|
||||||
def declarationDataCenterJs : String := include_str "../../static/declaration-data.js"
|
def declarationDataCenterJs : String := include_str "../../static/declaration-data.js"
|
||||||
def colorSchemeJs : String := include_str "../../static/color-scheme.js"
|
def colorSchemeJs : String := include_str "../../static/color-scheme.js"
|
||||||
def navJs : String := include_str "../../static/nav.js"
|
def navJs : String := include_str "../../static/nav.js"
|
||||||
|
def expandNavJs : String := include_str "../../static/expand-nav.js"
|
||||||
def howAboutJs : String := include_str "../../static/how-about.js"
|
def howAboutJs : String := include_str "../../static/how-about.js"
|
||||||
def searchJs : String := include_str "../../static/search.js"
|
def searchJs : String := include_str "../../static/search.js"
|
||||||
def instancesJs : String := include_str "../../static/instances.js"
|
def instancesJs : String := include_str "../../static/instances.js"
|
||||||
|
|
|
@ -33,6 +33,7 @@ def baseHtmlGenerator (title : String) (site : Array Html) : BaseHtmlM Html := d
|
||||||
<script>{s!"const SITE_ROOT={String.quote (← getRoot)};"}</script>
|
<script>{s!"const SITE_ROOT={String.quote (← getRoot)};"}</script>
|
||||||
[moduleConstant]
|
[moduleConstant]
|
||||||
<script type="module" src={s!"{← getRoot}search.js"}></script>
|
<script type="module" src={s!"{← getRoot}search.js"}></script>
|
||||||
|
<script type="module" src={s!"{← getRoot}expand-nav.js"}></script>
|
||||||
<script type="module" src={s!"{← getRoot}how-about.js"}></script>
|
<script type="module" src={s!"{← getRoot}how-about.js"}></script>
|
||||||
<script type="module" src={s!"{← getRoot}instances.js"}></script>
|
<script type="module" src={s!"{← getRoot}instances.js"}></script>
|
||||||
<script type="module" src={s!"{← getRoot}importedBy.js"}></script>
|
<script type="module" src={s!"{← getRoot}importedBy.js"}></script>
|
||||||
|
|
|
@ -95,6 +95,7 @@ def baseDirBlackList : HashSet String :=
|
||||||
"mathjax-config.js",
|
"mathjax-config.js",
|
||||||
"navbar.html",
|
"navbar.html",
|
||||||
"nav.js",
|
"nav.js",
|
||||||
|
"expand-nav.js",
|
||||||
"search.js",
|
"search.js",
|
||||||
"src",
|
"src",
|
||||||
"style.css"
|
"style.css"
|
||||||
|
|
|
@ -72,6 +72,7 @@ library_facet docs (lib) : FilePath := do
|
||||||
basePath / "declaration-data.js",
|
basePath / "declaration-data.js",
|
||||||
basePath / "color-scheme.js",
|
basePath / "color-scheme.js",
|
||||||
basePath / "nav.js",
|
basePath / "nav.js",
|
||||||
|
basePath / "expand-nav.js",
|
||||||
basePath / "how-about.js",
|
basePath / "how-about.js",
|
||||||
basePath / "search.js",
|
basePath / "search.js",
|
||||||
basePath / "mathjax-config.js",
|
basePath / "mathjax-config.js",
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
document.querySelector('.navframe').addEventListener('load', function() {
|
||||||
|
// Get the current page URL without the suffix after #
|
||||||
|
var currentPageURL = window.location.href.split('#')[0];
|
||||||
|
|
||||||
|
// Get all detail elements
|
||||||
|
var as = document.querySelector('.navframe').contentWindow.document.body.querySelectorAll('a');
|
||||||
|
for (const a of as) {
|
||||||
|
if (a.href) {
|
||||||
|
var href = a.href.split('#')[0];
|
||||||
|
if (href === currentPageURL) {
|
||||||
|
a.style.fontStyle = 'italic';
|
||||||
|
var el = a.parentNode.closest('details');
|
||||||
|
while (el) {
|
||||||
|
el.open = true;
|
||||||
|
el = el.parentNode.closest('details');
|
||||||
|
}}}}
|
||||||
|
});
|
Loading…
Reference in New Issue