all repos — searchix @ 03fa0eb00aef448bec05280a121c659a600fc13f

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat(js): allow opening details in new tab/window
Alan Pearce alan@alanpearce.eu
Sat, 22 Mar 2025 18:04:54 +0100
commit

03fa0eb00aef448bec05280a121c659a600fc13f

parent

4554d524916e48b18b4c669fe64bc8d54a148c59

1 files changed, 11 insertions(+), 7 deletions(-)

jump to
M frontend/static/search.jsfrontend/static/search.js
@@ -33,11 +33,13 @@ *  * @param {MouseEvent} ev
  */
 function openSiblingDialog(ev) {
-  const dialog = ev.target.nextElementSibling;
-  dialog.showModal();
-  dialog.querySelector("button").addEventListener("click", function () {
-    dialog.close();
-  });
+  if (!(ev.shiftKey || ev.altKey || ev.ctrlKey || ev.metaKey)) {
+    const dialog = ev.target.nextElementSibling;
+    dialog.showModal();
+    dialog.querySelector("button").addEventListener("click", function () {
+      dialog.close();
+    });
+  }
 }
 
 /**
@@ -210,8 +212,10 @@ /**  * @param {MouseEvent} ev
  */
 function handleDialogOpen(ev) {
-  getDetail(new URL(ev.target.href));
-  ev.preventDefault();
+  if (!(ev.ctrlKey || ev.metaKey || ev.shiftKey || ev.altKey)) {
+    getDetail(new URL(ev.target.href));
+    ev.preventDefault();
+  }
 }
 
 if (state.opened.length > 0) {