TabTarget
HINTTAGS_anchor_selectors
HINTTAGS_filter_by_text_selectors
HINTTAGS_img_selectors
HINTTAGS_killable_selectors
HINTTAGS_saveable
HINTTAGS_selectors
hintworthy_js_elems
activeElement
anchors
compareElementArea
deepestShadowRoot
elementsByXPath
elementsWithText
focus
getAbsoluteCentre
getAllDocumentFrames
getElementCentre
getElemsBySelector
getLastUsedInput
getNthElement
getSelection
getSelector
getVisibleElemsBySelector
heightMatters
hijackPageAttachShadow
hijackPageListenerFunctions
isPainted
isSubstantial
isTextEditable
isVisible
isVisibleFilter
isWithinDisabledFormControl
mouseEvent
pruneHintworthyJSElems
registerEvListenerAction
setupFocusHandler
simulateClick
widthMatters
HINTTAGS_anchor_selectors: "\n[id],\n[name]\n" = ...
HINTTAGS_filter_by_text_selectors: "\ninput:not([type=hidden]):not([disabled]),\na,\ntextarea,\nbutton,\nselect,\n[class*='button']\n" = ...
HINTTAGS_img_selectors: "\nimg,\n[src]\n" = ...
HINTTAGS_killable_selectors: "\nheader,\nfooter,\nnav,\nspan,\ndiv,\niframe,\nimg,\nbutton,\narticle,\nsummary\n" = ...
HINTTAGS_saveable: "\n[href]:not([href='#'])\n" = ...

CSS selector for elements which point to a saveable resource

HINTTAGS_selectors: "\ninput:not([type=hidden]):not([disabled]),\na,\narea,\nbutton,\ndetails,\niframe,\nlabel,\nselect,\nsummary,\ntextarea,\n[onclick],\n[onmouseover],\n[onmousedown],\n[onmouseup],\n[oncommand],\n[role='link'],\n[role='button'],\n[role='checkbox'],\n[role='combobox'],\n[role='listbox'],\n[role='listitem'],\n[role='menuitem'],\n[role='menuitemcheckbox'],\n[role='menuitemradio'],\n[role='option'],\n[role='radio'],\n[role='scrollbar'],\n[role='slider'],\n[role='spinbutton'],\n[role='tab'],\n[role='textbox'],\n[role='treeitem'],\n[class*='button'],\n[tabindex]\n" = ...
hintworthy_js_elems: Set<Element> = ...
  • Return the active element, within shadow DOMs or iframes if necessary.

    Parameters

    • elem: Element = document.activeElement

    Returns Element

  • Get array of "anchors": elements which have id or name and can be addressed with the hash/fragment in the URL

    Parameters

    • includeInvisible: boolean = false

    Returns Element[]

  • Recursively resolves an active shadow DOM element.

    Parameters

    • sr: ShadowRoot

    Returns ShadowRoot

  • Iterable of elements that match xpath.

    Adapted from stackoverflow

    Parameters

    • xpath: any
    • Optionalparent: any

    Returns Generator<Node, void, unknown>

  • Parameters

    • includeInvisible: boolean = false

    Returns Element[]

  • Parameters

    • el: any

    Returns { x: any; y: any }

  • Return all frames that belong to the document (frames that belong to extensions are ignored).

    Parameters

    • doc: Document = document

      The document the frames should be fetched from

    Returns HTMLFrameElement[]

  • Parameters

    • el: any

    Returns { x: number; y: number }

  • Get all elements that match the given selector

    Parameters

    • selector: string

      `the CSS selector to choose elements with

    • filters: ElementFilter[]

      filter to use (in thre given order) to further chose items, or [] for all

    Returns Element[]

  • Get the nth input element on a page

    Parameters

    • selectors: string
    • nth: number

      the element index, can be negative to start at the end

    • filters: ElementFilter[]

      filter to use (in thre given order) to further chose items, or [] for all

    Returns HTMLElement

  • Return the first non-collapsed selection in this document or an accessible frame.

    Parameters

    • doc: Document = document

    Returns Selection

  • More accurate element visibility checking than isVisible.

    Parameters

    • selector: string = "*"
    • filters: ElementFilter[] = []
    • elements: Element[] = []

    Returns Promise<HTMLElement[]>

  • This function decides whether the height attribute contained in a ComputedStyle matters. For example, the height attribute doesn't matter for elements that have "display: inline" because their height is overriden by the height of the node they are in.

    Parameters

    • style: CSSStyleDeclaration

    Returns boolean

  • Parameters

    • onShadowRoot: (root: ShadowRoot) => void
    • win: Window & typeof globalThis = window

    Returns void

  • Replace the page's addEventListener with a closure containing a reference to the original addEventListener and registerEvListenerAction. Do the same with removeEventListener.

    Returns void

  • Is the element of "substantial" size and shown on the page. The element doesn't need to be in the viewport. This is useful when you want to scroll to something, but still want to exclude tiny and useless items

    Parameters

    • element: Element

    Returns boolean

  • Given a DOM element, returns true if you can edit it with key presses or if the element is of a type that should handle its own keypresses (e.g. role=application for google docs/sheets) TODO: work on case sensitivity consider all the possible cases

    Parameters

    • element: Element

    Returns boolean

  • Parameters

    • includeInvisible: boolean

    Returns (_: Element | Range) => boolean

  • Parameters

    • element: Element

    Returns boolean

  • Dispatch a mouse event to the target element based on cVim's implementation

    Parameters

    • element: Element
    • type: "click" | "hover" | "unhover"
    • modifierKeys: {} = {}

    Returns void

  • Returns void

  • Adds or removes an element from the hintworthy_js_elems array of the current tab.

    Parameters

    • elem: EventTarget

      The element add/removeEventListener is called on

    • add: boolean

      true when called from addEventListener, false from removeEventListener

    • event: string

      The event name given to add/removeEventListener

      This function must be security reviewed when Custom Elements land in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1406825

      This function is exported to the web content window but should only be callable from our modified add/removeEventListener because we remove the reference to it before web content runs (if added afterwards a mutationobserver on the window object would probably capture a reference to this function).

      Just in case web content does get a direct reference or the built-in add/removeEventListener code doesn't validate elem correctly, this function must assume that its inputs are potentially malicious.

    Returns void

  • Parameters

    • doc: Document = document
    • OptionalonFocus: () => void

    Returns void

  • if target === _blank clicking the link is treated as opening a popup and is blocked. Use webext API to avoid that.

    Parameters

    Returns void

  • Parameters

    • style: CSSStyleDeclaration

    Returns boolean