Penny-Arcade Forums Tab-Index Fix

Temp fix for tabbing issue on the forums

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Penny-Arcade Forums Tab-Index Fix
// @namespace    https://greasyfork.org/en/users/162009-delmain
// @author       delmain
// @version      0.3.0
// @description  Temp fix for tabbing issue on the forums
// @match        https://forums.penny-arcade.com/discussion/*
// @match        https://forums.penny-arcade.com/messages/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    $(document).ready(function() {
        $('.TextBoxWrapper').on('keydown', 'textarea', moveToSubmitHandler);
    });

    $(document).on('EditCommentFormLoaded', function(event, element) {
        $(element).find('.TextBoxWrapper').on('keydown', 'textarea', moveToSubmitHandler);
    });

    function moveToSubmitHandler(e)
    {
        var target = e.target;
        var keyCode = e.keyCode || e.which;

        if (keyCode == 9) {
            e.preventDefault();
            var tg = $(target).closest('form');
            var bu = tg.find('#Form_PostComment,#Form_SendMessage,#Form_SaveComment');
            bu.focus();
        }
    }
})();