summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2024-01-06 11:29:01 +0000
committerMarc Espie <espie@cvs.openbsd.org>2024-01-06 11:29:01 +0000
commit6704e83df2731b8c968490788156e6cb1c17ebc1 (patch)
treea517ea9574202789f641ae7b877df26e178554ba /usr.sbin/httpd
parent3a62aa44389f62e3c1882453a2f52127e16354a5 (diff)
put the real sizes into the "title" attribute so that hovering shows the
exact value. adjust/refactor javascript sorter accordingly
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r--usr.sbin/httpd/js.h.in5
-rw-r--r--usr.sbin/httpd/server_file.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/httpd/js.h.in b/usr.sbin/httpd/js.h.in
index 8d0ea22af36..a9b2332d092 100644
--- a/usr.sbin/httpd/js.h.in
+++ b/usr.sbin/httpd/js.h.in
@@ -1,6 +1,7 @@
static const char *js =
-const rowValue = (tr, idx) => tr.children[idx].getAttribute('data-o') || tr.children[idx].innerText || tr.children[idx].textContent;
-
+const cellVal = (e) => e.getAttribute('title') || e.getAttribute('data-o') ||
+ e.innerText || e.textContent;
+const rowValue = (tr, idx) => cellVal(tr.children[idx]);
const compare = (idx, asc) => (a, b) => ((v1, v2) =>
v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2) ? v1 - v2 : v1.toString().localeCompare(v2)
)(rowValue(asc ? a : b, idx), rowValue(asc ? b : a, idx));
diff --git a/usr.sbin/httpd/server_file.c b/usr.sbin/httpd/server_file.c
index 61d9da73709..8e76cc9b672 100644
--- a/usr.sbin/httpd/server_file.c
+++ b/usr.sbin/httpd/server_file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server_file.c,v 1.77 2024/01/04 18:17:47 espie Exp $ */
+/* $OpenBSD: server_file.c,v 1.78 2024/01/06 11:29:00 espie Exp $ */
/*
* Copyright (c) 2006 - 2017 Reyk Floeter <reyk@openbsd.org>
@@ -596,7 +596,7 @@ server_file_index(struct httpd *env, struct client *clt)
(evbuffer_add_printf(evb,
"<tr><td><a href=\"%s%s\">%s</a></td>\n"
" <td data-o=\"%lld\">%s</td>"
- "<td data-o=\"%llu\">%s</td></tr>\n",
+ "<td title=\"%llu\">%s</td></tr>\n",
strchr(escapeduri, ':') != NULL ? "./" : "",
escapeduri, escapedhtml,
(long long)t, tmstr,