|
楼主 |
发表于 2024-1-6 13:01:15
|
显示全部楼层
湖北省武汉市
// Create MutationObserver instance
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
// On each DOM change, find and click "Remove" buttons
findAndClickRemoveButtons();
});
});
// Configure MutationObserver to listen to changes in the entire document tree
var observerConfig = { childList: true, subtree: true };
// Start MutationObserver
observer.observe(document.body, observerConfig);
// Function to find and click buttons with text content "Remove"
function findAndClickRemoveButtons() {
var removeButtons = Array.from(document.querySelectorAll('button')).filter(function(button) {
return button.textContent.trim() === 'Remove';
});
if (removeButtons.length > 0) {
// Loop through and click all matching buttons
removeButtons.forEach(function(button) {
button.click();
});
}
}
// Initial search and click when the page loads
findAndClickRemoveButtons(); |
|