Created
August 16, 2022 15:05
-
-
Save Drag13/ceb6821cf519c277f17bef0c91bb570f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function clean() { | |
| const allowed = []; | |
| const container = document.querySelector("section"); | |
| const $allTopicsRaw = [...container.querySelectorAll("[role=button]")]; | |
| const $allTopics = $allTopicsRaw.reduce((acc, el, i) => { | |
| const isTopic = i % 2 === 0; | |
| isTopic ? acc.push({ topic: el }): acc[acc.length - 1].cancel = el | |
| return acc; | |
| }, []); | |
| const $filtered = $allTopics.filter(($topic) => { | |
| const topic = $topic.topic.querySelector("span").innerText.trim().toLocaleLowerCase(); | |
| const isAllowed = allowed.includes(topic); | |
| return !isAllowed; | |
| }); | |
| $filtered.forEach((el) => el.cancel?.click()); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment