mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
Add attempt at context menu hint mode
This commit is contained in:
parent
9ccd23d00c
commit
958bc855a0
2 changed files with 16 additions and 1 deletions
|
@ -3680,6 +3680,7 @@ export function unset(...keys: string[]) {
|
||||||
- -# yank an element's anchor URL to clipboard
|
- -# yank an element's anchor URL to clipboard
|
||||||
- -c [selector] hint links that match the css selector
|
- -c [selector] hint links that match the css selector
|
||||||
- `bind ;c hint -c [class*="expand"],[class="togg"]` works particularly well on reddit and HN
|
- `bind ;c hint -c [class*="expand"],[class="togg"]` works particularly well on reddit and HN
|
||||||
|
- -C open context menu
|
||||||
- -f [text] hint links and inputs that display the given text
|
- -f [text] hint links and inputs that display the given text
|
||||||
- `bind <c-e> hint -f Edit`
|
- `bind <c-e> hint -f Edit`
|
||||||
- -fr [text] use RegExp to hint the links and inputs
|
- -fr [text] use RegExp to hint the links and inputs
|
||||||
|
@ -3950,6 +3951,17 @@ export async function hint(option?: string, selectors?: string, ...rest: string[
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
case "-C":
|
||||||
|
selectHints = hinting.pipe_elements(
|
||||||
|
hinting.hintables(selectors),
|
||||||
|
elem => {
|
||||||
|
DOM.mouseEvent(elem,"context")
|
||||||
|
return elem
|
||||||
|
},
|
||||||
|
rapid,
|
||||||
|
)
|
||||||
|
break
|
||||||
|
|
||||||
case "-r":
|
case "-r":
|
||||||
selectHints = hinting.pipe_elements(
|
selectHints = hinting.pipe_elements(
|
||||||
DOM.elementsWithText(),
|
DOM.elementsWithText(),
|
||||||
|
|
|
@ -91,7 +91,7 @@ function isEditableHTMLInput(element: HTMLInputElement) {
|
||||||
*/
|
*/
|
||||||
export function mouseEvent(
|
export function mouseEvent(
|
||||||
element: Element,
|
element: Element,
|
||||||
type: "hover" | "unhover" | "click",
|
type: "hover" | "unhover" | "click" | "context",
|
||||||
modifierKeys = {},
|
modifierKeys = {},
|
||||||
) {
|
) {
|
||||||
let events = []
|
let events = []
|
||||||
|
@ -104,6 +104,9 @@ export function mouseEvent(
|
||||||
case "hover":
|
case "hover":
|
||||||
events = ["mouseover", "mouseenter", "mousemove"].concat(events)
|
events = ["mouseover", "mouseenter", "mousemove"].concat(events)
|
||||||
break
|
break
|
||||||
|
case "context":
|
||||||
|
events = ["contextmenu"]
|
||||||
|
break
|
||||||
}
|
}
|
||||||
events.forEach(type => {
|
events.forEach(type => {
|
||||||
const event = new MouseEvent(type, {
|
const event = new MouseEvent(type, {
|
||||||
|
|
Loading…
Add table
Reference in a new issue