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-dispatch-event' #382

Closed
AdamWr opened this issue Nov 14, 2023 · 0 comments
Closed

Add new scriptlet — 'trusted-dispatch-event' #382

AdamWr opened this issue Nov 14, 2023 · 0 comments

Comments

@AdamWr
Copy link
Member

AdamWr commented Nov 14, 2023

It could be useful in this case - AdguardTeam/AdguardFilters#166126
Instead of allowing cookie notice and closing it, we could use dispatchEvent() to load video player.

Something like:

function dispatchCustomEvent(event, element) {
  if (!event) {
    return;
  }
  const ev = new CustomEvent(event);
  const el = element ? document.querySelector(element) : document;
  if (el) {
   el.dispatchEvent(ev);
  }
}

and then:

dispatchCustomEvent('consentGranted')
@adguard-bot adguard-bot assigned slavaleleka and unassigned maximtop Mar 28, 2024
adguard pushed a commit that referenced this issue Apr 12, 2024
Squashed commit of the following:

commit f174452
Author: Adam Wróblewski <adam@adguard.com>
Date:   Fri Apr 12 10:52:11 2024 +0200

    Refactor trustedDispatchEvent and rename variables

commit 88a5dd8
Author: Slava Leleka <v.leleka@adguard.com>
Date:   Thu Apr 11 18:26:17 2024 +0300

    Update description

commit b8cf974
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu Apr 11 17:20:03 2024 +0200

    Update description

commit 3736c8d
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu Apr 11 16:32:35 2024 +0200

    Rename `element` to `target`

commit c6eee57
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu Apr 11 11:13:55 2024 +0200

    Use common event types in examples

commit edc0b49
Author: Slava Leleka <v.leleka@adguard.com>
Date:   Thu Apr 11 12:00:35 2024 +0300

    Update docs

commit cff3174
Author: Slava Leleka <v.leleka@adguard.com>
Date:   Thu Apr 11 12:00:01 2024 +0300

    Update changelog

commit c95fd26
Merge: 1f62260 62144fc
Author: Adam Wróblewski <adam@adguard.com>
Date:   Tue Apr 9 10:20:33 2024 +0200

    Merge branch 'master' into feature/AG-27676

commit 1f62260
Author: Adam Wróblewski <adam@adguard.com>
Date:   Fri Apr 5 13:36:03 2024 +0200

    Change to trusted scriptlet

commit 9382072
Author: Adam Wróblewski <adam@adguard.com>
Date:   Fri Apr 5 13:27:39 2024 +0200

    Add ability to dispatch events on the window object

commit 8007b06
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu Apr 4 16:07:47 2024 +0200

    Add dispatch-event scriptlet
@adguard-bot adguard-bot changed the title Add scriptlet to trigger event - dispatchEvent() Add new scriptlet — 'trusted-dispatch-event' Jun 13, 2024
@slavaleleka slavaleleka added the Feature request Adding new 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