Adds Buttons to your favorite playlists.
当前为
// ==UserScript==
// @name playlists buttons
// @version 1.2.1
// @description Adds Buttons to your favorite playlists.
// @author Bliwi
// @match https://soundcloud.com/*
// @grant none
// @run-at document-end
// @noframes
// @license MIT
// @namespace https://greasyfork.org/users/943433
// ==/UserScript==
(function() {
'use strict';
/* Injects Button into the page once it has loaded,
then tries to re-add it if it disappears due to page change
*/
function playlistsLoad() {
insertButton('PLAYLIST NAME','PLAYLIST LINK');
}
setTimeout(playlistsLoad, 500);
function insertButton(playlistname,playlistlink) {
let playlist = document.createElement('Button');
let header = document.querySelector('.header__middle');
playlist.innerHTML = playlistname;
playlist.onclick = function(){location.href = playlistlink;};
playlist.className = 'playlist-button';
if (header) {
header.insertBefore(playlist, header.children[2]);
} else {setTimeout(playlistsLoad, 1000);}
}
})();