mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-09-13 13:22:03 +02:00
28 lines
1.0 KiB
HTML
28 lines
1.0 KiB
HTML
{% load i18n %}
|
|
<div id="search" class="mb-3">
|
|
<label class="w-full">
|
|
<input type="search"
|
|
class="input input-bordered w-full"
|
|
placeholder="{% translate 'Search' %}"
|
|
_="on input or search
|
|
set query to my value.toLowerCase()
|
|
set rows to <tbody>tr/> in <table/>
|
|
set paths to []
|
|
set matches to []
|
|
repeat for row in rows index i
|
|
set path to row.getAttribute('data-search-path')
|
|
if no path then set path to '#' + i + '/' end
|
|
append path to paths
|
|
if row.textContent.toLowerCase() contains query then append path to matches end
|
|
end
|
|
repeat for row in rows index i
|
|
set path to paths[i]
|
|
set keep to false
|
|
repeat for match in matches
|
|
if path.startsWith(match) or match.startsWith(path) then set keep to true end
|
|
end
|
|
if keep then show row else hide row end
|
|
end"/>
|
|
</label>
|
|
</div>
|