cntrl + enter hotkey

Thread Starter

magnet18

Joined Dec 22, 2010
1,227
how hard would it be to set control and enter to automatically "submit new thread", or "submit new post", same way outlook and everyone else does it??
 

WBahn

Joined Mar 31, 2012
30,076
My guess is that it won't happen any time soon. I doubt the mods have the necessary access to make such a change and my understanding is that the admins currently are very hands off, meaning that they are only in a position to do the absolute minimum that is necessary to keep the board alive.
 

Georacer

Joined Nov 25, 2009
5,182
Hey, WBahn picks up fast!

However, you can do it from your side too. I 'm not sure on the specifics, but you should be able to write a Greasemonkey script that captures the shortkey and then clicks the link on the page.

I 'll ask Filox about it. What browser are you using?
 

Georacer

Joined Nov 25, 2009
5,182
Filox delivers!

Firefox Users do the following:
1. Install the Greasemonkey Add On for Firefox.
2. Copy ALL of the code below, provided in code tags, including overhead comments.
3. Hit Alt to display the Menu bar in your browser. Go to Tools->Greasemonkey->New User Script.
4. Hit Use Script From Clipboard button.

You are done! Each time you are in a subforum, viewing the thread list, hitting Ctrl+Enter will bring up the New Thread screen.
Each time you are in a thread, hitting Ctrl+Enter will bring up the Advanced Reply screen.

Chrome users will probably have a similar procedure available with Tampermonkey.

DISCLAIMER: The following code is provided as is and you are not to hold its author responsible for any events that should happen to your machine after its installation.

Other than that, I have installed it in my browser and works like a charm.

Thanks, Filox!


Rich (BB code):
// ==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

magnet18

Joined Dec 22, 2010
1,227
schweet, thanks, ive never heard of greasemonkey

and yea, i figured it was out of bounds, but never hurts to ask :)
 
Top