Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Bloxd.io X-ray
- // @namespace JonJon565
- // @match https://bloxd.io/*
- // @grant none
- // @version 1.0
- // @author JonJon565
- // @description X-ray for Bloxd.io
- // @run-at document-start
- // @icon https://bloxd.io/favicon-32x32.png
- // ==/UserScript==
- (() => {
- const replacementsArr = ['stone', 'stone_andesite', 'stone_diorite', 'messy_stone'];
- let URL = null;
- function patchNode(node) {
- console.log("Starting Patch For", node.src);
- node?.remove();
- fetch(node.src)
- .then(res => res.text())
- .then(text => {
- replacementsArr.forEach(word => {
- try {
- const toReplace = `("${word}"),`;
- const replacement = `${toReplace}transTex: !0,`;
- text = text.replaceAll(toReplace, replacement);
- console.log("Replacement Success!", word, toReplace, replacement);
- } catch(e) {
- console.error("Error With Replacement: ", word, e.message);
- }
- });
- const newNode = document.createElement('script');
- newNode.innerHTML = text;
- document.body.appendChild(newNode);
- });
- }
- new MutationObserver(mutationsList => {
- if(URL === null) {
- const thirdScriptSrc = document.querySelector('body script:nth-of-type(3)')?.src;
- if(!thirdScriptSrc) return;
- URL = thirdScriptSrc;
- }
- mutationsList.forEach(mutationRecord => {
- [...mutationRecord.addedNodes]
- .filter(node => node.tagName === 'SCRIPT' && node.src.includes(URL))
- .forEach(node => patchNode(node));
- });
- }).observe(document, { childList: true, subtree: true });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement