mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Added quick filter in popup if there are more entries
This commit is contained in:
parent
afe66d3656
commit
bfa5548715
3 changed files with 29 additions and 0 deletions
|
|
@ -62,3 +62,11 @@ body {
|
|||
float: right;
|
||||
height: 30px;
|
||||
}
|
||||
#login-filter {
|
||||
outline:none;
|
||||
border-radius: 4px 0 0 4px;
|
||||
border: 1px solid #ccc;
|
||||
margin-bottom: 5px;
|
||||
padding: 2px 10px;
|
||||
width: 100%;
|
||||
}
|
||||
|
|
@ -29,6 +29,10 @@
|
|||
<p>
|
||||
Select the login information you would like to get entered into the page:
|
||||
</p>
|
||||
<div id="filter-block" style="display: none;">
|
||||
<label for="login-filter">Filter:</label>
|
||||
<input type="text" id="login-filter">
|
||||
</div>
|
||||
<div id="login-list" class="list-group"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,23 @@ $(function() {
|
|||
});
|
||||
ll.appendChild(a);
|
||||
}
|
||||
|
||||
if (logins.length > 1) {
|
||||
document.getElementById('filter-block').style = '';
|
||||
let filter = document.getElementById('login-filter');
|
||||
filter.addEventListener('keyup', (e) => {
|
||||
let val = filter.value;
|
||||
let re = new RegExp(val, 'i');
|
||||
let links = ll.getElementsByTagName('a');
|
||||
for (let i in links) {
|
||||
if (links.hasOwnProperty(i)) {
|
||||
let found = String(links[i].textContent).match(re) !== null;
|
||||
links[i].style = found ? '' : 'display: none;';
|
||||
}
|
||||
}
|
||||
});
|
||||
filter.focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue