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

Improve 'trusted-click-element' — add an ability to click on an element containing a given text #409

Closed
Sergey-Lyapin opened this issue Feb 28, 2024 · 0 comments

Comments

@Sergey-Lyapin
Copy link

For example, to replace this rule with a scriptlet:

audioteka.com,jastrzabpost.pl,deliciousmagazine.pl,finansowysupermarket.pl,genialne.pl,pysznosci.pl,nocowanie.pl#%#AG_onLoad(function(){if(!(-1<document.cookie.indexOf("OAX")||"undefined"!=typeof localStorage&&null!==localStorage.getItem("crdab"))){var a=new MutationObserver(function(){var b=document.evaluate("//button[contains(text(), 'PRZECHODZ')]",document,null,XPathResult.ANY_TYPE,null).iterateNext();b&&(a.disconnect(),setTimeout(function(){b.click()},1E3))});a.observe(document,{childList:!0,subtree:!0});setTimeout(function(){a.disconnect()},1E4)}});

Something like:
example.com#%#//scriptlet('trusted-click-element', 'button[name="agree"]', 'containsText:/agree|accept/')

@adguard-bot adguard-bot changed the title 'trusted-click-element' - Add the ability to click on an element containing a given text. Improve 'trusted-click-element' — add the ability to click on an element containing a given text Mar 11, 2024
adguard pushed a commit that referenced this issue May 24, 2024
…trusted-click-element` scriptlet. #409

Squashed commit of the following:

commit ca8289f
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu May 23 18:13:48 2024 +0200

    Add separate const

commit 609c544
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu May 23 17:24:35 2024 +0200

    Update toRegExp

commit 1f671bd
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu May 23 17:06:14 2024 +0200

    Use null instead of empty string

commit 628e64f
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu May 23 16:36:59 2024 +0200

    Convert to TypeScript

commit a47011e
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu May 23 14:23:47 2024 +0200

    Rename `elementContainsText` to `doesElementContainText` and refactor it

commit 7fab2a8
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu May 23 13:18:49 2024 +0200

    Add ability to click on the element with specified text in `trusted-click-element` scriptlet
@adguard-bot adguard-bot assigned slavaleleka and unassigned maximtop May 27, 2024
@adguard-bot adguard-bot changed the title Improve 'trusted-click-element' — add the ability to click on an element containing a given text Improve 'trusted-click-element' — add an ability to click on an element containing a given text Jun 13, 2024
@slavaleleka slavaleleka added the enhancement Improvement of existent feature label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants