From b41d47d1f5a9b7ae922830c5bdb83e2f182d1b52 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 8 Aug 2025 11:29:30 +0530 Subject: Make hints generic and handleable via lua --- assets/javascript/hints.js | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'assets/javascript/hints.js') 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} */ -- cgit v1.3.1