Last active
August 29, 2015 13:57
-
-
Save Geruhn/9809298 to your computer and use it in GitHub Desktop.
Ctrl + M becomes a shortcut to the search bar of the site.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Search Shortcut | |
// @namespace andyperdana.de | |
// @version 0.3 | |
// @description Ctrl+M is goToSearch | |
// @include /^https?://(www\.)?.*\..*/ | |
// @exclude http://update001.maminfra.bs.kae.de.server.lan/updatetool/* | |
// @downloadUR https://gist.githubusercontent.com/Geruhn/9809298/raw/0d3fee8c6da586650572a1e28054fb6833ab41c6/search_shortcut.user.js | |
// @copyright 2012+, You | |
// @homepage https://gist.githubusercontent.com/Geruhn/9809298/raw/9577bc50e2d058986afa8b831905c23ed79973e7/search_shortcut.user.js | |
// ==/UserScript== | |
document.addEventListener('DOMContentLoaded', function() { | |
d = document; | |
document.q = document.querySelector; | |
document.addEventListener('keydown', function(event) { | |
if(event.ctrlKey && event.keyCode===77) { | |
var search = d.q('input[type=search]') || d.q('input[id*=search]') || d.q('input[id*=Search]') || d.q('input[class*=search]') || d.q('input[class*=Search]') || d.q('input[name*=query]') || d.q('input[name*=Query]'); | |
search.focus(); | |
} | |
}, false); | |
}, false); | |
//test123 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment