Join Blocked Player

Join Roblox players who are blocking you.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Join Blocked Player
// @namespace    tomohiror.f5.si
// @version      2.2
// @description  Join Roblox players who are blocking you.
// @author       tomohiror
// @license      MIT
// @match        https://www.roblox.com/users/*
// @icon         https://github.com/tomohiror.png
// @connect      presence.roblox.com
// @grant        GM.xmlHttpRequest
// @grant        unsafeWindow
// @run-at       document-end
// @noframes
// ==/UserScript==

const ALT_ROBLOSECURITY = "<your alt .ROBLOSECURITY here>";

(async () => {
    'use strict';

    const targetUserId = Number.parseInt(location.pathname.split("/")[2], 10);
    if (targetUserId == unsafeWindow.Roblox.CurrentUser.userId) {
        return;
    }

    const mainPromise = unsafeWindow.RobloxPresence.getPresenceProvider().getPresences([targetUserId]);
    const response = await GM.xmlHttpRequest({
        method: "POST",
        url: "https://presence.roblox.com/v1/presence/users",
        data: JSON.stringify({ userIds: [targetUserId] }),
        cookie: ".ROBLOSECURITY=" + ALT_ROBLOSECURITY,
        anonymous: true,
        responseType: "json"
    });
    console.log("JBP fetch", response);
    if (!(200 <= response.status && response.status <= 299)) {
        console.error("JBP fetch fail");
        return;
    }
    const altPresence = response.response.userPresences[0];

    (async () => {
        const mainPresence = (await mainPromise)[0];
        if (altPresence.userPresenceType > mainPresence.userPresenceType) {
            console.log("JBP set status");
            const e = new CustomEvent("Roblox.Presence.Update",
                { detail: new Map().set(targetUserId, altPresence) });
            document.dispatchEvent(e);
        }
    })();

    if (!(altPresence.placeId && altPresence.gameId)) {
        return;
    }
    for (const container of document.getElementsByClassName("button-container")) {
        const addJoin = (_record, observer) => {
            if (!container.nextElementSibling ||
                container.querySelector("#user-profile-header-JoinExperience, #user-profile-header-JoinBlocked")) {
                return;
            }
            observer?.disconnect();

            console.log("JBP add join");
            const btn = document.createElement("button");
            btn.style.width = "100%";
            btn.classList.add("btn-primary-md", "focus-visible:outline-focus");
            btn.id = "user-profile-header-JoinBlocked";
            btn.innerText = "Join Blocked Player";
            btn.addEventListener("click", () => {
                unsafeWindow.Roblox.GameLauncher.joinGameInstance(altPresence.placeId, altPresence.gameId);
            });
            container.insertBefore(btn, container.firstElementChild);
        };
        addJoin();
        new MutationObserver(addJoin).observe(container.parentElement, { childList: true });
    }
})();