From a97515ee0d86caa8cc17698769247781c0cb57ab Mon Sep 17 00:00:00 2001 From: Marcell Mars Date: Wed, 9 Sep 2020 03:04:23 +0200 Subject: [PATCH] desktop layout should work fine with the top bar breadcrumbs.. --- themes/sandpoints/assets/css/site.css | 2 +- themes/sandpoints/assets/js/sandpoints.js | 16 +++---- .../sandpoints/layouts/partials/header.html | 47 ++++++++++++------- 3 files changed, 40 insertions(+), 25 deletions(-) diff --git a/themes/sandpoints/assets/css/site.css b/themes/sandpoints/assets/css/site.css index 05194ec..d775a27 100644 --- a/themes/sandpoints/assets/css/site.css +++ b/themes/sandpoints/assets/css/site.css @@ -442,7 +442,7 @@ body { z-index: 10; } -.topicbar { +.mantlebar { display: none; } diff --git a/themes/sandpoints/assets/js/sandpoints.js b/themes/sandpoints/assets/js/sandpoints.js index b6d65f0..cceb68c 100644 --- a/themes/sandpoints/assets/js/sandpoints.js +++ b/themes/sandpoints/assets/js/sandpoints.js @@ -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'}) } diff --git a/themes/sandpoints/layouts/partials/header.html b/themes/sandpoints/layouts/partials/header.html index 37c62b0..501263a 100644 --- a/themes/sandpoints/layouts/partials/header.html +++ b/themes/sandpoints/layouts/partials/header.html @@ -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 -}} + +