diff --git a/keepassxc-browser/popups/popup.css b/keepassxc-browser/popups/popup.css index 5704b7d..3827486 100644 --- a/keepassxc-browser/popups/popup.css +++ b/keepassxc-browser/popups/popup.css @@ -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%; +} \ No newline at end of file diff --git a/keepassxc-browser/popups/popup_login.html b/keepassxc-browser/popups/popup_login.html index 78f8d7c..d484c32 100644 --- a/keepassxc-browser/popups/popup_login.html +++ b/keepassxc-browser/popups/popup_login.html @@ -29,6 +29,10 @@

Select the login information you would like to get entered into the page:

+
diff --git a/keepassxc-browser/popups/popup_login.js b/keepassxc-browser/popups/popup_login.js index 1c81866..37d9113 100644 --- a/keepassxc-browser/popups/popup_login.js +++ b/keepassxc-browser/popups/popup_login.js @@ -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(); + } }); });