Blob.io - instarespawn + suicide shortcut + chat filter bypass

Press Q to suicide. Respawning is automatically done (might have to press esc). Messages are converted to bypass the chat filter.

当前为 2023-12-28 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Blob.io - instarespawn + suicide shortcut + chat filter bypass
// @namespace    http://tampermonkey.net/
// @version      3.14
// @description  Press Q to suicide. Respawning is automatically done (might have to press esc). Messages are converted to bypass the chat filter.
// @author       Me
// @author       Ryuunosuke Akasaka
// @match        https://blobgame.io/*
// @match        http*://custom.client.blobgame.io/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=blobgame.io
// @grant        none
// @license      MIT
// ==/UserScript==
var res = document.getElementById("restart-game");
var message = document.querySelector('#message');
var enterKeyEvent = new KeyboardEvent('keyup', { key: 'Enter', keyCode: 13 });

var lastExecutionTime = 0;
var delayTriggered = false;

var timeBetweenKills = 2000;
// First part of the code
async function onKeydown(e) {
    if (e.keyCode == 81) {
        var currentTime = new Date().getTime();
        var timeSinceLastExecution = currentTime - lastExecutionTime;

        if (timeSinceLastExecution >= timeBetweenKills) {
            console.log('Killing, wait is fine')
            executeKillPart();
            lastExecutionTime = currentTime; // Update the last execution time
        } else if (!delayTriggered) {
            console.log('Killing, but waiting to kill')
            await new Promise(resolve => setTimeout(resolve, timeBetweenKills - timeSinceLastExecution));
            executeKillPart();
            delayTriggered = true;
        } else {
            console.log('ignored.')
        }
    }
}

function executeKillPart() {
    // Execute the "kill" part of the code
    message.style.display = "block";
    message.value = '/kill';
    message.dispatchEvent(enterKeyEvent);
    res.style.display = "block";
    delayTriggered = false;
}

// Second part of the code
function executeSecondPart() {
    // Execute the second part of the code
    if (res.disabled) {
        res.disabled = false;
        res.click(res);
    } else {
        res.click(res);
    }
}

// Continuously check exitDialog.style.display using MutationObserver
var exitDialog = document.getElementById('exit-dialog');

if (exitDialog) {
    var observer = new MutationObserver(function (mutations) {
        mutations.forEach(function (mutation) {
            if (mutation.attributeName === 'style' && exitDialog.style.display === 'block') {
                //observer.disconnect(); // Stop observing
                executeSecondPart();
            }
        });
    });

    // Start observing
    observer.observe(exitDialog, { attributes: true });
}

// Event listener
document.addEventListener('keydown', onKeydown, true);


// Chat filter bypass
// See https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols
function replaceWithBoldScript(inputString) {
  const normalToBoldScriptMap = new Map([
    ['a', '𝐚'], ['b', '𝐛'], ['c', '𝐜'], ['d', '𝐝'], ['e', '𝐞'],
    ['f', '𝐟'], ['g', '𝐠'], ['h', '𝐡'], ['i', '𝐢'], ['j', '𝐣'],
    ['k', '𝐤'], ['l', '𝐥'], ['m', '𝐦'], ['n', '𝐧'], ['o', '𝐨'],
    ['p', '𝐩'], ['q', '𝐪'], ['r', '𝐫'], ['s', '𝐬'], ['t', '𝐭'],
    ['u', '𝐮'], ['v', '𝐯'], ['w', '𝐰'], ['x', '𝐱'], ['y', '𝐲'],
    ['z', '𝐳'],
    ['A', '𝐀'], ['B', '𝐁'], ['C', '𝐂'], ['D', '𝐃'], ['E', '𝐄'],
    ['F', '𝐅'], ['G', '𝐆'], ['H', '𝐇'], ['I', '𝐈'], ['J', '𝐉'],
    ['K', '𝐊'], ['L', '𝐋'], ['M', '𝐌'], ['N', '𝐍'], ['O', '𝐎'],
    ['P', '𝐏'], ['Q', '𝐐'], ['R', '𝐑'], ['S', '𝐒'], ['T', '𝐓'],
    ['U', '𝐔'], ['V', '𝐕'], ['W', '𝐖'], ['X', '𝐗'], ['Y', '𝐘'],
    ['Z', '𝐙']
  ]);

  return Array.from(inputString).map(char => normalToBoldScriptMap.has(char) ? normalToBoldScriptMap.get(char) : char).join('');
}

message.addEventListener('change', function(event) {
    if (message.value[0] !== '/') message.value = replaceWithBoldScript(message.value);
});