mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-30 11:13:06 +00:00
2e364fdb2b
complete rewrite of logic
108 lines
5.8 KiB
HTML
108 lines
5.8 KiB
HTML
{{ if .Params.chapter }}
|
|
</div> <!-- end chapter-->
|
|
{{ end }}
|
|
</div>
|
|
{{ partial "custom-comments.html" . }}
|
|
</div>
|
|
|
|
<div id="navigation">
|
|
<!-- Next prev page -->
|
|
{{ $currentNode := . }}
|
|
|
|
{{ $currentNode.Scratch.Set "selfFound" nil }}
|
|
{{ $currentNode.Scratch.Set "prevPage" nil }}
|
|
{{ $currentNode.Scratch.Set "nextPage" nil }}
|
|
{{ template "menu-nextprev" dict "menu" .Site.Home "currentnode" $currentNode "hidden" false }}
|
|
|
|
{{ define "menu-nextprev" }}
|
|
{{ $currentNode := .currentnode }}
|
|
{{ $isSelf := eq $currentNode.RelPermalink .menu.RelPermalink }}
|
|
{{ $isDescendant := and (not $isSelf) (.menu.IsDescendant $currentNode) }}
|
|
{{ $isAncestor := and (not $isSelf) (.menu.IsAncestor $currentNode) }}
|
|
{{ $isOther := and (not $isDescendant) (not $isSelf) (not $isAncestor) }}
|
|
|
|
{{ if $isSelf }}
|
|
{{ $currentNode.Scratch.Set "selfFound" true }}
|
|
{{end}}
|
|
{{ $isSelfFound := eq ($currentNode.Scratch.Get "selfFound") true }}
|
|
{{ $isPreSelf := and (not $isSelfFound) (not $isSelf) }}
|
|
{{ $isPostSelf := and ($isSelfFound) (not $isSelf) }}
|
|
|
|
{{ $page_hidden := or (.menu.Params.hidden) (eq .menu.Title "") }}
|
|
{{ $hidden := or (and $page_hidden (not $isAncestor) (not $isSelf) ) (and .hidden (or $isPreSelf $isPostSelf $isDescendant) ) }}
|
|
|
|
{{ if not $hidden }}
|
|
{{if and $isPreSelf (or $isOther $isAncestor ) }}
|
|
{{ $currentNode.Scratch.Set "prevPage" .menu }}
|
|
{{else if and $isPostSelf (or $isOther $isDescendant) (eq ($currentNode.Scratch.Get "nextPage") nil) }}
|
|
{{ $currentNode.Scratch.Set "nextPage" .menu }}
|
|
{{end}}
|
|
{{ end }}
|
|
|
|
{{ $currentNode.Scratch.Set "pages" .menu.Pages }}
|
|
{{ if .menu.IsHome}}
|
|
{{ $currentNode.Scratch.Set "pages" .menu.Sections }}
|
|
{{ else if .menu.Sections}}
|
|
{{ $currentNode.Scratch.Set "pages" (.menu.Pages | union .menu.Sections) }}
|
|
{{end}}
|
|
{{ $pages := ($currentNode.Scratch.Get "pages") }}
|
|
|
|
{{if eq .Site.Params.ordersectionsby "title"}}
|
|
{{ range $pages.ByTitle }}
|
|
{{ template "menu-nextprev" dict "menu" . "currentnode" $currentNode "hidden" $hidden }}
|
|
{{end}}
|
|
{{else}}
|
|
{{ range $pages.ByWeight }}
|
|
{{ template "menu-nextprev" dict "menu" . "currentnode" $currentNode "hidden" $hidden }}
|
|
{{end}}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{$showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev))}}
|
|
{{if $showPrevNext}}
|
|
{{with ($.Scratch.Get "prevPage")}}
|
|
<a class="nav nav-prev" href="{{.RelPermalink}}" title="{{.Title}}"><i class="fa fa-chevron-left"></i></a>
|
|
{{end}}
|
|
{{with ($.Scratch.Get "nextPage")}}
|
|
<a class="nav nav-next" href="{{.RelPermalink}}" title="{{.Title}}"><i class="fa fa-chevron-right"></i></a>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
|
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
|
</div>
|
|
<script src="{{"js/clipboard.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
|
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
|
<script src="{{"js/perfect-scrollbar.jquery.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
|
<script src="{{"js/jquery.sticky.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
|
<script src="{{"js/jquery.svg.pan.zoom.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
|
<script src="{{"js/featherlight.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
|
<script src="{{"js/modernizr.custom-3.6.0.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
|
{{ if (or (and (ne .Params.disableMermaid nil) (not .Params.disableMermaid)) (not .Site.Params.disableMermaid)) }}
|
|
{{ if isset .Params "custommermaidurl" }}
|
|
<script src="{{ .Params.customMermaidURL }}"></script>
|
|
{{ else if isset .Site.Params "custommermaidurl" }}
|
|
<script src="{{ .Site.Params.customMermaidURL }}"></script>
|
|
{{ else }}
|
|
<script src="{{"js/mermaid.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
|
{{ end }}
|
|
{{ if isset .Params "mermaidinitialize" }}
|
|
{{ $.Scratch.Set "mermaidInitialize" .Params.mermaidInitialize }}
|
|
{{ else if isset .Site.Params "mermaidinitialize" }}
|
|
{{ $.Scratch.Set "mermaidInitialize" .Site.Params.mermaidInitialize }}
|
|
{{ else }}
|
|
{{ $.Scratch.Set "mermaidInitialize" "{ \"startOnLoad\": true }" }}
|
|
{{ end }}
|
|
<script>
|
|
if (mermaid) {
|
|
mermaid.mermaidAPI.initialize( Object.assign( { "securityLevel": "antiscript" }, JSON.parse({{ $.Scratch.Get "mermaidInitialize" }}), { startOnLoad: false } ) );
|
|
}
|
|
</script>
|
|
{{ end }}
|
|
<script src="{{"js/relearn.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
|
{{ partial "custom-footer.html" . }}
|
|
</body>
|
|
</html>
|