// Function to handle mutations const handleMutations = (mutationsList, observer) => { mutationsList.forEach((mutation) => { if (mutation.type === 'childList') { mutation.addedNodes.forEach((node) => { // Check if the added node is a video element if (node.tagName && node.tagName.toLowerCase() === 'video') { // Delete the video element node.remove(); } }); } }); }; // Select the target node const targetNode = document.body; // Options for the observer (including the types of mutations to observe) const config = { childList: true, subtree: true }; // Create an observer instance linked to the callback function const observer = new MutationObserver(handleMutations); // Start observing the target node for configured mutations observer.observe(targetNode, config); // To disconnect the observer later (when you want to stop watching for mutations) // observer.disconnect();