playlists buttons

Adds Buttons to your favorite playlists.

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

  1. // ==UserScript==
  2. // @name playlists buttons
  3. // @version 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('PLAYLIST NAME','PLAYLIST LINK');
  22. }
  23. setTimeout(playlistsLoad, 500);
  24. function insertButton(playlistname,playlistlink) {
  25. let playlist = document.createElement('a');
  26. let header = document.querySelector('.header__middle');
  27. playlist.innerHTML = playlistname;
  28. playlist.className = 'playlist-button';
  29. playlist.href = playlistlink;
  30. if (header) {
  31. header.insertBefore(playlist, header.children[2]);
  32.  
  33. } else {setTimeout(playlistsLoad, 1000);}
  34. }
  35. })();