enable human readable sizes again/fix mobile design and add second sorting arrow

Co-Authored-By: David <contact@davidcraft.de>
This commit is contained in:
Zoey 2024-06-09 15:50:18 +02:00
parent 132623891a
commit ec47bdc3e8
No known key found for this signature in database
GPG key ID: 02A3919EB4F67328
3 changed files with 32 additions and 5 deletions

View file

@ -8,14 +8,14 @@
document.querySelector("h1").after(input); document.querySelector("h1").after(input);
var items = [].slice.call(document.querySelectorAll("#list tbody tr")); var items = [].slice.call(document.querySelectorAll("#list tbody tr"));
function filterItems(item, filter) { function filterItems(item, filter) {
return !item.querySelector("td").textContent.trim().includes(filter); return !item.querySelector("td").textContent.trim().toLowerCase().includes(filter);
} }
input.addEventListener("keyup", function () { input.addEventListener("keyup", function () {
items.forEach((item) => { items.forEach((item) => {
item.hidden = false; item.hidden = false;
}); });
items items
.filter((item) => filterItems(item, this.value.trim())) .filter((item) => filterItems(item, this.value.trim().toLowerCase()))
.forEach((item) => { .forEach((item) => {
item.hidden = true; item.hidden = true;
}); });
@ -25,6 +25,16 @@
tableDiv.id = "tableDiv"; tableDiv.id = "tableDiv";
tableDiv.appendChild(document.querySelector("table")); tableDiv.appendChild(document.querySelector("table"));
document.getElementById("search").after(tableDiv); document.getElementById("search").after(tableDiv);
var headers = document.querySelectorAll("th");
headers.forEach((header) => {
var links = header.querySelectorAll("a");
var ascendingLink = document.createElement("a");
ascendingLink.innerHTML = "&nbsp;&nbsp;";
ascendingLink.href = links[0].href;
links[0].removeAttribute("href");
links[1].after(ascendingLink);
});
</script> </script>
</body> </body>
</html> </html>

View file

@ -1,4 +1,4 @@
<!doctype html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Directory index</title> <title>Directory index</title>
@ -109,6 +109,8 @@
border-bottom-width: 1px; border-bottom-width: 1px;
border-bottom-style: solid; border-bottom-style: solid;
line-height: 2.5rem; line-height: 2.5rem;
padding: 0.4rem;
overflow-wrap: break-word;
} }
tr a { tr a {
@ -147,13 +149,28 @@
#box { #box {
padding-right: 1rem; padding-right: 1rem;
padding-left: 1rem; padding-left: 1rem;
margin: 2rem; margin: 0.5rem;
margin-top: 1.5rem;
margin-bottom: 0rem; margin-bottom: 0rem;
} }
th { th {
padding-right: 0rem; padding-right: 0rem;
} }
#search {
font-size: 16px;
margin-left: auto;
margin-right: auto;
}
table {
font-size: medium;
}
td {
max-width: 10rem;
}
} }
</style> </style>
<div id="box"> <div id="box">

View file

@ -100,7 +100,7 @@ http {
fancyindex off; fancyindex off;
fancyindex_localtime on; fancyindex_localtime on;
fancyindex_show_path on; fancyindex_show_path on;
fancyindex_exact_size on; fancyindex_exact_size off;
fancyindex_show_dotfiles off; fancyindex_show_dotfiles off;
fancyindex_hide_symlinks off; fancyindex_hide_symlinks off;
fancyindex_case_sensitive on; fancyindex_case_sensitive on;