Skip to content

Instantly share code, notes, and snippets.

@rudiedirkx
Last active July 24, 2017 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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