Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
hide non-badged chat comments
function handle_chat() {
Array.from(document.querySelectorAll('.video-chat__message-list-wrapper li')).filter(x => {
return x.querySelectorAll('[data-a-target="chat-badge"]').length === 0;
}).forEach(x => {
x.setAttribute('style', 'display: none');
});
}
function start_observation() {
// Select the node that will be observed for mutations
var targetNode = document.querySelector('.video-chat__message-list-wrapper');
// Options for the observer (which mutations to observe)
var config = {
attributes: true,
childList: true,
subtree: true
};
// Callback function to execute when mutations are observed
var callback = function (mutationsList, observer) {
for (var mutation of mutationsList) {
if (mutation.type == 'childList') {
handle_chat()
}
}
};
// Create an observer instance linked to the callback function
var observer = new MutationObserver(callback);
// Start observing the target node for configured mutations
observer.observe(targetNode, config);
}
start_observation();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.