From 13be240226ec4a0d70ce3f9e26e3664036ebcbe2 Mon Sep 17 00:00:00 2001 From: Tobias O Date: Wed, 29 Oct 2025 16:30:00 +1300 Subject: [PATCH] feat: working search redirect --- templates/framework_modern.html | 24 ++++++++++++++++++++++++ templates/includes/navbar.html | 20 ++++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/templates/framework_modern.html b/templates/framework_modern.html index 06ba3ef5..c079b812 100644 --- a/templates/framework_modern.html +++ b/templates/framework_modern.html @@ -145,6 +145,30 @@ } }); + + // Global keyboard shortcut for search (Cmd+K on Mac, Ctrl+K on Windows/Linux) + document.addEventListener('keydown', function(event) { + // Check if user is typing in an input field + const activeElement = document.activeElement; + const isInputField = activeElement && ( + activeElement.tagName === 'INPUT' || + activeElement.tagName === 'TEXTAREA' || + activeElement.contentEditable === 'true' + ); + + if (isInputField) { + return; // Don't trigger shortcut when typing in input fields + } + + // Check for Cmd+K (Mac) or Ctrl+K (Windows/Linux) + const isMac = /Mac/.test(navigator.platform); + const isCorrectModifier = isMac ? event.metaKey : event.ctrlKey; + + if (isCorrectModifier && event.key === 'k') { + event.preventDefault(); + window.location.href = '/search'; + } + }); diff --git a/templates/includes/navbar.html b/templates/includes/navbar.html index b3255373..649a4734 100644 --- a/templates/includes/navbar.html +++ b/templates/includes/navbar.html @@ -27,8 +27,13 @@ + +