Bonk.io Room hide function

Adds epic room hider

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Bonk.io Room hide function
// @namespace    http://tampermonkey.net/
// @version      69
// @description  Adds epic room hider
// @author       Silly One
// @license      MIT
// @match        https://*.bonk.io/*
// @match        https://*.bonkisback.io/*
// @grant        none
// ==/UserScript==

function filterRooms(s) {
    s = s.toLowerCase();
    let matches = el => el.children[0].textContent.toLowerCase().includes(s);
    $('#roomlisttable tr').each((i, el) => {
        if (s === "") {
            el.hidden = false;
        } else {
            el.hidden = matches(el);
        }
    });
}
const inputBox = document.createElement('input');
inputBox.type = 'text';
inputBox.id = 'roomHideInputBox';
inputBox.placeholder = 'Vanish Rooms..';
inputBox.style.cssText = `
    float: right;
    padding: 2px 8px;
    margin: 5px 20px;
    border: 2px solid #006157;
    border-radius: 5px;
    font: large futurept_b1;
`;
const savedInput = localStorage.getItem('roomFilterInput');
if (savedInput) {
    inputBox.value = savedInput;
}
const topBar = document.getElementById('roomlisttopbar');
if (topBar) {topBar.appendChild(inputBox);}else{return;}

inputBox.addEventListener('keyup', ev => {
    filterRooms(ev.target.value);
    localStorage.setItem('roomFilterInput', ev.target.value);
});
const roomListObserver = new MutationObserver(() => {
    filterRooms(inputBox.value);
});
roomListObserver.observe(document.getElementById('roomlisttable'), {
    childList: true,
    subtree: true,
});
filterRooms(inputBox.value);