playlists buttons

Adds Buttons to your favorite playlists.

当前为 2022-08-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name playlists buttons
  3. // @version 1.2
  4. // @description Adds Buttons to your favorite playlists.
  5. // @author Bliwi
  6. // @match https://soundcloud.com/*
  7. // @grant none
  8. // @run-at document-end
  9. // @noframes
  10. // @license MIT
  11. // @namespace https://greasyfork.org/users/943433
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. /* Injects Button into the page once it has loaded,
  18. then tries to re-add it if it disappears due to page change
  19. */
  20. function playlistsLoad() {
  21. insertButton('Subscribe!','PLAYLIST LINK');
  22. insertButton('Bangers','PLAYLIST LINK');
  23. insertButton('Favorites','PLAYLIST LINK');
  24. insertButton('Wowk and Focus','PLAYLIST LINK');
  25. insertButton('Anime Music','PLAYLIST LINK');
  26. }
  27. setTimeout(playlistsLoad, 500);
  28. function insertButton(playlistname,playlistlink) {
  29. let playlist = document.createElement('Button');
  30. let header = document.querySelector('.header__middle');
  31. playlist.innerHTML = playlistname;
  32. playlist.onclick = function(){location.href = playlistlink;};
  33. playlist.className = 'playlist-button';
  34. if (header) {
  35. header.insertBefore(playlist, header.children[2]);
  36.  
  37. } else {setTimeout(playlistsLoad, 1000);}
  38. }
  39. })();