SoundCloud: Disable Autoplay

Disable autoplay in soundcloud

// ==UserScript==
// @name        SoundCloud: Disable Autoplay
// @description Disable autoplay in soundcloud
// @version     2025.01.09
// @author      tari3x
// @license     MIT
// @namespace   https://github.com/tari3x
// @match       https://soundcloud.com/*
// @run-at      document-end
// ==/UserScript==

function waitTillExists(selector, callback) {
    new MutationObserver(function(mutations) {
        let element = document.querySelector(selector);
        if (element) {
            this.disconnect();
            callback(element);
        }
    }).observe(document, {subtree: true, childList: true});
}

function toggle(element) {
  element.click();
}

waitTillExists(".toggle", toggle);