Braains.io Assistant

Braains.io

目前为 2017-08-01 提交的版本。查看 最新版本

// ==UserScript==
// @name         Braains.io Assistant
// @icon         http://i.imgur.com/Uty76J1.png
// @namespace    https://gf.qytechs.cn/users/90770
// @version      0.1
// @description  Braains.io
// @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 = 82, //toggle chat key 82 = R
            enableChat = true,
            enableShop = true;
        //todo: create seperate functions for each feature

        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() {
            //checks if chat is NOT focussed

            //toggle shop
            if (parseInt(event.keyCode) == keyShop){if (enableShop === true){
                if (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){
                if (enableChat === true){
                    if (check === false){ //checks if chat is NOT focussed
                        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
                    }}}
            // alert when round over
            // auto buy items
        });

    },true);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址