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

Add new scriptlet — 'trusted-add-class' #430

Open
Alex-302 opened this issue May 30, 2024 · 3 comments
Open

Add new scriptlet — 'trusted-add-class' #430

Alex-302 opened this issue May 30, 2024 · 3 comments
Labels

Comments

@Alex-302
Copy link
Member

Alex-302 commented May 30, 2024

The trusted-add-class would provide an opportunity to add any class name to an element. For example, sometimes it happens that a script checks the body class list.

example.com#%#//scriptlet('trusted-add-class', selector, classNames[, applying])

where

  • classNames can be a single class or multiple classes separated by commas, e.g. foo or foo,bar
  • applying can be asap, complete and stay like in remove-attr

Can be used on:

  • myonlineradio.hu - bypass antiadblock.
@Alex-302 Alex-302 added the Feature request Adding new feature label May 30, 2024
@Alex-302

This comment was marked as outdated.

@slavaleleka slavaleleka reopened this May 30, 2024
@slavaleleka slavaleleka changed the title Add trusted-add-class scriptlet Add new scriptlet — 'trusted-add-class' May 30, 2024
@adguard-bot adguard-bot changed the title Add new scriptlet — 'trusted-add-class' Add new scriptlet — 'trusted-add-class' May 30, 2024
@AdamWr
Copy link
Member

AdamWr commented Jul 12, 2024

I think that it can be achieved by using trusted-set-attr, for example:

example.org#%#//scriptlet('trusted-set-attr', 'div', 'class', 'foo bar')

Only the applying part is not supported, so I guess it could be implemented if necessary.

@krystian3w
Copy link

Does this construction assume that it will be usable when the div already has classes?

So that others will not disappear by default or pages will start checking the position in the attribute or even counting the number of white separating characters?

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

No branches or pull requests

5 participants