From f6dabba292121366aa322e36cab2426771eb3bcd Mon Sep 17 00:00:00 2001 From: Tadeas Uhlir Date: Thu, 24 Jan 2019 15:28:06 -0500 Subject: [PATCH 1/7] Add swp files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 93ac08f0..4078d967 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ tags compiler/*.js compiler/**/*.js src/.metadata.generated.ts +*.swp From 5d4f6b493f5e3401c90e51445dc9574324dea4d5 Mon Sep 17 00:00:00 2001 From: Tadeas Uhlir Date: Thu, 24 Jan 2019 15:50:02 -0500 Subject: [PATCH 2/7] Add option -j in excmds hint() which disables javascript hinting To make this work I added jshints argument in the pipe() function in hinting.ts file. This argument is set to true as default to preserve the original intent of allowing javascript hinting in most cases. --- src/content/hinting.ts | 3 ++- src/excmds.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/content/hinting.ts b/src/content/hinting.ts index e8740447..13c99db4 100644 --- a/src/content/hinting.ts +++ b/src/content/hinting.ts @@ -559,9 +559,10 @@ export function pipe( selectors = DOM.HINTTAGS_selectors, action: HintSelectedCallback = _ => _, rapid = false, + jshints = true, ): Promise<[Element, number]> { return new Promise((resolve, reject) => { - hintPage(hintables(selectors, true), action, resolve, reject, rapid) + hintPage(hintables(selectors, jshints), action, resolve, reject, rapid) }) } diff --git a/src/excmds.ts b/src/excmds.ts index 23112a88..9b447ea5 100644 --- a/src/excmds.ts +++ b/src/excmds.ts @@ -3495,6 +3495,11 @@ export async function hint(option?: string, selectors?: string, ...rest: string[ option = "-" + option.slice(2) rapid = true } + let jshints = true + if (option.startsWith("-j")) { + option = "-" + option.slice(2) + jshints = false + } let selectHints = new Promise(r => r()) let hintTabOpen = async (href, active = !rapid) => { @@ -3528,6 +3533,7 @@ export async function hint(option?: string, selectors?: string, ...rest: string[ return link }, rapid, + jshints, ) break @@ -3541,6 +3547,7 @@ export async function hint(option?: string, selectors?: string, ...rest: string[ return elem }, rapid, + jshints, ) break @@ -3598,6 +3605,7 @@ export async function hint(option?: string, selectors?: string, ...rest: string[ return elem }, rapid, + jshints, ) break @@ -3610,6 +3618,7 @@ export async function hint(option?: string, selectors?: string, ...rest: string[ return elem }, rapid, + jshints, ) break @@ -3618,6 +3627,7 @@ export async function hint(option?: string, selectors?: string, ...rest: string[ selectors, elem => elem[rest.join(" ")], rapid, + jshints, ) break @@ -3737,6 +3747,7 @@ export async function hint(option?: string, selectors?: string, ...rest: string[ return elem }, rapid, + jshints, ) } From 3fe97c5d5305fcef118d44bd7fc848cdf3f0fc46 Mon Sep 17 00:00:00 2001 From: Tadeas Uhlir Date: Thu, 24 Jan 2019 15:52:01 -0500 Subject: [PATCH 3/7] Update of documentation --- src/excmds.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/excmds.ts b/src/excmds.ts index 9b447ea5..b166775e 100644 --- a/src/excmds.ts +++ b/src/excmds.ts @@ -3457,6 +3457,7 @@ import * as hinting from "@src/content/hinting" - `-pipe selector key` e.g, `-pipe a href` returns the key. Only makes sense with `composite`, e.g, `composite hint -pipe * textContent | yank`. If you don't select a hint (i.e. press ), will return an empty string. - `-W excmd...` append hint href to excmd and execute, e.g, `hint -W exclaim mpv` to open YouTube videos. - -q* quick (or rapid) hints mode. Stay in hint mode until you press , e.g. `:hint -qb` to open multiple hints in the background or `:hint -qW excmd` to execute excmd once for each hint. This will return an array containing all elements or the result of executed functions (e.g. `hint -qpipe a href` will return an array of links). + - -j* disable javascript hints. Don't generate hints related to javascript events. This is particularly useful when used with the `-c` option when you want to generate only hints for the specified css selectors. Also useful on sites with plenty of useless javascript elements such as google.com - -br deprecated, use `-qb` instead Excepting the custom selector mode and background hint mode, each of these hint modes is available by default as `;