Greasy Fork is available in English.

Accurate Korone 2017 Userscript

Use this alongside the userstyle.

Você precisará instalar uma extensão como Tampermonkey, Greasemonkey ou Violentmonkey para instalar este script.

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

Você precisará instalar uma extensão como Tampermonkey ou Violentmonkey para instalar este script.

Você precisará instalar uma extensão como Tampermonkey ou Userscripts para instalar este script.

Você precisará instalar uma extensão como o Tampermonkey para instalar este script.

Você precisará instalar um gerenciador de scripts de usuário para instalar este script.

(Eu já tenho um gerenciador de scripts de usuário, me deixe instalá-lo!)

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

(Eu já possuo um gerenciador de estilos de usuário, me deixar fazer a instalação!)

// ==UserScript==
// @name         Accurate Korone 2017 Userscript
// @namespace    https://pekora.zip/
// @version      2.5
// @description  Use this alongside the userstyle.
// @match        *://www.pekora.zip/*
// @run-at       document-start
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    // roblox favicon
    const ICON_DATA =
        "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAADfUlEQVRoge2ZPWscVxSGn7OIoMqIYIJ3ilFxXSTGDmYLmRiz1gcYVUmfwv4HNvkpSe3GBv+AuEklrViMTUQQxja2EJqQnWIkhAuhSgihk+Jewcbanblnd+QPsg9so71zz3nnHp2PuzBhwoT/H7lLktw1G5/aDwCxPtBzzWlBXiuAaleEFZBnQJ5mRe0OVmEWkLukBfwJTPX9+QjYRllDWAG6aVa8r8nHUkYRcB/4tWLZCfBKYVWgAzxX2J/NipNRnCzDJKDnmgjyO/Cj0c4hsAF0FVYENkD302xnbEFGAckFgXdAMqbdfeAlaAdkFfSNP6Ed80YmAblL5hReCNSagRT2BN0A6QBrCpugBzGCpipX/Jf5up0HEPgGZBlYVjgR2AX5K3fJCvBM0bez2c7hkGfj8PHPH8HQx+QY+Ae4nWbFmTwd/TYFZhRp1ehYLFMKgO4O/DJ+H7nqj/oToNpN/x6csQzxrIt1+WPFV/vBRAnwfY8s1OeSiaPQqgwk8gRkBrhek0NWtoF82JdRAhRawExdHplQ1sqaxCgBAktGs7uKPgbdxKfB0SmJf4jIQj2XNIC20eyqIPeAaUVTQdqgCyCLwCXDPidAt2xBpQDxoWPN/51w7IfAFrCVu+Qh6COQu4Z9XlW15TEhdBOYNhg9VvTMW1OYBpkz7IPCatWaSgEK1vS5LciZrCGQApctG4VZopRKAQLWAraOD50PaWNrHg+B51WLSjfMXXIR+N5gFIU7wJPcJR38P2AenLFmsg31c0MpVW+kjbF9Fp9lfg6fY3whWgfmLfsA3ZgRtFyAsmSfms/s/234mFDK83+/gYHkLgH7W6uLfT83V1MWHuasUSMvQSvjH0oF6C3gq5ocMqKd2BuLoQJUzVmjRqSygJ0yUEDumg1ErP1PLSjsgb6JXT/kBORSSD7jdZIjIGhU/j9loIA0KwpFrwE3gF+Ap0Chvjs8Z6RjueCKyvI91wTkgvh8Ph9a4xY1D/nhTuiHNCvWY58ZqUyFO9KvgSsoiyosiB85x53aCoXvZrPiIPaB8epsIAz9p3PDEr4FaWFrwwGeKvpT7SFkpeeSRhiEbqrqAiKL4pvCqr7qQZoVv1lsnYuAQYTOto0/oXl8le8vlMfAjTQrolqIUz6agH5Cn5WC3lJlSULNUfTasEvcz5rcNRu5S8b9zWHChAlfIv8COF4K9z5vL4UAAAAASUVORK5CYII=";

    function setIcon() {
        let link = document.querySelector("link[rel~='icon']");
        if (!link) {
            link = document.createElement("link");
            link.rel = "icon";
            document.head.appendChild(link);
        }
        if (link.href !== ICON_DATA) {
            link.href = ICON_DATA;
        }
    }

    // roblox title name
    function fixTitle() {
        let t = document.title;

        if (t.includes("Korone")) {
            t = t.replace("Korone", "ROBLOX");
        }

        // remove usernames from profile titles
        t = t.replace(/^.+?'s\s+Profile\b/i, "Profile");

        if (document.title !== t) {
            document.title = t;
        }
    }

    // roblox loading
    function fixLoadingText() {
        const walker = document.createTreeWalker(
            document.body,
            NodeFilter.SHOW_TEXT,
            null,
            false
        );

        let node;
        while ((node = walker.nextNode())) {
            if (node.nodeValue.includes("Korone is now loading. Get ready!")) {
                node.nodeValue = node.nodeValue.replace(
                    "Korone is now loading. Get ready!",
                    "ROBLOX is now loading. Get ready to play!"
                );
            }
        }
    }

    // make homepage avatars use full body instead of headshot
    function fixFriends() {
        function run() {
            const list = document.querySelector("ul[class^='friendsList']");
            if (!list) return;

            const headshots = list.querySelectorAll("img[src*='_headshot']");
            if (headshots.length === 0) return;

            headshots.forEach(img => {
                img.src = img.src.replace("_headshot", "_thumbnail");
            });
        }

        function start() {
            run();

            const obs = new MutationObserver(() => {
                run();
            });

            obs.observe(document.body, { childList: true, subtree: true });
        }

        if (document.body) {
            start();
        } else {
            document.addEventListener("DOMContentLoaded", start);
        }
    }

    fixFriends();

    function applyBasics() {
        setIcon();
        fixTitle();
    }

    // accurate navigation
    document.addEventListener("click", function (e) {
        const a = e.target.closest("a");
        if (!a || !a.href) return;

        if (
            e.defaultPrevented ||
            e.button !== 0 ||
            e.ctrlKey ||
            e.metaKey ||
            e.shiftKey ||
            e.altKey ||
            a.target === "_blank" ||
            a.hasAttribute("download")
        ) return;

        const cur = new URL(location.href);
        const next = new URL(a.href, location.origin);

        if (cur.pathname === next.pathname) return;

        e.preventDefault();
        e.stopImmediatePropagation();
        location.href = next.href;
    }, true);

    // source sans font
    function addFont() {
        const style = document.createElement("style");
        style.textContent = `
@font-face {
    font-family: "Source Sans Pro";
    src: url("https://fonts.gstatic.com/s/sourcesanspro/v9/ODelI1aHBYDBqgeIAH2zlBM0YzuT7MdOe03otPbuUS0.woff") format("woff");
    font-weight: 400;
}
@font-face {
    font-family: "Source Sans Pro";
    src: url("https://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGJ6-ys_j0H4QL65VLqzI3wI.woff") format("woff");
    font-weight: 600;
}
@font-face {
    font-family: "Source Sans Pro";
    src: url("https://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGFkQc6VGVFSmCnC_l7QZG60.woff") format("woff");
    font-weight: 700;
}
html, body, * {
    font-family: "Source Sans Pro", sans-serif !important;
}
        `;
        document.head.appendChild(style);
    }

    // keep fixes applied
    const mainObs = new MutationObserver(() => {
        applyBasics();
        fixLoadingText();
    });

    mainObs.observe(document.documentElement, {
        childList: true,
        subtree: true
    });

    // links
    (function () {
        'use strict';
        function updateLinks() {
            const links = document.querySelectorAll('a.linkEntry-0-2-15.nav-link.active.pt-0');

            links.forEach(link => {
                const href = link.getAttribute("href");
                const text = link.textContent.trim();

                if (href === "/develop" && text === "Create") {
                    link.textContent = "Develop";
                }
            });
        }

        if (document.readyState === 'loading') {
            document.addEventListener("DOMContentLoaded", updateLinks);
        } else {
            updateLinks();
        }

        const observer = new MutationObserver(updateLinks);
        observer.observe(document.body, { childList: true, subtree: true });
    })();


    // favourite label
    (function () {

        function syncFavoriteLabel() {
            const stats = document.querySelector('[class^="gameStatsContainer-"]');
            const label = document.querySelector('[class^="favoriteLabel-"]');

            if (!stats || !label) return;

            const rows = stats.querySelectorAll('[class^="gameStat-"]');

            for (const row of rows) {
                const statLabel = row.querySelector('[class^="gameStatLabel-"]');
                if (!statLabel) continue;

                if (statLabel.textContent.trim() === "Favorites") {
                    const value = row.querySelector('[class^="gameStatStat-"]');
                    if (!value) return;

                    const count = value.textContent.trim();

                    if (label.textContent !== count) {
                        label.textContent = count;
                    }

                    break;
                }
            }
        }

        const obs = new MutationObserver(() => {
            syncFavoriteLabel();
        });

        obs.observe(document.body, {
            childList: true,
            subtree: true,
            characterData: true
        });

    })();

    fixLoadingText();
    applyBasics();

    document.addEventListener("DOMContentLoaded", addFont);

})();