Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "hinting"

Index

Type aliases

HintBuilder

HintBuilder: function

Type declaration

HintFilter

HintFilter: function

Type declaration

    • (string: any): void
    • Parameters

      • string: any

      Returns void

HintSelectedCallback

HintSelectedCallback: function

Type declaration

    • (Hint: any): any
    • Parameters

      • Hint: any

      Returns any

Variables

HINTTAGS_anchor_selectors

HINTTAGS_anchor_selectors: string = `[id],[name]`

HINTTAGS_img_selectors

HINTTAGS_img_selectors: string = `img,[src]`

HINTTAGS_killable_selectors

HINTTAGS_killable_selectors: string = `span,div,iframe,img,button,article,summary`

HINTTAGS_saveable

HINTTAGS_saveable: string = `[href]:not([href='#'])`

CSS selector for elements which point to a saveable resource

HINTTAGS_selectors

HINTTAGS_selectors: string = `input:not([type=hidden]):not([disabled]),a,area,iframe,textarea,button,select,summary,[onclick],[onmouseover],[onmousedown],[onmouseup],[oncommand],[role='link'],[role='button'],[role='checkbox'],[role='combobox'],[role='listbox'],[role='listitem'],[role='menuitem'],[role='menuitemcheckbox'],[role='menuitemradio'],[role='option'],[role='radio'],[role='scrollbar'],[role='slider'],[role='spinbutton'],[role='tab'],[role='textbox'],[role='treeitem'],[class*='button'],[tabindex]`

logger

logger: Logger = new Logger("hinting")

modeState

modeState: HintState = undefined

Functions

anchors

  • anchors(): Element[]
  • Get arrat of "anchors": elements which have id or name and can be addressed with the hash/fragment in the URL

    Returns Element[]

buildHintsSimple

buildHintsVimperator

defaultHintBuilder

defaultHintFilter

elementFilterableText

  • elementFilterableText(el: Element): string

elementswithtext

  • elementswithtext(): Element[]

filterHintsSimple

  • filterHintsSimple(fstr: any): void
  • Show only hints prefixed by fstr. Focus first match

    Parameters

    • fstr: any

    Returns void

filterHintsVimperator

  • filterHintsVimperator(fstr: any, reflow?: boolean): void
  • 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.

    Parameters

    • fstr: any
    • Default value reflow: boolean = false

    Returns void

hintFocus

  • hintFocus(): void

hintImage

  • hintImage(inBackground: any): void
  • Hint images, opening in the same tab, or in a background tab

    Parameters

    • inBackground: any

      opens the image source URL in a background tab, as opposed to the current tab

    Returns void

hintKill

  • hintKill(): void
  • Hint elements and delete the selection from the page

    Returns void

hintPage

  • For each hintable element, add a hint

    Parameters

    Returns void

hintPageAnchorYank

  • hintPageAnchorYank(): void
  • Hint anchors and yank the URL on selection

    Returns void

hintPageExStr

  • hintPageExStr(...exStr: string[]): void
  • Parameters

    • Rest ...exStr: string[]

    Returns void

hintPageOpenInBackground

  • hintPageOpenInBackground(selectors?: string): void
  • Parameters

    • Default value selectors: string = HINTTAGS_selectors

    Returns void

hintPageSimple

  • hintPageSimple(selectors?: string): void
  • Parameters

    • Default value selectors: string = HINTTAGS_selectors

    Returns void

hintPageTextYank

  • hintPageTextYank(): void

hintPageWindow

  • hintPageWindow(): void

hintPageWindowPrivate

  • hintPageWindowPrivate(): void

hintPageYank

  • hintPageYank(): void

hintRead

  • hintRead(): void
  • Hint items and read out the content of the selection

    Returns void

hintSave

  • Hint link elements to save

    Parameters

    • hintType: HintSaveType

      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
      
    • saveAs: boolean

      prompt for save location

    Returns void

hintableImages

  • hintableImages(): Element[]
  • Get array of images in the viewport

    Returns Element[]

hintables

  • hintables(selectors?: string, withjs?: boolean): Element[]
  • Array of hintable elements in viewport

    Elements are hintable if

    1. they can be meaningfully selected, clicked, etc
    2. they're visible
    3. Within viewport
    4. Not hidden by another element

    Parameters

    • Default value selectors: string = HINTTAGS_selectors
    • Default value withjs: boolean = false

    Returns Element[]

hintnames

  • hintnames(n: number, hintchars?: any): IterableIterator<string>
  • 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.

    Parameters

    • n: number
    • Default value hintchars: any = config.get("hintchars")

    Returns IterableIterator<string>

hintnames_simple

  • hintnames_simple(hintchars?: any): IterableIterator<string>
  • An infinite stream of hints

    Earlier hints prefix later hints

    Parameters

    • Default value hintchars: any = config.get("hintchars")

    Returns IterableIterator<string>

hintnames_uniform

  • hintnames_uniform(n: number, hintchars?: any): IterableIterator<string>
  • Uniform length hintnames

    Parameters

    • n: number
    • Default value hintchars: any = config.get("hintchars")

    Returns IterableIterator<string>

killables

  • killables(): Element[]
  • Array of items that can be killed with hint kill

    Returns Element[]

pushKey

  • pushKey(ke: any): void
  • If key is in hintchars, add it to filtstr and filter

    Parameters

    • ke: any

    Returns void

reset

  • reset(): void
  • Remove all hints, reset STATE.

    Returns void

saveableElements

  • saveableElements(): Element[]
  • Returns elements that point to a saveable resource

    Returns Element[]

selectFocusedHint

  • selectFocusedHint(): void

simulateClick

  • simulateClick(target: HTMLElement): void
  • if target === _blank clicking the link is treated as opening a popup and is blocked. Use webext API to avoid that.

    Parameters

    • target: HTMLElement

    Returns void

Generated using TypeDoc