desktop layout should work fine with the top bar breadcrumbs..

This commit is contained in:
Marcell Mars 2020-09-09 03:04:23 +02:00
parent d9e2e81632
commit a97515ee0d
3 changed files with 40 additions and 25 deletions

View File

@ -442,7 +442,7 @@ body {
z-index: 10;
}
.topicbar {
.mantlebar {
display: none;
}

View File

@ -1,20 +1,20 @@
window.addEventListener('scroll', function(e) {
if (document.querySelector('body').clientWidth > 1024) {
let rightcolumn = document.querySelector('.rightcolumn');
let topicstitle = document.querySelector('.topicstitle')
let topicbar = document.querySelector('.topicbar')
let mantletitle = document.querySelector('.mantletitle') || document.querySelector('.crusttitle');
let mantlebar = document.querySelector('.mantlebar')
let grid = document.querySelector('.grid')
let gridrect = topicstitle.getBoundingClientRect();
let gridrect = mantletitle.getBoundingClientRect();
if (gridrect.top < 20 && !grid.classList.contains('moved')) {
grid.classList.add('moved');
topicbar.style.display = "inline";
topicstitle.style.visibility = "hidden";
mantlebar.style.display = "inline";
mantletitle.style.visibility = "hidden";
grid.style.display = "none";
window.scrollBy({top: grid.clientHeight + topicstitle.clientHeight, behavior: 'smooth'})
window.scrollBy({top: grid.clientHeight + mantletitle.clientHeight, behavior: 'smooth'})
} else if (gridrect.top > 21 && grid.classList.contains('moved')) {
grid.classList.remove('moved');
topicstitle.style.visibility = "visible";
topicbar.style.display = "none";
mantletitle.style.visibility = "visible";
mantlebar.style.display = "none";
grid.style.display = "grid";
window.scroll({top: 0, behavior: 'smooth'})
}

View File

@ -1,30 +1,45 @@
{{ $currentSession := . }}
{{ $_ := newScratch }}
{{- range $k, $v := .Page.Site.Data.sandpointsnamegraph -}}
{{ if eq $currentSession.File.Dir (printf "%s/" $k) }}
{{ $_.Add "depth" (index $v "depth") }}
{{ if eq (index $v "depth") "mantle" }}
{{ $_.Add "home" (index $v "in" 0) }}
{{ end }}
{{ if eq (index $v "depth") "crust" }}
{{ $_.Add "home" (index (index $currentSession.Site.Data.sandpointsnamegraph (index $v "in" 0)) "in" 0) }}
{{ $_.Add "mantle" (index $v "in" 0) }}
{{ $_.Add "mantle_has" (index (index $currentSession.Site.Data.sandpointsnamegraph (index $v "in" 0)) "has" 1) }}
{{ end }}
{{ end }}
{{- end -}}
<div class="header">
<a title="{{ $.Site.Home.Title }}'s Bibliotheke" href="/library/BROWSE_LIBRARY.html" class="bibliotheke" target="_blank">
<img src="/images/bibliotheke.svg" />
</a>
<div class="breadcrumbs">
{{ if not .IsHome }}
<a href="{{ with $.GetPage $.Site.Params.home }}{{ .RelPermalink }}{{ end }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"><span class="sup">{{ substr $.Site.Home.Title 0 1 }}</span><i>{{ substr $.Site.Home.Title 1 }}</i></a>
{{ if ne ($_.Get "depth") "core" }}
<a href="{{ with $currentSession.Site.GetPage (printf "/%s/index.md" ($_.Get "home")) }}{{ .RelPermalink }}{{ end }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}"><span class="sup">{{ with $currentSession.Site.GetPage (printf "/%s/index.md" ($_.Get "home")) }}{{ substr .Title 0 1 }}</span><i>{{ substr .Title 1 }}</i></a>{{ end }}
{{ end }}
{{ if eq .File.Dir "topic/" }}
<div class="topicbar"><i> » <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a></i></div>
{{ if eq ($_.Get "depth") "mantle" }}
<span class="mantlebar"><i> » <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a></i></span>
{{ end }}
{{ $.Scratch.Set "counter" 0 }}
{{ range where $.Site.RegularPages ".Section" "topic" }}
{{ if in .Params.has_sessions $currentSession.File.LogicalName }}
{{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
{{ if lt ($.Scratch.Get "counter") 2 }}
<span><i> » <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a></i></span>
{{ end }}
{{ if eq ($_.Get "depth") "crust" }}
{{ $.Scratch.Set "counter" 0 }}
{{ range where $.Site.RegularPages ".Section" ($_.Get "mantle") }}
{{ if in (index .Params (printf "has_%s" ($_.Get "mantle_has"))) $currentSession.File.LogicalName }}
{{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
{{ if lt ($.Scratch.Get "counter") 2 }}
<span><i> » <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a></i></span>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ if eq .File.Dir "session/" }}
<span class="topicbar"><i> » <a href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ .Title }}</a></i></span>
{{ end }}
<span class="mantlebar"><i> » <a href="{{ $currentSession.RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">{{ $currentSession.Title }}</a></i></span>
{{ end }}
</div>
</div>