cntrl + enter hotkey

Discussion in 'Feedback and Suggestions' started by magnet18, Apr 21, 2013.

  1. magnet18

    Thread Starter Senior Member

    Dec 22, 2010
    1,232
    124
    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??
     
  2. WBahn

    Moderator

    Mar 31, 2012
    17,747
    4,796
    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.
     
  3. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    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?
     
  4. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    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!


    Code ( (Unknown Language)):
    1. // ==UserScript==
    2. // @name        Hotkey submit
    3. // @namespace   None
    4. // @include     http://forum.allaboutcircuits.com/*.php*
    5. // @require     http://code.jquery.com/jquery-latest.pack.js
    6. // @version     1
    7. // ==/UserScript==
    8.  
    9. /*More keycodes at:
    10.     http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes*/
    11.    
    12. var keys = {};
    13. var modifier = 17; //Ctrl
    14. var key = 13;      //Enter
    15.  
    16. $(document.body).keydown(function (evt)
    17. {
    18.     keys[evt.keyCode] = true;
    19.     var url = document.URL;
    20.    
    21.     if(keys[modifier] && keys[key])
    22.     {
    23.         //Clear focus by focusing and blurring a random element
    24.         var element = $("*").get(0);
    25.         element.focus();
    26.         element.blur();
    27.        
    28.         //Hit submit button
    29.         var link;
    30.         if(url.indexOf("forumdisplay") > -1)
    31.             link = $("a[href^='newthread.php']")[0];
    32.         else if(url.indexOf("showthread") > -1)
    33.             link = $("a[href^='newreply.php']")[0];
    34.  
    35.         link.click();
    36.        
    37.         keys[modifier] = keys[key] = false;
    38.     }
    39. });
    40.  
    41. $(document.body).keyup(function (evt)
    42. {
    43.     keys[evt.keyCode] = false;
    44. });
     
  5. magnet18

    Thread Starter Senior Member

    Dec 22, 2010
    1,232
    124
    schweet, thanks, ive never heard of greasemonkey

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