您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
A simple download button for Bandcamp and Bandcamp based sites
当前为
// ==UserScript== // @name Bandcamp Download Button // @namespace https://flawcra.cc // @version 1.0.1 // @description A simple download button for Bandcamp and Bandcamp based sites // @author FlawCra // @match https://*.bandcamp.com/track/* // @match https://*.bandcamp.com/album/* // @match https://music.monstercat.com/album/* // @match https://music.monstercat.com/track/* // @grant none // ==/UserScript== (function() { 'use strict'; var bar = document.getElementsByClassName("share-collect-controls")[0] var spacer = document.createElement("a"); spacer.setAttribute("id", "collect-anchor"); bar.appendChild(spacer); var elem = document.createElement("li"); elem.setAttribute("id", "download-item"); elem.setAttribute("class", "download"); var action = document.createElement("span"); action.setAttribute("id", "download-msg"); action.setAttribute("class", "action compound-button"); action.setAttribute("title", "Download this track"); action.addEventListener("click", () => { if(document.getElementsByTagName("audio")[0].src) { fetch("https://cors.flawcra.cc/"+btoa(document.getElementsByTagName("audio")[0].src)).then(function(t) { return t.blob().then((b)=>{ var a = document.createElement("a"); a.href = URL.createObjectURL(b); if(document.getElementsByClassName("title")[0].innerText) { a.setAttribute("download", document.getElementById("name-section").children[1].firstElementChild.innerText + " - " +document.getElementsByClassName("trackTitle")[0].innerText + " - " + document.getElementsByClassName("title")[0].innerText + ".mp3"); } else { a.setAttribute("download", document.getElementById("name-section").children[1].firstElementChild.innerText + " - " +document.getElementsByClassName("trackTitle")[0].innerText + ".mp3"); } a.click(); }); }); } else { alert("Please play a song first!") } }); var msg = document.createElement("span"); action.setAttribute("class", "download-msg"); var textwrapper = document.createElement("span"); var btntext = document.createElement("a"); btntext.innerText = "Download"; textwrapper.appendChild(btntext); msg.appendChild(textwrapper); action.appendChild(msg); elem.appendChild(action); bar.appendChild(elem); })();