You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
1.7 KiB
25 lines
1.7 KiB
<nav>
|
|
{{ $current := int (replaceRE `[^0-9]` "" .File) }}
|
|
{{ $scratch := newScratch }}
|
|
{{ $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 }}"><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> -->
|
|
<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);
|
|
const navInput = document.getElementById("navInput");
|
|
navInput.focus();
|
|
const tmp = navInput.value;
|
|
navInput.value = "";
|
|
navInput.value = tmp;
|
|
}
|
|
</script>
|
|
{{ if not ($scratch.Get "isLatest") }}
|
|
<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>
|