diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-08-08 11:29:30 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-08-08 11:29:30 +0530 |
| commit | b41d47d1f5a9b7ae922830c5bdb83e2f182d1b52 (patch) | |
| tree | e6bf5749730d9c7a8c55a8be2f54c1c0876e90c9 /assets | |
| parent | f9cb560af761e10803128a06599f99bc2292b4be (diff) | |
| download | null-browser-b41d47d1f5a9b7ae922830c5bdb83e2f182d1b52.tar.gz null-browser-b41d47d1f5a9b7ae922830c5bdb83e2f182d1b52.zip | |
Make hints generic and handleable via lua
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/javascript/hints.js | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/assets/javascript/hints.js b/assets/javascript/hints.js index ce958f2..9110815 100644 --- a/assets/javascript/hints.js +++ b/assets/javascript/hints.js @@ -50,6 +50,8 @@ labelsRoot: null, /** @type {boolean} */ openInNewView: false, + /** @type {Match | null} */ + currentMatch: null, stop() { hints.matches = []; @@ -95,29 +97,16 @@ if (hints.matches.length === 0) { hints.stop() - return true + return false } if (hints.matches.length === 1) { - const match = hints.matches[0] + hints.currentMatch = hints.matches[0] hints.stop(); - if (!match) { - console.log(hints.matches); - return true; - } - if (match.elem?.href) { - if (hints.openInNewView) { - window.open(match.elem?.href) - } else { - location.href = match.elem?.href - } - } else { - match.elem?.click() - } return true } - return false + return null }, /** @param selector {string} */ |
