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

feat: element filter (whitelist/blacklist) (user-configured) #153

Open
WofWca opened this issue May 3, 2023 · 0 comments
Open

feat: element filter (whitelist/blacklist) (user-configured) #153

WofWca opened this issue May 3, 2023 · 0 comments

Comments

@WofWca
Copy link
Owner

WofWca commented May 3, 2023

This is similar to #26, but offers a different, more generic approach (this can be a superset of #26).

We could add an option that works like a filter function. It is executed for every media (audio/video) element. The API is like this:

type Filter = (context: { srcUrl: URL, pageUrl: URL, element: HTMLMediaElement }) => boolean

If the return value is true, then we attach to the element, otherwise not.

We need to make it accessible to users though, and make sure that it's hard (impossible?) to execute arbitrary code there, in case someone decided to copy-paste the filters from somewhere.
Though initially we could implement a simplistic version, accessible by advanced users only (say, through the console).

I'm sure this task or similar has been solved already and there are available solutions / filtering languages. First thing that comes to mind is adblocker extension rules, like in uBlock Origin.

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

1 participant