history: entire row clickable, hover accent on slug
CI / test (push) Successful in 17s
CI / docker (push) Skipped

This commit is contained in:
2026-09-08 19:17:20 -05:00
parent acafc13d20
commit 603b807c51
2 changed files with 8 additions and 1 deletions
+6 -1
View File
@@ -48,7 +48,7 @@ async function load() {
} else {
$('empty').style.display = 'none';
rows.innerHTML = data.items.map(it =>
`<tr class="row"><td><a class="slug" href="/${esc(it.id)}">${esc(it.id)}</a></td>` +
`<tr class="row" data-href="/${esc(it.id)}"><td><a class="slug" href="/${esc(it.id)}">${esc(it.id)}</a></td>` +
`<td class="title-cell">${it.title ? esc(it.title) : '<span class=dim>—</span>'}</td>` +
`<td><span class="badge">${esc(it.language || 'text')}</span></td>` +
`<td class="dim">${fmtSize(it.size)}</td><td class="dim">${it.view_count}</td><td class="dim">${ago(it.created_at)}</td></tr>`
@@ -82,6 +82,11 @@ $('pg').addEventListener('click', e => {
load();
window.scrollTo(0, 0);
});
$('rows').addEventListener('click', e => {
const tr = e.target.closest('tr.row[data-href]');
if (!tr || e.target.closest('a')) return; // let real links (e.g. middle-click) work
window.location.href = tr.dataset.href;
});
$('filter').addEventListener('input', () => { page = 1; load(); });
load();
setInterval(load, 30000); // auto-refresh history every 30s