Udio License Agreement Clicker

Clicks Udio License Agreement

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Udio License Agreement Clicker
// @namespace    http://www.facebook.com/Tophness
// @version      2024-06-29
// @description  Clicks Udio License Agreement
// @author       You
// @match        https://www.udio.com/my-creations
// @icon         https://www.google.com/s2/favicons?sz=64&domain=udio.com
// @license MIT
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Create a MutationObserver to observe changes in the DOM
    const observer = new MutationObserver((mutationsList, observer) => {
        for(let mutation of mutationsList) {
            if (mutation.type === 'childList') {
                const targetDiv = document.querySelector('div[class*="data-[state=closed]:slide-out-to-top"][class*="data-[state=open]:slide-in-from-top"]');
                if (targetDiv) {
                    const firstButton = targetDiv.querySelector('button.peer.shrink-0.rounded-sm.border.border-primary');
                    const secondButton = targetDiv.querySelector('button.inline-flex.items-center.justify-center.whitespace-nowrap.rounded-md.text-sm.font-medium.bg-primary');

                    if (firstButton) firstButton.click();
                    if (secondButton){
                        setTimeout(function() {
                            secondButton.click();
                        }, 1000);
                    }

                    // Stop observing once the buttons are clicked
                    observer.disconnect();
                }
            }
        }
    });

    // Start observing the document body for added nodes
    observer.observe(document.body, { childList: true, subtree: true });
})();