MediaWiki:Gadget-searchFocus.js

if (wgPageName == "Main_Page") { addOnloadHook(function {       document.getElementById("searchInput").focus;    }); }