您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Always set input focus to the search textbox
// ==UserScript== // @name Google search box auto-focus // @namespace http://tampermonkey.net/ // @version 0.1 // @description Always set input focus to the search textbox // @author Matt Blais // @include http*://www.google.*/* // @exclude http*://www.google.com/recaptcha/* // @include http*://www.google.co*.*/* // @include http*://news.google.*/* // @include http*://encrypted.google.*/* // @grant none // ==/UserScript== // Focus the search box whenever the page becomes active/focused (function() { 'use strict' var fo = function () { var inp = document.getElementsByTagName("input") if( inp && inp.length > 2 ) { inp[2].focus() // Select all text in box inp[2].select() // Collapse the search combobox var cbdd = document.getElementsByClassName('UUbT9') if (cbdd.length) { window.setTimeout(function() { cbdd[0].style.display = 'none' }, 20) } } } window.addEventListener('focus', fo) fo() }() )