parent
ba514b1973
commit
fa7857ba84
@ -1,17 +1,20 @@
|
||||
<nav>
|
||||
{{ $current := int (replaceRE `[^0-9]` "" .File) }}
|
||||
{{ $scratch := newScratch }}
|
||||
{{ $scratch.Set "isLatest" true }}
|
||||
{{ range.Site.RegularPages }}
|
||||
{{ if gt (int .File.TranslationBaseName) $current }}
|
||||
{{ $scratch.Set "isLatest" false }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $latest := int (index .Site.RegularPages 0).File.TranslationBaseName }}
|
||||
{{ $scratch.Set "isLatest" (eq $current $latest) }}
|
||||
{{ if ne $current 1 }}
|
||||
<a class="nav-button" href="../{{ sub $current 1 }}"><i class="fas fa-chevron-left"></i> #{{ sub $current 1 }}</a>
|
||||
<a class="nav-button" href="../{{ sub $current 1 }}"><svg class="svg-inline" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 278.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"></path></svg> #{{ sub $current 1 }}</a>
|
||||
{{ end }}
|
||||
<span class="title"><a href="/"><i class="fa-solid fa-house"></i> Homepage</a></span>
|
||||
<!-- <span class="title"><a href="/"><i class="fa-solid fa-house"></i> Homepage</a></span> -->
|
||||
<form onsubmit="window.location.href = '/' + this.getElementsByTagName('input')[0].value + '?nav'; return false"><input id="navInput" type="number" min="1" max="{{ $latest }}" value="{{ $current }}" autocomplete="false"></form>
|
||||
<script>
|
||||
if (window.location.href.split('?')[1] === "nav") {
|
||||
window.history.replaceState(null, null, window.location.pathname);
|
||||
document.getElementById("navInput").focus();
|
||||
}
|
||||
</script>
|
||||
{{ if not ($scratch.Get "isLatest") }}
|
||||
<a class="nav-button" href="../{{ add $current 1 }}">#{{ add $current 1 }} <i class="fas fa-chevron-right"></i></a>
|
||||
<a class="nav-button" href="../{{ add $current 1 }}">#{{ add $current 1 }} <svg class="svg-inline" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M342.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L274.7 256 105.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"></path></svg></a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
</nav>
|
||||
|
After Width: | Height: | Size: 988 B |
Loading…
Reference in new issue