diff --git a/mirva/resources/mirva.css b/mirva/resources/mirva.css index 890b622..bbff12d 100644 --- a/mirva/resources/mirva.css +++ b/mirva/resources/mirva.css @@ -318,4 +318,23 @@ a:hover {} .float_down { float: left; +} + +.float_count { + float: left; + padding-top: 4px; + text-shadow: var(--button-shadow) 2px 2px 1px; +} + +.float_count_footer { + text-shadow: var(--button-shadow) 2px 2px 1px; + display: none; + position: absolute; + right: 4px; +} + +@media only screen and (max-width: 800px) { + .float_count_footer { + display: block; + } } \ No newline at end of file diff --git a/mirva/resources/mirva.js b/mirva/resources/mirva.js index 3c8a73a..adabb1a 100644 --- a/mirva/resources/mirva.js +++ b/mirva/resources/mirva.js @@ -19,6 +19,11 @@ r(function() { function create_nav() { let navis = document.getElementsByClassName("navigation"); for (let i = 0; i < navis.length; i++) { + if (navis.length > 10) { + // no need to enumerate on small sites. + navis[i].appendChild(create_counter(i, navis.length, "float_count")); + navis[i].parentElement.appendChild(create_counter(i, navis.length, "float_count_footer")); + } if (i == navis.length - 1) { navis[i].appendChild(create_button("up", document.body, 0)); continue; @@ -65,6 +70,13 @@ function create_button(direction, to, next) { return container } +function create_counter(i, total, class_name) { + let container = document.createElement('div'); + container.classList.add(class_name); + container.innerHTML = `${i+1}/${total}`; + return container +} + function is_visible(el, type) { let rect = el.getBoundingClientRect(); if (type == "fully") { @@ -223,4 +235,4 @@ function keyboard_entry(ev) { } current = Math.min(posts.length - 1, Math.max(0, current)); scroll_to(posts[current].parentElement) -} +} \ No newline at end of file