// ==UserScript==
// @name Hotkey submit
// @namespace None
// @include http://forum.allaboutcircuits.com/*.php*
// @require http://code.jquery.com/jquery-latest.pack.js
// @version 1
// ==/UserScript==
/*More keycodes at:
http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes*/
var keys = {};
var modifier = 17; //Ctrl
var key = 13; //Enter
$(document.body).keydown(function (evt)
{
keys[evt.keyCode] = true;
var url = document.URL;
if(keys[modifier] && keys[key])
{
//Clear focus by focusing and blurring a random element
var element = $("*").get(0);
element.focus();
element.blur();
//Hit submit button
var link;
if(url.indexOf("forumdisplay") > -1)
link = $("a[href^='newthread.php']")[0];
else if(url.indexOf("showthread") > -1)
link = $("a[href^='newreply.php']")[0];
link.click();
keys[modifier] = keys[key] = false;
}
});
$(document.body).keyup(function (evt)
{
keys[evt.keyCode] = false;
});
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
J | Warning: Enter at your own risk | Feedback and Suggestions | 9 | |
How to 'enter' as soon as you press a key? | Programming & Languages | 17 | ||
A | AVR dragon unable to enter programming mode | Microcontrollers | 1 | |
T | AVR - Failed to enter programming mode. | Microcontrollers | 2 | |
How to improve this # enter - ATmega uC | Microcontrollers | 13 |
by Jake Hertz
by Aaron Carman
by Robert Keim