File size: 530 Bytes
943acb7 da44018 943acb7 da44018 943acb7 da44018 943acb7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
function () {
function waitForElementToAppear(selector, callback) {
const targetNode = document.body;
const config = { childList: true, subtree: true };
const observer = new MutationObserver((mutationsList, observer) => {
const element = document.querySelector(selector);
if (element) {
observer.disconnect();
callback(element);
}
});
observer.observe(targetNode, config);
}
waitForElementToAppear("#player button.play-pause-button", (button) => {
button.click();
});
} |