Module select_wm
Select a page element with a visual interface
This web module allows other Lua modules to select page elements with the
same interface as that used by the follow mode plugin: a visual overlay is
shown that allows the users to type to filter visible hints. For example,
this module is used by the formfiller
module when selecting a form to add.
Functions
select_wm.enter (page, elements, stylesheet, ignore_case)
Enter element selection mode on a web page.
The web page must not already be in element selection mode.
Parameters
-
pageType: pageThe web page in which to enter element selection.
-
elementsType: string or {dom_element}A selector to filter elements, or an array of elements.
-
stylesheetType: stringThe stylesheet to apply.
-
ignore_caseType: boolean
true
if text case should be ignored.
Return Values
-
{...}Table with data for the currently focused hint.
-
numberThe number of currently visible hints.
select_wm.leave (page)
Leave element selection mode on a web page.
The web page must be in element selection mode.
Parameters
-
pageType: page or numberThe web page (or the web page id) in which to leave element selection.
select_wm.changed (page, hint_pat, text_pat, text)
Update the element selection interface when user selection text changes.
The web page must be in element selection mode.
Parameters
-
pageType: pageThe web page.
-
hint_patType: stringThe hint pattern filter.
-
text_patType: stringThe text pattern filter.
-
textType: stringThe full text.
Return Values
-
tableThe currently focused hint.
-
numberThe number of currently visible hints.
select_wm.focus (page, step)
Update the element selection interface when the user moves the focus.
The web page must be in element selection mode.
Usage
function handle_next (page) select_wm.focus(page, 1) end function handle_prev (page) select_wm.focus(page, -1) end
Parameters
-
pageType: pageThe web page.
-
stepType: numberRelative number of tags to shift focus by.
Return Values
-
tableThe currently focused hint.
-
numberThe number of currently visible hints.
select_wm.hints (page)
Get the current state of element hints on a web page.
The web page must be in element selection mode.
Parameters
-
pageType: pageThe web page.
Return Values
-
tableThe current hint state for
page
.
select_wm.focused_hint (page)
Get the currently focused element hint on a web page.
The web page must be in element selection mode.
Parameters
-
pageType: pageThe web page.
Return Values
-
tableThe currently focused hint.
Attribution
Copyright
- 2017 Aidan Holm