Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible To Override JS Files? #585

Closed
JonJon565 opened this issue Nov 17, 2023 · 3 comments
Closed

Possible To Override JS Files? #585

JonJon565 opened this issue Nov 17, 2023 · 3 comments

Comments

@JonJon565
Copy link

image
is it possible to override or edit files like i already made my script for firefox and chrome but i dont know if its possible i use
mutationsList.forEach on chrome to get the node and call a patch script which patches the file and uses it

 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);
            });
    }
@ACTCD
Copy link
Collaborator

ACTCD commented Nov 17, 2023

This is not how this extension works.

Please read the Tutorials for writing user scripts.

@ACTCD ACTCD closed this as completed Nov 17, 2023
@JonJon565
Copy link
Author

any way to replicate it for IOS?

@ACTCD
Copy link
Collaborator

ACTCD commented Nov 18, 2023

Please read the project README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@JonJon565 @ACTCD and others