Skip to content

Instantly share code, notes, and snippets.

@gregory-seidman
Last active July 3, 2023 18:54
Show Gist options
  • Save gregory-seidman/267eabccd74c2efd5c0f16c2d223af01 to your computer and use it in GitHub Desktop.
Save gregory-seidman/267eabccd74c2efd5c0f16c2d223af01 to your computer and use it in GitHub Desktop.
GreaseMonkey/TamperMonkey script to put input focus on the search box when loading the .NET API search page
// ==UserScript==
// @name Focus .NET Search
// @namespace https://gist.github.com/gregory-seidman/dd8b7a93f4603ef3e484c82d45809a95
// @version 1.1.1
// @description Put input focus on the search box when loading the .NET API search page
// @author Gregory Seidman
// @downloadURL https://gist.github.com/gregory-seidman/267eabccd74c2efd5c0f16c2d223af01/raw/focus-dotnet-search.user.js
// @updateURL https://gist.github.com/gregory-seidman/267eabccd74c2efd5c0f16c2d223af01/raw/focus-dotnet-search.user.js
// @match https://docs.microsoft.com/en-us/dotnet/api/*
// @grant none
// ==/UserScript==
(function() {
const selector = 'form.api-search-field input[type="search"]';
function focusSearch() {
document.querySelector(selector).focus();
}
setTimeout(focusSearch, 300);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment