mirror of
https://github.com/caddyserver/caddy.git
synced 2025-03-23 05:49:27 +01:00
browse: allow filter init via filter
query param (#3026)
This allows creating links that display only a subset of files in a directory.
This commit is contained in:
parent
11ae1aa6b8
commit
a2d71bdd94
1 changed files with 11 additions and 1 deletions
|
@ -326,7 +326,7 @@ footer {
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body onload='filter()'>
|
<body onload='initFilter()'>
|
||||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="0" width="0" style="position: absolute;">
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="0" width="0" style="position: absolute;">
|
||||||
<defs>
|
<defs>
|
||||||
<!-- Folder -->
|
<!-- Folder -->
|
||||||
|
@ -477,6 +477,16 @@ footer {
|
||||||
var filterEl = document.getElementById('filter');
|
var filterEl = document.getElementById('filter');
|
||||||
filterEl.focus();
|
filterEl.focus();
|
||||||
|
|
||||||
|
function initFilter() {
|
||||||
|
if (!filterEl.value) {
|
||||||
|
var filterParam = new URL(window.location.href).searchParams.get('filter');
|
||||||
|
if (filterParam) {
|
||||||
|
filterEl.value = filterParam;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filter();
|
||||||
|
}
|
||||||
|
|
||||||
function filter() {
|
function filter() {
|
||||||
var q = filterEl.value.trim().toLowerCase();
|
var q = filterEl.value.trim().toLowerCase();
|
||||||
var elems = document.querySelectorAll('tr.file');
|
var elems = document.querySelectorAll('tr.file');
|
||||||
|
|
Loading…
Reference in a new issue