Skip to content

Instantly share code, notes, and snippets.

@rudiedirkx
Last active July 3, 2024 01:46
Show Gist options
  • Save rudiedirkx/579e55f30e0e2f89063bf792aba1c363 to your computer and use it in GitHub Desktop.
Save rudiedirkx/579e55f30e0e2f89063bf792aba1c363 to your computer and use it in GitHub Desktop.
javascript:
document.addEventListener('mousedown', e => {
if (e.button == 2 && e.target.nodeName == 'SELECT') {
window.sst = setTimeout(function() {
var q = prompt('Search what?', '');
if (q === '') {
[].forEach.call(e.target.options, o => o.style.display = '');
}
else if (q != null) {
[].forEach.call(e.target.options, o => o.style.display = o.textContent.toLowerCase().indexOf(q) >= 0 ? '' : 'none');
}
}, 300);
}
});
document.addEventListener('mouseup', e => {
clearTimeout(window.sst);
});
void(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment