Signed-off-by: Zoey <zoey@z0ey.de>
This commit is contained in:
Zoey
2022-12-16 09:05:58 +01:00
parent fd30cfe98b
commit 19a304d9ce
169 changed files with 2074 additions and 27536 deletions

View File

@@ -0,0 +1,33 @@
// addNginxFancyIndexForm.js
// Add a small form to filter through the output of Nginx FancyIndex page
// © 2017, Lilian Besson (Naereen) and contributors,
// open-sourced under the MIT License, https://lbesson.mit-license.org/
// hosted on GitHub, https://GitHub.com/Naereen/Nginx-Fancyindex-Theme
var form = document.createElement('form');
var input = document.createElement('input');
input.name = 'filter';
input.id = 'search';
input.placeholder = 'Type to search...';
form.appendChild(input);
document.querySelector('h1').after(form);
var listItems = [].slice.call(document.querySelectorAll('#list tbody tr'));
input.addEventListener('keyup', function () {
var i,
// Word sequence _matching_ to input. All, except last, words must be _complete_.
e = "(^|.*[^\\pL])" + this.value.trim().split(/\s+/).join("([^\\pL]|[^\\pL].*[^\\pL])") + ".*$",
n = RegExp(e, "i");
listItems.forEach(function(item) {
item.removeAttribute('hidden');
});
listItems.filter(function(item) {
i = item.querySelector('td').textContent.replace(/\s+/g, " ");
return !n.test(i);
}).forEach(function(item) {
item.hidden = true;
});
});