This has been bugging me for years. Thanks to ChatGPT and tampermonkey extension I can now quickly get to the search box using /
Code:
// ==UserScript==
// @name Zabbix Search Hotkey (/)
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Focus the Zabbix search box when pressing /
// @author You
// @match https://zabbix.mydomain.com/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
document.addEventListener('keydown', function (e) {
// Don't interfere with typing in an input or textarea
if (['INPUT', 'TEXTAREA'].includes(document.activeElement.tagName)) return;
// Pressing "/" key
if (e.key === '/') {
e.preventDefault();
const searchInput = document.querySelector('#search');
if (searchInput) {
searchInput.focus();
searchInput.select(); // Optional: select existing text
} else {
console.warn("Search input not found.");
}
}
});
})();
