soundcloud disable autoplay station

Opens the Soundcloud Next Up menu and turns off the Autoplay Station on load, then continually disables it

当前为 2019-08-11 提交的版本,查看 最新版本

// ==UserScript==
// @name         soundcloud disable autoplay station
// @version      1.1
// @description  Opens the Soundcloud Next Up menu and turns off the Autoplay Station on load, then continually disables it
// @author       bhackel
// @match        https://soundcloud.com/*
// @grant        none
// @run-at       document-start
// @noframes
// @namespace https://gf.qytechs.cn/en/users/324178-bhackel
// ==/UserScript==

(function() {
    'use strict';

    function openQueue() {
        // opens the Next Up Queue to load the Autoplay button
        var queueTrigger = document.getElementsByClassName("playbackSoundBadge__queueCircle").item(0);
        if (queueTrigger) {
            // check if next up button is loaded, then open it and call to close it
            queueTrigger.click();
            closeQueue(queueTrigger);
        } else {
            // perform another check after delay
            setTimeout(openQueue, 500);
        }
    }

    function closeQueue(queueTrigger) {
        // closes the Next Up queue once the Autoplay button has loaded
        var buttonDiv = document.getElementsByClassName("queueFallback__toggle").item(0);
        if (buttonDiv) {
            // check if the button has loaded, then close the queue and call the loop
            queueTrigger.click();
            disableButtonLoop();
        } else {
            // perform another check after delay
            setTimeout(function() { closeQueue(queueTrigger); }, 500);
        }
    }

    function disableButtonLoop() {
        // repeatedly tries to turn off the Autoplay button
        var buttonDiv = document.getElementsByClassName("queueFallback__toggle").item(0);
        if (buttonDiv) {
            // make sure it exists to not error
            var button = buttonDiv.children.item(0);
            if (button.className === "toggle sc-toggle sc-toggle-active") {
                // it has this classname when Autoplay is enabled
                button.click();
            }
        }
        setTimeout(disableButtonLoop, 2000);
    }

    openQueue();
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址