From ef0dceb5e3695222c9515e080415663c4574353a Mon Sep 17 00:00:00 2001 From: espie Date: Sat, 6 Jan 2024 11:29:00 +0000 Subject: [PATCH] put the real sizes into the "title" attribute so that hovering shows the exact value. adjust/refactor javascript sorter accordingly --- usr.sbin/httpd/js.h.in | 5 +++-- usr.sbin/httpd/server_file.c | 4 ++-- 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 @@ -596,7 +596,7 @@ server_file_index(struct httpd *env, struct client *clt) (evbuffer_add_printf(evb, "%s\n" " %s" - "%s\n", + "%s\n", strchr(escapeduri, ':') != NULL ? "./" : "", escapeduri, escapedhtml, (long long)t, tmstr, -- 2.20.1