Braains.io Assistant

Allows you to toggle shop & chat window with keyboard. More coming idk when.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Braains.io Assistant
// @icon         http://i.imgur.com/Uty76J1.png
// @namespace    https://greasyfork.org/users/90770
// @version      0.11
// @description  Allows you to toggle shop & chat window with keyboard. More coming idk when.
// @author       n0thing
// @match        http://braains.io/*
// @grant        none
// @run-at  document-end
// ==/UserScript==
(function() {
    'use strict';
    window.addEventListener('load', function() { //run script on page load
        var check = false,
            keyShop = 32, //toggle shop key 32 = SPACEBAR
            keyChat = 69, //toggle chat key 69 = E
            enableChat = true,
            enableShop = true;

        document.getElementById('message').onblur = function() {
            check = false;
        }; //chat DOESN'T have focus
        document.getElementById('message').onfocus = function() {
            check = true;
        }; //chat HAS focus

        document.body.addEventListener('keyup', function() {

            //toggle shop
            if (parseInt(event.keyCode) === keyShop&&enableShop === true&&check === false) {
                if (document.getElementById('modd-shop-modal').getAttribute('style') === 'display: block;') { //checks if shop is open
                    document.getElementById('modd-shop-modal').click();
                } // if yes, close it
                else {
                    document.getElementById('modd-shop-div').getElementsByTagName('button')[0].click();
                } //else, open it
            }

            //toggle chat
            if (parseInt(event.keyCode) === keyChat&&enableChat === true&&check === false) {
                if (document.getElementById('chat-box').getAttribute('style') === 'bottom: 0px; display: none') { //if hidden
                    document.getElementById('chat-box').setAttribute('style', 'bottom: 0px; display: block');
                } //then make it appear
                else {
                    document.getElementById('chat-box').setAttribute('style', 'bottom: 0px; display: none');
                } //else hide it
            }

            if (parseInt(event.keyCode) === 0 &&check === false){
                var z = 4;while(z--){document.getElementById('confirm-purchase-button').click();}}
        });
    }, true);
})();