This commit is contained in:
Q
2023-10-14 21:44:34 +03:00
parent afc1bc8a26
commit 0749b52025
2 changed files with 32 additions and 1 deletions

View File

@@ -318,4 +318,23 @@ a:hover {}
.float_down { .float_down {
float: left; 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;
}
} }

View File

@@ -19,6 +19,11 @@ r(function() {
function create_nav() { function create_nav() {
let navis = document.getElementsByClassName("navigation"); let navis = document.getElementsByClassName("navigation");
for (let i = 0; i < navis.length; i++) { 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) { if (i == navis.length - 1) {
navis[i].appendChild(create_button("up", document.body, 0)); navis[i].appendChild(create_button("up", document.body, 0));
continue; continue;
@@ -65,6 +70,13 @@ function create_button(direction, to, next) {
return container 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) { function is_visible(el, type) {
let rect = el.getBoundingClientRect(); let rect = el.getBoundingClientRect();
if (type == "fully") { if (type == "fully") {
@@ -223,4 +235,4 @@ function keyboard_entry(ev) {
} }
current = Math.min(posts.length - 1, Math.max(0, current)); current = Math.min(posts.length - 1, Math.max(0, current));
scroll_to(posts[current].parentElement) scroll_to(posts[current].parentElement)
} }