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 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);
});