KG_ChatFunctions

Open and Hide chat (GameList Page && Game Page)

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!)

Advertisement:

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!)

Advertisement:

// ==UserScript==
// @name         KG_ChatFunctions
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Open and Hide chat (GameList Page && Game Page)
// @author       I am
// @include      https://klavogonki.ru/g*
// @include      http://klavogonki.ru/g*
// @grant        none
// ==/UserScript==

var space = 32; // Space Key
var hide = document.querySelector('.hide-bar');
var chatGeneral = document.querySelector('#chat-general').style.display == 'none';
var field = document.querySelectorAll('.text');

window.addEventListener('keydown', checkKeyPress, false);

function checkKeyPress(key) {

    if (key.ctrlKey && key.which == space) {
        if (chatGeneral == false) {
            hide.click();
            field[0].focus();
        }
        else if (chatGeneral == true) {
            hide.click();
            field[1].focus();
        }

    }
    else if (key.shiftKey && key.which == space) {

        if (chatGeneral == false) {
            field[0].focus();
        }
        else if (chatGeneral == true && document.querySelector('#speed-label').innerHTML == "" || document.querySelector('#speed-label').innerHTML < 1) {
            field[1].focus();
        }

    }
}