Show only hints prefixed by fstr. Focus first match
Partition the filter string into hintchars and content filter strings. Apply each part in sequence, reducing the list of active hints.
Update display after all filtering, adjusting labels if appropriate.
Consider: This is a poster child for separating data and display. If they weren't so tied here we could do a neat dynamic programming thing and just throw the data at a reactalike.
Hint elements to focus
Hint images, opening in the same tab, or in a background tab
opens the image source URL in a background tab, as opposed to the current tab
Hint elements and delete the selection from the page
For each hintable element, add a hint
Hint items and read out the content of the selection
Hint link elements to save
the type of elements to hint and save:
- "link": elements that point to another resource (eg
links to pages/files) - the link targer is saved
- "img": image elements
prompt for save location
Get array of images in the viewport
Array of hintable elements in viewport
Elements are hintable if
Shorter hints
Hints that are prefixes of other hints are a bit annoying because you have to select them with Enter or Space.
This function removes hints that prefix other hints by observing that: let h = hintchars.length if n < h ** 2 then n / h = number of single character hintnames that would prefix later hints
So it removes them. This function is not yet clever enough to realise that if n > h 2 it should remove h + (n - h2 - h) / h ** 2 and so on, but we hardly ever see that many hints, so whatever.
An infinite stream of hints
Earlier hints prefix later hints
Uniform length hintnames
Array of items that can be killed with hint kill
If key is in hintchars, add it to filtstr and filter
Remove all hints, reset STATE.
Returns elements that point to a saveable resource
Type for "hint save" actions:
links to pages/files) - the link target is saved