Penny-Arcade Forums Tab-Index Fix

Temp fix for tabbing issue on the forums

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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();
        }
    }
})();