SEO toggle

Standard Enabled Offline toggle

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        SEO toggle
// @namespace   https://greatest.deepsurf.us/users/843419
// @match       https://www.roblox.com/*
// @grant       GM_setValue
// @grant       GM_getValue
// @version     1.0
// @author      Zgoly
// @description Standard Enabled Offline toggle
// @license     MIT
// ==/UserScript==

let toggled = GM_getValue('toggled', false)

Roblox.Lang.SEO = {}

if (Roblox.ProtocolHandlerClientInterface.gameLocale == 'ru_ru') {
    Roblox.Lang.SEO.Enabled = "СВО активирован"
    Roblox.Lang.SEO.Disabled = "СВО деактивирован"
} else {
    Roblox.Lang.SEO.Enabled = "SEO activated"
    Roblox.Lang.SEO.Disabled = "SEO deactivated"
}

const customDiv = document.createElement("div")
customDiv.classList.add("custom")

const alertSystemFeedback = document.createElement("div")
alertSystemFeedback.classList.add("alert-system-feedback")

const alertSuccess = document.createElement("div")
alertSuccess.classList.add("alert", "alert-success")

const alertContent = document.createElement("span")
alertContent.classList.add("alert-content")

alertSuccess.appendChild(alertContent)
alertSystemFeedback.appendChild(alertSuccess)
customDiv.appendChild(alertSystemFeedback)

document.body.appendChild(customDiv)

function showMessage(toggled) {
    alertContent.textContent = toggled ? Roblox.Lang.SEO.Enabled : Roblox.Lang.SEO.Disabled
    alertSuccess.classList.remove("alert-success", "alert-warning")
    alertSuccess.classList.add("on", toggled ? "alert-success" : "alert-warning")
    setTimeout(function () {
        alertSuccess.classList.remove("on")
    }, 2000)
}

document.addEventListener("keydown", e => {
    if (e.code == 'KeyG') {
        fetch("https://apis.roblox.com/user-settings-api/v1/user-settings", { "credentials": "include" })
            .then(response => response.json())
            .then(data => {
                const toggled = data.whoCanJoinMeInExperiences == "Friends"
                showMessage(toggled)

                fetch("https://apis.roblox.com/user-settings-api/v1/user-settings", {
                    "headers": {
                        "content-type": "application/json;charset=UTF-8",
                        "x-csrf-token": Roblox.XsrfToken.getToken()
                    },
                    "body": JSON.stringify({ "whoCanJoinMeInExperiences": toggled ? "NoOne" : "Friends" }),
                    "method": "POST",
                    "credentials": "include"
                })
            })
    }
})