L
L
legatobrown2022-01-12 12:49:46
Google Chrome
legatobrown, 2022-01-12 12:49:46

How can I change the browser extension settings myself?

https://chrome.google.com/webstore/detail/x%CE%BBl...

Here is an extension for Chrome, can I somehow change which words to replace with my own? The extension file is located in the %localappdata%\Google\Chrome\User Data\Default\Extensions folder. I found the replace.js file there, but if you replace the text there, the extension continues to work as it was. How to make the changes in the extension file applied?

var doFilter = function(textNode) {
    textNode.data = textNode.data.replace('Васи', 'Лоха');
    textNode.data = textNode.data.replace('Вася', 'Лох');
    textNode.data = textNode.data.replace('Васи', 'Лох');
    textNode.data = textNode.data.replace('Васька', 'Лох');
}

var observer = new MutationObserver(function(mutations) {
    mutations.forEach(function(mutation) {
        if (mutation.addedNodes) {
            [].slice.call(mutation.addedNodes).forEach(function(node) {
                if (node.nodeName.toLowerCase() == "#text") {
                    doFilter(node);
                }
            });
        }
    });
});

observer.observe(document, {
    childList: true,
    subtree:   true
});```

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2022-01-12
@legatobrown

1) Copy the extension folder (for example, to the desktop)
2) Edit the replace.js file:

var doFilter = function(textNode) {

    textNode.data = textNode.data.replace('legatobrown', 'legatobrown_лох');
}
3) Go to extensions and turn on developer mode
4) Click "Load unpacked extension" and specify the extension folder
5) After each edit, you need to click "update" in extensions
61deaa0a69a46078278656.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question