Q
Q
Quqas2021-08-17 20:22:50
Ad blocking
Quqas, 2021-08-17 20:22:50

Ublock, how to create a rule on the presence of text to delete this text?

How to filter by text but not the element, but only the text itself. Example: <p>мама мыла раму</p>
How to create a filter by the word мыла? And to get<p>мама раму</p>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
dollar, 2021-08-18
@dollar

This is not possible with an ad blocker .
But you can put a smarter (and more complex) extension that allows you to add custom JS scripts to the site. For example, Tampermonkey . After that, you can change the content and design of the site as you like. True, you will need to know how to program.

Q
Quqas, 2021-09-23
@Quqas

having attacked Google with renewed vigor, I was lucky to find and understand how to screw it into tampermonkey
https://stackoverflow.com/questions/7275650/javasc...

// create a TreeWalker of all text nodes
var allTextNodes = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT),
    // some temp references for performance
    tmptxt,
    tmpnode,
    // compile the RE and cache the replace string, for performance
    cakeRE = /cake/g,
    replaceValue = "pie";

// iterate through all text nodes
while (allTextNodes.nextNode()) {
    tmpnode = allTextNodes.currentNode;
    tmptxt = tmpnode.nodeValue;
    tmpnode.nodeValue = tmptxt.replace(cakeRE, replaceValue);
}

but here is an example for 1 word\phrase, it remains to understand how to modify it so that it searches for several without producing scripts

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question