From 8871faaef00c32ad4ba023331147b4d9ffe19070 Mon Sep 17 00:00:00 2001 From: Alvie Rahman Date: Tue, 24 Aug 2021 15:36:03 +0100 Subject: [PATCH] Open link article in new tab if user presses shift+enter --- search.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/search.js b/search.js index 5baeab3..1bbc50a 100644 --- a/search.js +++ b/search.js @@ -68,9 +68,15 @@ function updateResults() { } searchBar.addEventListener('keyup', e => { + console.log(e) // if user pressed enter if (e.keyCode === 13) { + if (e.shiftKey) { + window.open(results[0].item.path, '_blank') + } else { window.location.href = results[0].item.path + } + return } updateResults() })