← Back to context

Comment by procparam

1 year ago

My friends and I have played so much already that the list of elements on the sidebar is unwieldy. You can paste this little js snippet into the console to add a basic search feature

  items = () => [...document.querySelectorAll('.items div.item')]
  show = (elt) => elt.style.display=''
  hide = (elt) => elt.style.display='none'
  search = (text) => (items().forEach(show), items().filter(e => !e.innerText.toLowerCase().includes(text.toLowerCase())).forEach(hide))
  inputElt = document.createElement('input'); inputElt.type='text';
  document.querySelector('.sidebar').prepend(inputElt)
  function handle(e) { search(e.target.value) }
  inputElt.addEventListener('input', handle)

This is really cool, thanks. I was just using ctrl+f to find things. I've got like 1200+ words right now so I totally understand the unwieldy-ness.

Thanks for this! I ended up hitting refresh because of how long my list eventually got, I wish I'd seen this comment 10 minutes sooner!

Oh well, I guess now I'm forced to sink in another half-hour this evening! ;)