-
-
Save 10crimes/e6ac4109a6b23652d25c3dcb40d116c3 to your computer and use it in GitHub Desktop.
SoundCloud: Download Button
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name SoundCloud: Download Button | |
| // @namespace e7fc358c1e5cc159ce3f327246807caa | |
| // @include https://soundcloud.com/* | |
| // @version 1.1 | |
| // @grant none | |
| // @run-at document-idle | |
| // ==/UserScript== | |
| (function() { | |
| `use strict`; | |
| let More = document.querySelector(`.sc-button-more`); | |
| if (!document.querySelector(`.moreActions`)) { | |
| More.dispatchEvent(new MouseEvent(`click`, {})); /* open */ | |
| }; | |
| let Dl = document.querySelector(`.sc-button-download`); | |
| More.dispatchEvent(new MouseEvent(`click`, {})); /* close */ | |
| if (!Dl) {return; /* no download button */}; | |
| let Dl2 = More.cloneNode(); | |
| // Dl2.classList.add(`sc-button-download`); // breaks stuff | |
| Dl2.classList.remove(`sc-button-more`); | |
| Dl2.innerHTML = `Download`; | |
| More.parentNode.insertBefore(Dl2, More); | |
| Dl2.addEventListener(`click`, function(Ev) { | |
| if (!document.querySelector(`.moreActions`)) { | |
| More.dispatchEvent(new MouseEvent(`click`, {})); /* open */ | |
| }; | |
| Dl = document.querySelector(`.sc-button-download`); | |
| Dl.dispatchEvent(new MouseEvent(`click`, {})); | |
| More.dispatchEvent(new MouseEvent(`click`, {})); /* close */ | |
| }, true); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment