feat: CTRL + K search, css

This commit is contained in:
eneller
2025-03-20 20:15:51 +01:00
parent 518a8a1744
commit aa66c06f88
2 changed files with 17 additions and 3 deletions

View File

@@ -4,7 +4,13 @@ const searchInput = document.getElementById('searchInput');
const table = document.getElementById('table'); const table = document.getElementById('table');
const table_r = Array.from(table.getElementsByTagName('tr')); const table_r = Array.from(table.getElementsByTagName('tr'));
// allow search from url parameter document.addEventListener('keydown', (event)=>{
if (event.ctrlKey && event.key === 'k'){
event.preventDefault();
searchInput.select();
}
});
// search from url parameter
let searchParam = params.get('s'); let searchParam = params.get('s');
if (searchParam){ if (searchParam){
searchInput.value = searchParam; searchInput.value = searchParam;

View File

@@ -7,7 +7,7 @@
} }
body{ body{
margin:40px auto; margin:40px auto;
max-width:650px; max-width:800px;
line-height:1.4; line-height:1.4;
font-size:18px; font-size:18px;
color:var(--fg); color:var(--fg);
@@ -32,7 +32,15 @@ small{
color: var(--fg-deemph); color: var(--fg-deemph);
} }
.searchbar{ .searchbar{
width: fit-content; width: 100%;
}
#searchInput {
width: 100%;
padding: .2em;
font-size: larger;
}
th{
text-align: left;
} }
tr:nth-child(even){ tr:nth-child(even){
background-color: var(--bg-acc); background-color: var(--bg-acc);