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: 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() {
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)
}
}