splix-js-demodularizer

A vile trick that may aid you in executing your beloved scripts in the novel version of the client

As of 2023-11-16. See the latest version.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/478491/1281566/splix-js-demodularizer.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         splix-js-demodularizer
// @namespace    http://tampermonkey.net/
// @version      0.2.1
// @description  A vile trick that may aid you in executing your beloved scripts in the novel version of the client
// @author       You
// @match        https://splix.io/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=splix.io
// @grant        none
// @run-at       document-start
// ==/UserScript==

await (async function() {
    'use strict';

    if (window.jsDemodularized || document.location.pathname !== "/") return;

    const version = "0.2.0";
    const demodularizerVersion = localStorage.getItem("demodularizerVersion");
    const clientCode = localStorage.getItem("clientCode");

    if (demodularizerVersion === version) {
        document.open("text/html");
        document.write(clientCode);
        document.close();
        window.jsDemodularized = true;
    } else {
        window.stop();

        async function getContent(path) {
            let response = await fetch("https://raw.githubusercontent.com/jespertheend/splix/2849a9e86b491d3835e77d32d0e2d967ef9609c4/client/" + path);
            return response.text();
        }

        const globals = (await getContent("src/globals.js")).replace("IS_DEV_BUILD = true", "IS_DEV_BUILD = false");
        const serverSelection = (await getContent("src/network/serverSelection.js")).replaceAll("export ", "");
        const main = "'use strict';\n" + globals + serverSelection + (await getContent("src/main.js")).replace(/.*/, "").substr(1).replace(/.*/, "").substr(1);
        const html = (await getContent("index.html")).substr(1).replace(/.*/, "").substr(1).replace(/<script.*?\/main.*?<\/script>/, "").replace("</body>", `<script>${main}</script></body>`)


        localStorage.setItem("clientCode", html);
        localStorage.setItem("demodularizerVersion", version);
        location.reload();
    }
})();