splix-js-demodularizer

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

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/478491/1377223/splix-js-demodularizer.js

  1. // ==UserScript==
  2. // @name splix-js-demodularizer
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2.3
  5. // @description A vile trick that may aid you in executing your beloved scripts in the novel version of the client
  6. // @author You
  7. // @match https://splix.io/
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=splix.io
  9. // @grant none
  10. // @run-at document-start
  11. // ==/UserScript==
  12.  
  13. await (async function() {
  14. 'use strict';
  15.  
  16. function isAlreadyInjected() {
  17. for (let s of document.getElementsByTagName("script"))
  18. if (s.innerText.includes("globalThis.IS_DEV_BUILD"))
  19. return true;
  20. return false;
  21. }
  22.  
  23. if (window.jsDemodularized || isAlreadyInjected() || document.location.pathname !== "/") return;
  24.  
  25. const version = "0.2.3";
  26. const demodularizerVersion = localStorage.getItem("demodularizerVersion");
  27. const clientCode = localStorage.getItem("clientCode");
  28.  
  29. if (demodularizerVersion === version) {
  30. document.open("text/html");
  31. document.write(clientCode);
  32. document.close();
  33. window.jsDemodularized = true;
  34. } else {
  35. window.stop();
  36.  
  37. async function getContent(path) {
  38. let response = await fetch("https://raw.githubusercontent.com/jespertheend/splix/d41be0f6f4eba6be4e4cda2138452d5389311a07/client/" + path);
  39. return response.text();
  40. }
  41.  
  42. const globals = (await getContent("src/globals.js")).replace("IS_DEV_BUILD = true", "IS_DEV_BUILD = false");
  43. const serverSelection = (await getContent("src/network/serverSelection.js")).replaceAll("export ", "");
  44. const main = "'use strict';\n" + globals + serverSelection + (await getContent("src/main.js")).replace(/.*/, "").substr(1).replace(/.*/, "").substr(1);
  45. const html = (await getContent("index.html")).substr(1).replace(/.*/, "").substr(1).replace(/<script.*?\/main.*?<\/script>/, "").replace("</body>", `<script>${main}</script></body>`)
  46.  
  47.  
  48. localStorage.setItem("clientCode", html);
  49. localStorage.setItem("demodularizerVersion", version);
  50. location.reload();
  51. }
  52. })();